diff options
-rw-r--r-- | go.mod | 10 | ||||
-rw-r--r-- | go.sum | 8 | ||||
-rw-r--r-- | pkg/controller/controller.go | 10 | ||||
-rw-r--r-- | pkg/mixer/mixer.go | 18 |
4 files changed, 34 insertions, 12 deletions
@@ -0,0 +1,10 @@ +module spreadspace.org/dolmetschctl + +go 1.13 + +require ( + github.com/gorilla/websocket v1.4.1 + github.com/pkg/errors v0.9.1 // indirect + github.com/scgolang/midi v0.5.0 + github.com/spreadspace/telgo v0.0.0-20170609015223-7277b0d8090e +) @@ -0,0 +1,8 @@ +github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM= +github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/scgolang/midi v0.5.0 h1:HsSMHIbgCAZlmjloOgRZeLQgBXi8eWXw3FZJzm3eEkE= +github.com/scgolang/midi v0.5.0/go.mod h1:ur2Ay6ad9oWPNFuGq4oQ6u75uZIjZfDdhozbGHnTcfQ= +github.com/spreadspace/telgo v0.0.0-20170609015223-7277b0d8090e h1:lhFaE8l5AfSEzH4OW+9BUAo+BuYLe21zuHwWX1YEZHw= +github.com/spreadspace/telgo v0.0.0-20170609015223-7277b0d8090e/go.mod h1:kvvhiAI5nvwI4SZrVH9vRa3MTjkcYm3tElmmh+bYuEI= 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 |