Skip to content

Commit

Permalink
handle other midi message types - and note_off with vel
Browse files Browse the repository at this point in the history
  • Loading branch information
ptone committed Oct 31, 2013
1 parent 861f4a9 commit 53633ab
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion birdfish/input/midi.py
Expand Up @@ -103,6 +103,14 @@ def __init__(self, device, *args, **kwargs):
def dispatch(self, message):
"""take a midi message and dispatch it to object who are interested"""
print message
if message.type == 'pitchwheel':
# pitchwheel(channel=0, value=5224)
# print dir(message)
# print message.__dict__
return
if message.type == 'sysex':
# skip
return
if message.type == 'control_change':
message_key = (message.channel, message.control)
else:
Expand All @@ -111,7 +119,10 @@ def dispatch(self, message):
for destination in self.observers[message_key]:
if destination['type'] == 'trigger':
# trigger type
vel = message.velocity / 127.0
if message.type == "note_off":
vel = 0
else:
vel = message.velocity / 127.0
destination['receiver'].trigger(vel, key=message_key)
elif destination['type'] == 'map':
in_value = message.value
Expand Down

0 comments on commit 53633ab

Please sign in to comment.