summaryrefslogtreecommitdiff
path: root/pkg/mixer
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2019-02-11 19:20:40 +0100
committerChristian Pointner <equinox@spreadspace.org>2019-02-11 19:20:40 +0100
commit25d8a03cd9c8b9b22a06da555373034a61496cd5 (patch)
tree934138190b5d717d5302087c04b4dded6ba328e5 /pkg/mixer
parentadded function to get state (diff)
controller leds work now
Diffstat (limited to 'pkg/mixer')
-rw-r--r--pkg/mixer/mixer.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/pkg/mixer/mixer.go b/pkg/mixer/mixer.go
index 7b46abc..6e8eb07 100644
--- a/pkg/mixer/mixer.go
+++ b/pkg/mixer/mixer.go
@@ -127,7 +127,7 @@ func openDevice(devices []*midi.Device, prefix string) (d *midi.Device, err erro
}
}
if d == nil {
- return nil, errors.New("could not find device with prefix " + prefix)
+ return nil, errors.New("could not find device with prefix: " + prefix)
}
return d, d.Open()
}
@@ -203,6 +203,7 @@ func (m *Mixer) Init() error {
go func() {
for {
+ // TODO: handle Errors (reopen the device!)
m.handleMidiPacket(<-ch)
}
}()
@@ -216,12 +217,15 @@ func (m *Mixer) Shutdown() error {
if m.DevOut != nil {
m.DevOut.Close()
}
+ // TODO: also close all subscribed channels
+ // terminate go-routine started by Init()
return nil
}
func (m *Mixer) sendMute(channel byte, value byte) error {
n, err := m.DevOut.Write([]byte{CC_MUTE, channel, value})
if err != nil {
+ // reopen device?
return err
}
if n != 3 {
@@ -244,6 +248,7 @@ func (m *Mixer) SetLevel(ch Channel, level FaderLevel) error {
}
n, err := m.DevOut.Write([]byte{CC_FADER, byte(ch), byte(level)})
if err != nil {
+ // reopen device?
return err
}
if n != 3 {