Fade in timer callback crash

  • Using a pitch or gain fade in the timer callback, even when the fade is shorter than the timer interval causes a crash.

    <Processor Type="ScriptProcessor" ID="Script Processor" Bypassed="0" Script="var id;function onNoteOn()&#10;{&#10;&#9;id = Message.getNoteNumber();&#13;&#10;&#9;Synth.startTimer(0.5);&#10;}&#10;function onNoteOff()&#10;{&#10;&#9;Synth.stopTimer();&#10;}&#10;function onController()&#10;{&#10;&#9;&#10;}&#10;function onTimer()&#10;{&#10;&#9;Synth.addPitchFade(id, 300, 1, 0);&#10;}&#10;function onControl(number, value)&#10;{&#10;&#9;&#10;}&#10;">
      <EditorStates BodyShown="1" Visible="1" Solo="0" contentShown="1" onInitOpen="0"
                    onNoteOnOpen="0" onNoteOffOpen="0" onControllerOpen="0" onTimerOpen="1"

  • Ah yes, I am using the timestamp of the message that triggered the callback for the insertion time in the buffer but when there's no message (which is the case in either the onTimer or the onControl callback), it goes bogus. Nice catch!

  • While your working on this would it be possible to make it so we can store the entire message in a variable to pass it around? Currently I'm having to basically create my own message object and put the various properties, note number, velocity, id, etc. in it one at a time.

  • Yes, but this is a little bit more complicated than fixing this crash (which is literally two lines of code).

    What do you think about this way:

    reg myMessage = Message.createHolder(); // a custom object type (like MidiList that stores a message)
    function onNoteOn()
        Message.store(myMessage); // stores the current message into the given holder object
    function onTimer()
         local eventId = myMessage.getEventId(); // Uses the same methods as Message.XXX()

  • Looks good to me 🙂

  • This still seems to be an issue in the latest build, or I've done something wrong when I built it 😛

  • I somehow can't reproduce this anymore, but I added the MessageHolder objects (create one using Engine.createMessageHolder() and use it like described above.

  • Thanks, I look forward to testing this out 🙂

  • There is also a new function Synth.addMessageFromHolder(messageHolder), which simply adds the event as it is (this saves some typing).

  • This issue seems to be fixed now 🙂