Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added controller events as possible return from event_read() #80

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/sequencer_alsa/sequencer.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def event_write(self, event, direct=False, relative=False, tick=False):
def event_read(self):
ev = S.event_input(self.client)
if ev and (ev < 0): self._error(ev)
if ev and ev.type in (S.SND_SEQ_EVENT_NOTEON, S.SND_SEQ_EVENT_NOTEOFF):
if ev and ev.type in (S.SND_SEQ_EVENT_NOTEON, S.SND_SEQ_EVENT_NOTEOFF, S.SND_SEQ_EVENT_CONTROLLER):
if ev.type == S.SND_SEQ_EVENT_NOTEON:
mev = midi.NoteOnEvent()
mev.channel = ev.data.note.channel
Expand All @@ -291,6 +291,11 @@ def event_read(self):
mev.channel = ev.data.note.channel
mev.pitch = ev.data.note.note
mev.velocity = ev.data.note.velocity
elif ev.type == S.SND_SEQ_EVENT_CONTROLLER:
mev = midi.ControlChangeEvent()
mev.channel = ev.data.control.channel
mev.control = ev.data.control.param
mev.value = ev.data.control.value
if ev.time.time.tv_nsec:
# convert to ms
mev.msdeay = \
Expand Down