diff options
author | Christian Pointner <equinox@spreadspace.org> | 2019-02-10 20:04:09 +0100 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2019-02-10 20:04:09 +0100 |
commit | 945352a3700ed2736c27a88cdd1f39e97ecb1ae1 (patch) | |
tree | b23721f58ea0d108d6ef50e9e837f522ba09736f /cmd | |
parent | basic functionality works now (diff) |
use mute state of voice channel to disable automatic switching for this language
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/dolmetschctld/statemachine.go | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/cmd/dolmetschctld/statemachine.go b/cmd/dolmetschctld/statemachine.go index afe2ac0..7e37af1 100644 --- a/cmd/dolmetschctld/statemachine.go +++ b/cmd/dolmetschctld/statemachine.go @@ -152,8 +152,13 @@ func (sm *StateMachine) selectLang(l Language) error { } } sm.targetLang = l + log.Printf("new target language: '%s'", sm.targetLang) + return nil +} + +func (sm *StateMachine) reconcile() { for lang, mcs := range sm.languages { - if sm.targetLang == "" || lang == sm.targetLang { + if sm.targetLang == "" || lang == sm.targetLang || mcs.voice.current.mute == mixer.MuteMuted { mcs.main.target.level = mixer.FaderLevel0db mcs.voice.target.level = mixer.FaderLevelOff } else { @@ -161,17 +166,16 @@ func (sm *StateMachine) selectLang(l Language) error { mcs.voice.target.level = mixer.FaderLevel0db } } - log.Printf("new target language: '%s'", sm.targetLang) - return nil -} -func (sm *StateMachine) reconcile() { + sm.currentState = StateSettled for _, mcs := range sm.languages { if mcs.main.target.level != mcs.main.current.level { sm.mixer.SetLevel(mcs.main.num, mcs.main.target.level) // TODO: implement smooth fading!! + sm.currentState = StateSettling } if mcs.voice.target.level != mcs.voice.current.level { sm.mixer.SetLevel(mcs.voice.num, mcs.voice.target.level) // TODO: implement smooth fading!! + sm.currentState = StateSettling } } } |