mirror of
https://github.com/vsariola/sointu.git
synced 2025-05-28 03:10:24 -04:00
fix(tracker/gomidi): consume all available midi.Messages
This commit is contained in:
parent
97e59c5650
commit
3986bbede7
@ -87,6 +87,7 @@ func (m *RTMIDIContext) HandleMessage(msg midi.Message, timestampms int32) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *RTMIDIContext) NextEvent() (event tracker.MIDINoteEvent, ok bool) {
|
func (c *RTMIDIContext) NextEvent() (event tracker.MIDINoteEvent, ok bool) {
|
||||||
|
for {
|
||||||
select {
|
select {
|
||||||
case msg := <-c.events:
|
case msg := <-c.events:
|
||||||
var channel uint8
|
var channel uint8
|
||||||
@ -100,10 +101,12 @@ func (c *RTMIDIContext) NextEvent() (event tracker.MIDINoteEvent, ok bool) {
|
|||||||
// TODO: handle control messages with something like:
|
// TODO: handle control messages with something like:
|
||||||
// if msg.GetControlChange(&channel, &controller, &value) {
|
// if msg.GetControlChange(&channel, &controller, &value) {
|
||||||
// ....
|
// ....
|
||||||
|
// if the message is not any recognized type, ignore it and continue looping
|
||||||
default:
|
default:
|
||||||
// Note (@LeStahL): This empty select case is needed to make the implementation non-blocking.
|
// Note (@LeStahL): This empty select case is needed to make the implementation non-blocking.
|
||||||
}
|
|
||||||
return tracker.MIDINoteEvent{}, false
|
return tracker.MIDINoteEvent{}, false
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *RTMIDIContext) BPM() (bpm float64, ok bool) {
|
func (c *RTMIDIContext) BPM() (bpm float64, ok bool) {
|
||||||
|
Loading…
Reference in New Issue
Block a user