[Scriptlet] Scale Quantize

Yes, understood thanks.

Still, the situation remains to be dealt with -

function MultiChannelNoteTracker_GotNote (mt : MultiChannelNoteTracker, note : NoteMessage)

was created and supplied for a purpose (and has been used in script to accomplish that purpose).

Now it is deprecated, and presumably will eventually go away.

In scripts which currently use it, what code is recommended to replace the functionality with equivalent using

function MultiChannelNoteTracker_GotMidiMessage (mt : MultiChannelNoteTracker, m : MidiMessage)

instead (as recommended), and thus bring the script up to the desired modern standard?

Ah - you found a bug!

That actually should work. I’m surprised nobody found this before.

I just looked at the declaration of that function and it seems I forgot to add the Autotype attribute to it. I’ve just fixed that and it will be in the next update (coming quite soon)

1 Like

OK, thanks!

So, to see if I understand -

Are you saying that

function MultiChannelNoteTracker_GotMidiMessage (mt : MultiChannelNoteTracker, m : MidiMessage)

will become

function MultiChannelNoteTracker_GotMidiMessage (mt : MultiChannelNoteTracker, m : MidiMessage) autotype

for the next release?

And after it does, then it can replace existing calls to

function MultiChannelNoteTracker_GotNote (mt : MultiChannelNoteTracker, note : NoteMessage)

on a 1-for-1 basis without further code being required?

The above is what I infer from your reply in this topic:

but I’m not sure if that’s a correct inference or not.

Yes, that’s correct.

The Autotype is designed to handle certain kinds of conversions based on relationships.

NoteMessage, ChannelMessage, etc are all specialized versions of MidiMessage and if Autotype is defined, then you can pass any of those as an actual argument.

That said, using such a feature with your own functions requires a deep understanding of type relationships and should be done with care (i.e, you’re on your own if you break something)

1 Like