summaryrefslogtreecommitdiff
path: root/pkg/mixer/mixer.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/mixer/mixer.go')
-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 {