More robust automatic note-off abilities.
commit383ca5d3085dca1448ed8a22df7c1127267ead48
authorEvanR <evanrinehart@gmail.com>
Mon, 25 May 2009 23:43:03 +0000 (25 18:43 -0500)
committerEvanR <evanrinehart@gmail.com>
Mon, 25 May 2009 23:43:03 +0000 (25 18:43 -0500)
tree594eb69393922cd4a42a0ff0bf33400fc849c8d7
parent30673a375d7fbf1c7558e903b6d0df87bae30c81
More robust automatic note-off abilities.

Pressing pause, stop, and editing patterns while transport is running
causes playing notes to stop.  Instead of using 'all notes off' controller
change messages, the sequencer keeps track of playing notes and does
a fast search to see which ones to cancel. This reduces midi bus traffic
considerably.

There is a potential race condition because both the audio thread (while
sequencer is playing) and the GUI (when changes are made) manipulate the
bit field used to track notes that are on. A possible error is when the
user presses a control or edits a pattern just as a note should be ending.
By the powers of multithreading, two note offs may be generated when there
should only be one. I am considering this rare and harmless enough at this
time to ignore it. Doing it correctly would require a better serialized,
lock-free command queue, and would solve a few other race conditions. Maybe
some other time.
src/jack.cpp
src/main.cpp
src/pianoroll.cpp
src/seq.cpp
src/seq.h
src/trackmodule.cpp
src/uihelper.cpp
src/util.cpp
src/util.h