Skip to content

Commit 34b583c

Browse files
committed
Initial implementation of monitor/record MIDI
1 parent 2f5d7f6 commit 34b583c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

isobar/io/dummy/input.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)