Home Forums General Programming Timer – Sleep, Pause, Wait

This topic contains 4 replies, has 2 voices, and was last updated by lfo2vco lfo2vco 4 years ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #14436
    lfo2vco
    lfo2vco
    Participant

    Hi,

    I am wondering if anyone has created a wait function using the timer class? I have been scouring the net looking up examples of Lua sleep functions, but I get the impression these are problematic. I certainly have not been able to adapt anything so far.

    Just thinking I may be hitting my head against a brick wall regarding this one.

    #14465
    atom
    atom
    Moderator

    I can try to implement something like that and add that to the Lua API. Can you explain the situation you want to use that in ? In general you should never use a method like that, this is what most of people will tell you, i’m now one of those people but maybe we can work around the problem you have.

    #14476
    lfo2vco
    lfo2vco
    Participant

    Hi Atom, many thanks for responding.

    OK the situation is this: My panel has a feature to save the modulator settings to disk as a .syx file. On loading this file back into the panel the modulator values are reset from the data. As each modulator is set it sends its corresponding sysex message to the synth.
    However the resulting sound seems incomplete. This process generates a large amount of small sysex messages in a very short amount of time and probably swamps the synths processor.
    So one line of thought was to introduce a small ‘pause’ between each modulator being set, to give time for each resulting sysex message to get through.

    I understand that using ‘sleep’ is a big programming NO (I probably should not have refered to it in the title). I was thinking more along the lines of a ‘busy wait’ and wondered if anyone had used the ‘timer class‘ for something like this. I realise that timer intended for animation and that it requires a callback to work, so this is probably a very long shot. But hey if you don’t ask…

    #14478
    atom
    atom
    Moderator

    There are at least 2 ways out here

    1) there is a special delay setting for a panel that sets a time parameter for all MIDI messages, this parameter causes the messages to be dealyed before sending by that amount of time

    2) you should set the modulator values without sending MIDI, and then at the end (when all values are in place) trigger sending a snapshot to the device.

    #14480
    lfo2vco
    lfo2vco
    Participant

    Hi Atom, option 2 is the method I am currently employing, and it works well.

    I am also considering putting the disk data into a memory block, then sending it as a tone edit buffer dump to the synth. I figure I can then request the synth sends the dump back to the panel… that way the methods I have already in place for a patch change will process the dump and set the modulators.

    UPDATE: The above method works and uses less code, so that will do nicely. : )

    • This reply was modified 4 years ago by lfo2vco lfo2vco.
Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

Comments are closed.