Jump to content

10.4.5 Scripter Changes


Dewdman42
 Share

Recommended Posts

Looks like LPX 10.4.5 has changed some stuff in Scripter, possibly breaking some scripts, but enabling some new features too.

 

Here is some more info about the problems I've been finding. I really think this is related to the fact that Scripter is not including EventTypes.js anymore. So Event objects are not proper objects and weird stuff happens

 

Apple responded to my bug report asking for more info, it was an automated message I got I'm sure, but anyway I have responded to them and we'll see where it gets. In the past they have not communicated with me again after I gave them follow up information.

 

  1. Had some very strange behavior while trying to create new NoteOn events and could not figure it out. I eventually narrowed it down to a simple example, but whatever is going on here could manifest itself it really confusing ways with more complex scripts. This is the biggest problem IMHO it represents total corruption of the core Scripter engine and Scripter 10.4.5 should not be trusted!
     
    Take the following example:
     
       var firstNote = new NoteOn;
       firstNote.pitch = 24;
       firstNote.trace();
       
       var secondNote = new NoteOn;
       
       firstNote.trace();
    


     
    In the above, its tracing the firstNote object twice, but notice after creating a secondNote object, the firstNote has its pitch changed to match that of the secondNote! Danger will Robinson...
     
     

    Script evaluated successfully!
    [NoteOn channel:1 pitch:24 [C0] velocity:100]
    [NoteOn channel:1 pitch:100 [E6] velocity:100]
    


     
    I got all kinds of more complicated and convoluted results in my more complex script that are hard to figure out what is going on, but basically Scripter is mismatching some internal pointers somewhere in my opinion..
     
     

  2. All of the Event types have a toString() function defined in EventTypes.js. They are missing now, so toString() does not work as it should and has in the past. If you try to use it you will just get useless info back.
     
     
  3. In attempting to copy and paste the toString() function from EventTypes.js, I found that code will also not work properly now because Events are not proper javascript objects, so they lack a constructor property. Here is the code from EventTypes.js that normally converts a Note event into a string:
     
       var returnString = '[' + this.constructor.name +
              ' channel:' + this.channel +
              ' port:' + this.port +
              ' pitch:' + this.pitch +
              ' [' + MIDI.noteName(this.pitch) + ']' +
              ' velocity:' + this.velocity;
              if (this.articulationID)
                  returnString += ' articulationID:' + this.articulationID;
              returnString += ']';
              
              Trace(returnString);
    



    Attempting to use the above will provide some of the output you might expect, but the event type is not there, since event.constructor is undefined. Other oddities too. Basically it comes back to the fact that Event objects are not what they used to be and EventTypes.js is not being included anymore.
     
     

  4. I also get Scripter now complaining a lot when I try to log objects using JSON.stringify(), that should log to the console just fine and did before, but now under 10.4.5 it complains about "cyclic structures"...in a way that doesn't make sense.
     
     
  5. Event class hierarchy is not present. Its not possible in 10.4.5 to add methods to Event objects. For example the following will not work at all, it will cause an error in Scripter when you click the Run Script button:
     
    Event.prototype.sendByPort = function() {
       Trace("sending through added interface");
       this.send();
    };
    


     

  6. EventTypes.js has something defined called PrimingEvent, which is now not defined due to EventTypes.js not being included anymore. Also when you hit the run script button, a single PrimingEvent object is "primed" through the HandleMIDI function sometimes. This has been the behavior in the past, which is annoying. It doesn't always happen, but somehow, sometimes it does. Anyway, it used to be possible to do this:
     
       if(event instanceof PrimingEvent) {
           return;
       }
    


     
    In order to ignore that PrimingEvent in HandleMIDI(). However, now that PrimingEvent is not defined, the above will not work at all.

 

 

 

 

 

There could be more problems, this is just what I have for now. I have responded to Apple's request for more info, let's hope they do something about it. In a nutshell what I can say is that I think Apple has changed up somewhat drastically how event objects are represented internally in Scripter in a way that is not fully Javascript compliant. Also, they might be using some internal structures, which are now misaligned in some way, resulting in data corruption. Furthermore the EventTypes.js file is no longer being including, resulting in more broken functionality.

 

I do note that they added a new include file called MIDIClass.js, which has some of the stuff that used to be in EventTypes.js. But none of the stuff related to the Event class hierarchy is in there. That stuff is still in EventTypes.js, but that doesn't appear to be included when running a script now.

Edited by Dewdman42

OSX 12.x (Monterey) on OpenCore - Logic Pro 10.7.4, VePro7, Mainstage3 - 5,1 MacPro 3.46ghz x 12 96gb ram

Link to comment
Share on other sites

FWIW I tried copy and pasting EventTypes.js into the top of scripts. Some of the above listed problems do go away when doing that but some new problems come in such as the instanceof operator no longer works on event objects.

 

Unfortunately this workaround will not solve the problems.

 

This tells me the problems are not a simple oversight on apple’s part but more that they made a large change to scripter which is half baked and will require more work to make it completely compatible with what they had before. Additionally I can’t find any work around at all for the internal data corruption I mentioned above. It simply can’t be trusted until it’s fixed.

OSX 12.x (Monterey) on OpenCore - Logic Pro 10.7.4, VePro7, Mainstage3 - 5,1 MacPro 3.46ghz x 12 96gb ram

