summaryrefslogtreecommitdiff
path: root/cmd/dolmetschctld/statemachine.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/dolmetschctld/statemachine.go')
-rw-r--r--cmd/dolmetschctld/statemachine.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/cmd/dolmetschctld/statemachine.go b/cmd/dolmetschctld/statemachine.go
index 1fe4023..d094875 100644
--- a/cmd/dolmetschctld/statemachine.go
+++ b/cmd/dolmetschctld/statemachine.go
@@ -169,17 +169,20 @@ func calcNextLevel(target, current mixer.FaderLevel) mixer.FaderLevel {
return next
}
-func (sm *StateMachine) reconcile() {
+func (sm *StateMachine) reconcile(ticker bool) {
for lang, mcs := range sm.languages {
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 {
- mcs.main.target.level = 30 // TODO: hardcoded Value!!
+ mcs.main.target.level = mixer.FaderLevel(float32(mixer.FaderLevel0db) * 0.5) // TODO: hardcoded Value!!
mcs.voice.target.level = mixer.FaderLevel0db
}
}
+ if sm.currentState != StateSettled && !ticker {
+ return
+ }
sm.currentState = StateSettled
for _, mcs := range sm.languages {
if mcs.main.target.level != mcs.main.current.level {
@@ -202,14 +205,14 @@ func (sm *StateMachine) run() {
select {
case <-t.C:
if sm.currentState == StateSettling {
- sm.reconcile()
+ sm.reconcile(true)
}
case req := <-sm.selectLangCh:
req.resultCh <- sm.selectLang(req.l)
- sm.reconcile()
+ sm.reconcile(false)
case ev := <-sm.mixerEventCh:
sm.handleMixerEvent(ev)
- sm.reconcile()
+ sm.reconcile(false)
case <-sm.quitCh:
return
}