Delay other events than Message
-
I have this project where I use
local delay = Engine.getSamplesForQuarterBeats(value.rotation * (1/360) * 4);
to delay note ons like this:
local id = Synth.addNoteOn(1, key, value.velocity, delay); Synth.noteOffDelayedByEventId(id, delay + Engine.getSamplesForQuarterBeats(value.bars/value.sides*4) * value.length);
I set the delay by rotating the ellipse, and it works great for note creation, but I also want to get the visual ball to show the delay so....
Is it possible to also delay a component.repaint() or .changed() action?
I have tried with timers and it works but it's not so smooth, in this arp I'm delaying up to 32 note ons and this means that if I want to delay a repaint action on all of those note ons, and the delay is long, I have to set up several timers to make it work.
If first note on starts the first timer, it might not has been executed before next note on is executed, so I have to use another timer for the next, and next, etc....So is there a simpler way to do this?
Any help is appreciated. -
@ulrik You could do it like a video game. You have one timer running as your game loop. For each cycle of the loop you perform the actions needed and at the end of the loop you update the UI. The timer interval needs to be short enough for your fastest refresh time.
-
@ulrik Content.callWithDelay?
-
@aaronventure Thanks but it seems it will react just the same as a timer if the delay is longer than the time to next note on.
At least that is how I understand the "Description", or maybe I'm wrong -
-
@ulrik said in Delay other events than Message:
Thanks but it seems it will react just the same as a timer if the delay is longer than the time to next note on.
At least that is how I understand the "Description", or maybe I'm wrongWrong function
-
@ulrik said in Delay other events than Message:
You can hear and see it in this video:
The GUI shouldn't affect the audio thread. Are you triggering notes in your UI script?
-
@d-healey said in Delay other events than Message:
@ulrik said in Delay other events than Message:
Thanks but it seems it will react just the same as a timer if the delay is longer than the time to next note on.
At least that is how I understand the "Description", or maybe I'm wrongWrong function
Oh, well I read what @aaronventure wrote :)
Well this seems to be a better one, thanks! -
@d-healey said in Delay other events than Message:
@ulrik said in Delay other events than Message:
You can hear and see it in this video:
The GUI shouldn't affect the audio thread.
It doesn't, it's only the visual that is unsynced
Are you triggering notes in your UI script?
I'm triggering notes inside the TransportHandler grid function -
@ulrik @aaronventure @d-healey
After trimming with timers in different setups I found that "CallAfterDelay()" was the best solution!
Thanks to you all!