Hi Eric,
This is a fix, not a demonstration
All mfx plugs have two main functions, OnInput and OnEvents, in MfxScript I renamed them a bit more friendly, OnLiveEvents and OnTrackEvents.
In this case, the problem is with track events.
OnTrackEvents(Count, timeFrom, timeThru)
This function is called by the host in advance, with events in the time range of 'timeFrom' to 'timeThru'. Now, in the case of a quantizing plug, it may happen that the new timestamp of the event will be smaller than 'timeFrom' or greater than 'timeThru'.
Current S3 will just put these events in the trash box. (bug)
The fix:
If the event timestamp is greater than timeThru, MfxScrip handles them internally, they are put in an intermediate buffer and will be sent to the host at the correct time.
The problem is with events that have a smaller timestamp than timeFrom, inthis case MfxScript can't do anything.
So, the fix is to make the track play earlier, this is why we enter -960 in the Time field of the track settings.
Then, this script will put back the events at the right time, by adding 960 to each event's timestamp.
In mfx, 960 ticks are ALWAYS 1 beat (independent from the project 'Ticks per quarter-note' setting), but for clarity, you should also set it to 960 in the project settings.
That means also that the first event in your track should start at least after the first beat. I always start my projects on measure 2 or 3.
PS: In MfxScript, if an event is buffered, I increase the port value by 127, so I know that I already 'treated' this event, that's why we have if ev(evPORT) < 127 ... in the script.