summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2020-03-03 18:19:01 (GMT)
committerChristian Pointner <equinox@spreadspace.org>2020-03-03 18:19:01 (GMT)
commit61f587cfc6f151570df169ae38158b6293aaddb8 (patch)
tree790dfd7292452564f52aad4f23ff0be6a31e46ee
parent5c90c3f36116c3a8616f9dd9102daf2d04ddff15 (diff)
add go-modules support and fix midi library API changetopic/x32-midi
-rw-r--r--go.mod10
-rw-r--r--go.sum8
-rw-r--r--pkg/controller/controller.go10
-rw-r--r--pkg/mixer/mixer.go18
4 files changed, 34 insertions, 12 deletions
diff --git a/go.mod b/go.mod
new file mode 100644
index 0000000..720eaa8
--- /dev/null
+++ b/go.mod
@@ -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
+)
diff --git a/go.sum b/go.sum
new file mode 100644
index 0000000..27353e8
--- /dev/null
+++ b/go.sum
@@ -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