mirror of
https://github.com/vsariola/sointu.git
synced 2026-02-12 19:23:12 -05:00
feat(tracker): ability to bind MIDI controllers to parameters
Closes #152
This commit is contained in:
parent
6e8acc8f9b
commit
f2ef57a845
@ -79,12 +79,15 @@ func (m RTMIDIInputDevice) Open() error {
|
||||
}
|
||||
|
||||
func (m *RTMIDIInputDevice) handleMessage(msg midi.Message, timestampms int32) {
|
||||
var channel, key, velocity uint8
|
||||
var channel, key, velocity, controller, value uint8
|
||||
if msg.GetNoteOn(&channel, &key, &velocity) {
|
||||
ev := tracker.NoteEvent{Timestamp: int64(timestampms) * 441 / 10, On: true, Channel: int(channel), Note: key, Source: m}
|
||||
tracker.TrySend(m.broker.MIDIChannel(), any(ev))
|
||||
tracker.TrySend(m.broker.ToMIDIRouter, any(&ev))
|
||||
} else if msg.GetNoteOff(&channel, &key, &velocity) {
|
||||
ev := tracker.NoteEvent{Timestamp: int64(timestampms) * 441 / 10, On: false, Channel: int(channel), Note: key, Source: m}
|
||||
tracker.TrySend(m.broker.MIDIChannel(), any(ev))
|
||||
tracker.TrySend(m.broker.ToMIDIRouter, any(&ev))
|
||||
} else if msg.GetControlChange(&channel, &controller, &value) {
|
||||
ev := tracker.ControlChange{Channel: int(channel), Control: int(controller), Value: int(value)}
|
||||
tracker.TrySend(m.broker.ToMIDIRouter, any(&ev))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user