summaryrefslogtreecommitdiff
path: root/cmd/dolmetschctld
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/dolmetschctld')
-rw-r--r--cmd/dolmetschctld/statemachine.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/cmd/dolmetschctld/statemachine.go b/cmd/dolmetschctld/statemachine.go
index 97f29c0..c5e5707 100644
--- a/cmd/dolmetschctld/statemachine.go
+++ b/cmd/dolmetschctld/statemachine.go
@@ -80,6 +80,7 @@ type StateMachine struct {
selectLangCh chan selectLangRequest
quitCh chan bool
exitedCh chan struct{}
+ mixerEventCh chan mixer.Event
languages map[Language]LanguageChannels
channel2lang map[mixer.Channel]Language
@@ -115,6 +116,9 @@ func (sm *StateMachine) run() {
select {
case req := <-sm.selectLangCh:
req.resultCh <- sm.selectLang(req.l)
+ case ev := <-sm.mixerEventCh:
+ log.Printf("got event from mixer: %v", ev)
+ // TODO: update mixer channel states...
case <-sm.quitCh:
return
}
@@ -132,6 +136,7 @@ func NewStateMachine(m *mixer.Mixer) (*StateMachine, error) {
sm.selectLangCh = make(chan selectLangRequest, 10)
sm.quitCh = make(chan bool, 1)
sm.exitedCh = make(chan struct{})
+ sm.mixerEventCh = make(chan mixer.Event, 3)
sm.languages = make(map[Language]LanguageChannels)
sm.channel2lang = make(map[mixer.Channel]Language)
@@ -161,6 +166,9 @@ func (sm *StateMachine) AddLanguage(name Language, main, voice mixer.Channel) er
sm.languages[name] = LanguageChannels{chMain, chVoice}
sm.channel2lang[main] = name
sm.channel2lang[voice] = name
+
+ sm.mixer.Subscribe(main, sm.mixerEventCh)
+ sm.mixer.Subscribe(voice, sm.mixerEventCh)
return nil
}