Synchronizing Loop Lengths Between Two Loopers
-
Hi there, I am working on plugin that includes two loopers. Each looper is activated by a button, and the recording starts when the button is pressed and stops when it is released.
I would like to know if it's possible to save the duration for which the first looper is activated so that the second looper can also record for the same duration. For example, if I record the first looper for 6 seconds, I want the second looper to record for exactly 6 seconds as well, regardless of how long I play it back.
Has anyone implemented something similar, or can you suggest how I might achieve this in my code?
Thank you in advance for your help! -
@treynterrio I've something that tells me how long the button was pressed but I don't know what's next
-
@treynterrio said in Synchronizing Loop Lengths Between Two Loopers:
I've something that tells me how long the button was pressed
You could store the time when the button was pressed, and when it's pressed again subtract the stored time from the current time and that will tell you how long between presses.
-
@d-healey do you've an example?
-
@treynterrio said in Synchronizing Loop Lengths Between Two Loopers:
do you've an example?
Nope, but I think it would be better for you to try it first before I write it out for you.
Start by storing the current engine uptime in a variable when the button is clicked.
Then when the button is clicked a second time, subtract that stored value from the current engine uptime.
To tell if this is the first button click or the second you can check if the variable you're storing the time in has a positive value, if it does that means it's the second click. And after the second click you can reset the variable to a negative value like -1.
-
@d-healey Got it working!