diff options
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 } } } |