Skip to content

Commit

Permalink
Handle Panic Key
Browse files Browse the repository at this point in the history
Receive Panic Key (messagetype=11, note=123) and disable all
playingnotes
  • Loading branch information
hairpeace0 committed Mar 28, 2016
1 parent 7ec3254 commit 5a6d187
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions samplerbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,14 @@ def MidiCallback(message, time_stamp):
elif (messagetype == 11) and (note == 64) and (velocity >= 64): # sustain pedal on
sustain = True

elif (messagetype == 11) and (note == 123): # all notes off
for i in playingnotes:
for n in playingnotes[i]:
if sustain:
sustainplayingnotes.append(n)
else:
n.fadeout(50)
playingnotes[i] = []

#########################################
# LOAD SAMPLES
Expand Down

0 comments on commit 5a6d187

Please sign in to comment.