diff options
author | Christian Pointner <equinox@spreadspace.org> | 2019-02-10 20:41:18 +0100 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2019-02-10 20:41:18 +0100 |
commit | da3de68fb8028785bfb69c357b8a573bb69828b8 (patch) | |
tree | f5e3ac46041f78242fc7a2442770e6ffb80adc24 /cmd | |
parent | implement fading (needs improvinggit diff) (diff) |
improved fader movement
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/dolmetschctld/statemachine.go | 13 |
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 } |