October 23, 2013 at 1:00 am #14436
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.October 23, 2013 at 11:43 pm #14465
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.October 24, 2013 at 12:03 pm #14476
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…October 24, 2013 at 2:28 pm #14478
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.October 24, 2013 at 3:37 pm #14480
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 3 years, 5 months ago by lfo2vco.
You must be logged in to reply to this topic.