We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2f5d7f6 commit 34b583cCopy full SHA for 34b583c
isobar/io/dummy/input.py
@@ -0,0 +1,20 @@
1
+from ..midinote import MidiNote
2
+
3
+class DummyInputDevice:
4
+ def __init__(self):
5
+ self.on_note_on = None
6
+ self.on_note_off = None
7
8
+ def add_note_on_handler(self, callback):
9
+ self.on_note_on = callback
10
11
+ def add_note_off_handler(self, callback):
12
+ self.on_note_off = callback
13
14
+ def note_on(self, pitch, velocity, channel=0):
15
+ if self.on_note_on:
16
+ self.on_note_on(MidiNote(pitch=pitch, velocity=velocity, channel=channel))
17
18
+ def note_off(self, pitch, channel=0):
19
+ if self.on_note_off:
20
+ self.on_note_off(MidiNote(pitch=pitch, velocity=0, channel=channel))
0 commit comments