summaryrefslogtreecommitdiff
path: root/cmd/dolmetschctld/statemachine.go
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2019-02-10 20:04:09 +0100
committerChristian Pointner <equinox@spreadspace.org>2019-02-10 20:04:09 +0100
commit945352a3700ed2736c27a88cdd1f39e97ecb1ae1 (patch)
treeb23721f58ea0d108d6ef50e9e837f522ba09736f /cmd/dolmetschctld/statemachine.go
parentbasic functionality works now (diff)
use mute state of voice channel to disable automatic switching for this language
Diffstat (limited to 'cmd/dolmetschctld/statemachine.go')
-rw-r--r--cmd/dolmetschctld/statemachine.go14
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
}
}
}