diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/controller/controller.go | 10 | ||||
-rw-r--r-- | pkg/mixer/mixer.go | 18 |
2 files changed, 16 insertions, 12 deletions
diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go index 2aa8023..dfb6d7d 100644 --- a/pkg/controller/controller.go +++ b/pkg/controller/controller.go @@ -162,11 +162,13 @@ func (c *Controller) Init() error { go func() { for { - p := <-ch - if p.Err != nil { - c.Shutdown() + ps := <-ch + for _, p := range ps { + if p.Err != nil { + c.Shutdown() + } + c.handleMidiPacket(p) } - c.handleMidiPacket(p) } }() return nil diff --git a/pkg/mixer/mixer.go b/pkg/mixer/mixer.go index 0eb5746..afa1534 100644 --- a/pkg/mixer/mixer.go +++ b/pkg/mixer/mixer.go @@ -273,15 +273,17 @@ func (m *Mixer) Init() error { go func() { for { - p := <-ch - if p.Err != nil { - log.Printf("mixer: got fatal error from midi input device: %v, trying to reopen it...", p.Err) - m.devIn.Close() - m.devIn = nil - go m.reopenInput() - return + ps := <-ch + for _, p := range ps { + if p.Err != nil { + log.Printf("mixer: got fatal error from midi input device: %v, trying to reopen it...", p.Err) + m.devIn.Close() + m.devIn = nil + go m.reopenInput() + return + } + m.handleMidiPacket(p) } - m.handleMidiPacket(p) } }() return nil |