Code: Select all
on init
declare status :=1
declare index
declare note_numbers := 9
declare note_delay
declare note_cc
declare note_vel
declare note_offset
declare note_rel
set_listener (NI_SIGNAL_TRANSP_START, 1)
set_listener (NI_SIGNAL_TRANSP_STOP, 1)
message("")
make_perfview
end on
on listener
select (NI_SIGNAL_TYPE)
case NI_SIGNAL_TRANSP_START
message ("Playback was started.")
status := 1
case NI_SIGNAL_TRANSP_STOP
message ("Playback was stopped.")
status := 0
end select
end on
function createNote()
note_delay := random(0, 100000)
wait(note_delay)
if (status = 1)
note_cc := random(20, 70)
note_vel := random(60, 127)
note_offset := random(0, 1000000)
note_rel := random(0, 5000000)
play_note(note_cc, note_vel, 0, note_rel)
message("note_cc: "& note_cc)
end if
end function
on note
index := 0
while(index < note_numbers)
createNote()
inc(index)
end while
end on
What I'd like is that when I stop the DAW, it releases the current generated notes. I'm able to stop the "following ones" (with the "status" flag), but what about the ones that are ringing on? Is there a way to totally/brutally break also those notes?
Thanks!