I have a minimal script here. the idea is that when slider1 is set to 1 while there is audio input in either channel, regardless of either playing or stopped, i will continue to add up; and when the play_state changes, the counting will stop and reset.
However, currently when I stop the script, the counting does not stop. I suspect that when stopping the script, it takes some time for spl to fade to 0.
Thus, is there a good way to achieve this? Stopping and reset everything when play_state changes?
Code:
desc: Test
slider1: 0<0,1,1>Test
in_pin: Input L
in_pin: Input R
out_pin: Output L
out_pin: Output R
@sample
!b_active && slider1 && (spl0 || spl1) ? b_active = 1;
f_playstate != play_state ? (
i = b_active = 0;
f_playstate = play_state;
);
b_active ? i += 1;