summaryrefslogtreecommitdiff
path: root/pkg/mixer
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2019-02-09 22:43:35 +0100
committerChristian Pointner <equinox@spreadspace.org>2019-02-09 22:43:35 +0100
commitb6e1bbb34feb34c8fd6bcf7437e2be8d466f8d0c (patch)
tree919eea0e4d14e85c373fdf2b9ca8f210cc4c864b /pkg/mixer
parentlanguages now have a state (diff)
mixer: add packet receiver
Diffstat (limited to 'pkg/mixer')
-rw-r--r--pkg/mixer/mixer.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/pkg/mixer/mixer.go b/pkg/mixer/mixer.go
index 8dfda64..fb575d6 100644
--- a/pkg/mixer/mixer.go
+++ b/pkg/mixer/mixer.go
@@ -24,6 +24,7 @@ package mixer
import (
"errors"
+ "log"
"strings"
"github.com/scgolang/midi"
@@ -73,11 +74,24 @@ func NewMixer(c Config) (*Mixer, error) {
return nil, err
}
+ m.DevIn.QueueSize = 100
+ m.DevOut.QueueSize = 100
return m, nil
}
func (m *Mixer) Init() error {
- // TODO: sync state
+ ch, err := m.DevIn.Packets()
+ if err != nil {
+ return err
+ }
+
+ go func() {
+ for {
+ p := <-ch
+ log.Printf("mixer: got packet: '%v'", p)
+ // TODO: send to subscribers
+ }
+ }()
return nil
}