I'm implementing a custom looping mechanic where the user can drag start/end loop cursors over a waveform. Changing the engine's loop points with the following code is kind of slow, so calling it every time the user drags one of the cursors causes the cursors to move very slowly:
wait_async(set_loop_par(%NI_USER_ZONE_IDS[0], 0, $LOOP_PAR_START, $left))
wait_async(set_loop_par(%NI_USER_ZONE_IDS[1], 0, $LOOP_PAR_START, $left))
wait_async(set_loop_par(%NI_USER_ZONE_IDS[0], 0, $LOOP_PAR_LENGTH, $right))
wait_async(set_loop_par(%NI_USER_ZONE_IDS[1], 0, $LOOP_PAR_LENGTH, $right))
The other issue is that the $left and $right params need to be sent in samples, not milliseconds, and I don't see any way to get samples without knowing the sample rate. So anyways, I'm trying to do the looping manually from the script. In my listener, I'm doing this:
if (get_event_par($l_id, $EVENT_PAR_PLAY_POS) >= $right_ms)
set_event_par($l_id, $EVENT_PAR_PLAY_POS, $left_ms)
end if
...but I realized you can't use set_event_par() on $EVENT_PAR_PLAY_POS, only get_event_par(). Is there any workaround for this? I don't want to trigger another note. Thanks.