Link to comment
Share on other sites

Does it work well with the Audio Grocery Scripts? Any issues here? Thank you

There are no issues with the AG Articulation Scripter.

AG system is 100% compatible with Logic 10.4.5.

 

BTW. Lets remind you that AG system offers an additional alternative (without Scripter) - saving the AG Editor Presets as Logic Art Sets.

Link to comment
Share on other sites

  • 2 weeks later...

Logic 10.4.6 seems to have fixed most of the problems I found in 10.4.5. There are only a couple of obscure things not quite resolved, but will not effect most people. (that I found so far, more testing needed).

 

FYI for everyone, EventTypes.js has been officially removed from Scripter in Logic 10.4.6. Near as I can tell, event objects are now entirely native objects, they are not full javascript objects. In practice, most people won't notice, but a few advanced javascript methodologies won't work with them anymore unless they further improve the native object support.

 

  1. without EventTypes.js, there is no definition for the PrimingEvent event type, which was useful for me in the past to detect blank empty events that were sometimes being picked up by HandleMIDI(). Time will tell if this is no longer necessary or some work around needed.
  2. I doubt its possible to subclass Events into further event subtypes, but most people probably aren't doing that.
  3. Since Event objects are not true javascript objects, there is no event.constructor either. Cannot use, for example, event.constructor.name to get the event type as a string.
  4. I was able to add methods to event prototype, however, which is weird that I could given the above, but I did and it seemed to work.

 

In general, the underlying serious problems in 10.4.5 have been fixed and Scripter 10.4.6 should be safe to use for most people. Some advanced javascript approaches may run into odd problems with Event objects due to they not being true javascript objects anymore or wrapped by prototypes in EventTypes.js. What I just wrote is complete jibberish for most of you, so don't worry about it.

OSX 12.x (Monterey) on OpenCore - Logic Pro 10.7.4, VePro7, Mainstage3 - 5,1 MacPro 3.46ghz x 12 96gb ram

Link to comment
Share on other sites

  • 1 year later...

I realize this was 2 years ago that you posted this, and it's amazing how long it's taken me to catch wise, but I just wanted to chime in and lament. I exploited the mess out of that EventTypes file, extended it out into a 3500 line library of methods for MIDI manipulation. All essentially worthless now.

Raise a glass to the good ol' days.

Logic Pro X 10.6.2

macOS Big Sur 11.4

Hackintosh

3.7 GHz Intel Core i9 (10 Core)

32GB

Antelope Zen Tour Synergy Core

Link to comment
Share on other sites

Fear not, there is still a way. See this file:

 

/Applications/Logic\ Pro\ X.app/Contents/Frameworks/MADSP.framework/Versions/A/Resources/MIDIClass.js

 

You can put all your custom library code in there and it will still work the same was as EventTypes.js did, but the only thing is you can't subclass from Event class anymore, which you probably weren't doing anyway. If you were, then sorry to say, I don't think you can now. ;-)

OSX 12.x (Monterey) on OpenCore - Logic Pro 10.7.4, VePro7, Mainstage3 - 5,1 MacPro 3.46ghz x 12 96gb ram

Link to comment
Share on other sites

Thank you! That's good to know. Alas yes, I was doing all sorts of ridiculous things like subclassing from the event class, and extending existing classes. It was all madness anyway.

Really appreciate the reply!

Logic Pro X 10.6.2

macOS Big Sur 11.4

Hackintosh

3.7 GHz Intel Core i9 (10 Core)

32GB

Antelope Zen Tour Synergy Core

Link to comment
Share on other sites

extending the Event class is still totally possible and doable and I use that approach all the time there are a few very good reasons to do it. Subclassing Event probably won't work. I say probably because I've never tried it. But most likely the Event objects are now implemented internally as native objects rather then in javascript itself. Or its possible that the javascript is still there inside LogicPro binary somewhere. I haven't actually tried it. if you have some Event subclasses I'd be curious if it still works for you ever since Event classes were moved out of the visible EventTypes.js file.

 

But still LogicPro presents the Event objects as normal javascript objects that you can extend by adding methods or attributes to without problems.

 

The one area where I wish EventTypes.js was still there is because previously they exposed a couple callable functions, like SendEvent, or whatever it was called. Then each of the Event javascript classes basically called that one general purpose midi event send function.

 

We no longer have that global low level function available to us now. This is a bummer because there is now no way to override Event.send() to do something else. You can replace Event.send() method with other functionality, but then when you do you won't be able to tell it any way to actually send the event, since that lower level function is no longer available to be called. Override Event.send() and then ironically you cut off the ability to send events. Anyway, minor niggles..you'll figure it out. I think you can probably still do a lot of what you were doing before with just a little bit of tweaking.

OSX 12.x (Monterey) on OpenCore - Logic Pro 10.7.4, VePro7, Mainstage3 - 5,1 MacPro 3.46ghz x 12 96gb ram

Link to comment
Share on other sites

That's actually very reassuring, thank you. Ah, amazingly I think that was one of the few things I never tweaked, the actual event sending method. Glad I didn't now!

Logic Pro X 10.6.2

macOS Big Sur 11.4

Hackintosh

3.7 GHz Intel Core i9 (10 Core)

32GB

Antelope Zen Tour Synergy Core

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...