diff options
author | Christian Pointner <equinox@spreadspace.org> | 2019-02-11 00:36:33 +0100 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2019-02-11 00:36:33 +0100 |
commit | d95a1a460e8f1fce790100c5f0619ebf78704294 (patch) | |
tree | 9788ef6d64ea367359cb1775c222f1fd2236043a | |
parent | better nameing than main and voice (diff) |
some more name refactoring
-rw-r--r-- | cmd/dolmetschctld/statemachine.go | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/cmd/dolmetschctld/statemachine.go b/cmd/dolmetschctld/statemachine.go index 3bf31a5..b8946d6 100644 --- a/cmd/dolmetschctld/statemachine.go +++ b/cmd/dolmetschctld/statemachine.go @@ -76,36 +76,36 @@ type MixerChannels struct { interpreter MixerChannel } -type setLanguageRequest struct { - lang Language - resultCh chan error +type setLanguageReq struct { + lang Language + resCh chan error } -type getLanguageRequest struct { - resultCh chan Language +type getLanguageReq struct { + resCh chan Language } -type setOriginal2InterpreterRatioRequest struct { - ratio float32 - resultCh chan error +type setOriginal2InterpreterRatioReq struct { + ratio float32 + resCh chan error } -type getOriginal2InterpreterRatioRequest struct { - resultCh chan float32 +type getOriginal2InterpreterRatioReq struct { + resCh chan float32 } -type getStateRequest struct { - resultCh chan State +type getStateReq struct { + resCh chan State } type StateMachine struct { mixer *mixer.Mixer - setLanguageCh chan setLanguageRequest - getLanguageCh chan getLanguageRequest - setOriginal2InterpreterRatioCh chan setOriginal2InterpreterRatioRequest - getOriginal2InterpreterRatioCh chan getOriginal2InterpreterRatioRequest - getStateCh chan getStateRequest + setLanguageCh chan setLanguageReq + getLanguageCh chan getLanguageReq + setOriginal2InterpreterRatioCh chan setOriginal2InterpreterRatioReq + getOriginal2InterpreterRatioCh chan getOriginal2InterpreterRatioReq + getStateCh chan getStateReq quitCh chan bool exitedCh chan struct{} mixerEventCh chan mixer.Event @@ -240,17 +240,17 @@ func (sm *StateMachine) run() { sm.reconcile(true) } case req := <-sm.setLanguageCh: - req.resultCh <- sm.setLanguage(req.lang) + req.resCh <- sm.setLanguage(req.lang) sm.reconcile(false) case req := <-sm.getLanguageCh: - req.resultCh <- sm.language + req.resCh <- sm.language case req := <-sm.setOriginal2InterpreterRatioCh: - req.resultCh <- sm.setOriginal2InterpreterRatio(req.ratio) + req.resCh <- sm.setOriginal2InterpreterRatio(req.ratio) sm.reconcile(false) case req := <-sm.getOriginal2InterpreterRatioCh: - req.resultCh <- sm.original2InterpreterRatio + req.resCh <- sm.original2InterpreterRatio case req := <-sm.getStateCh: - req.resultCh <- sm.state + req.resCh <- sm.state case ev := <-sm.mixerEventCh: sm.handleMixerEvent(ev) sm.reconcile(false) @@ -262,11 +262,11 @@ func (sm *StateMachine) run() { func NewStateMachine(m *mixer.Mixer) (*StateMachine, error) { sm := &StateMachine{mixer: m} - sm.setLanguageCh = make(chan setLanguageRequest, 10) - sm.getLanguageCh = make(chan getLanguageRequest, 10) - sm.setOriginal2InterpreterRatioCh = make(chan setOriginal2InterpreterRatioRequest, 10) - sm.getOriginal2InterpreterRatioCh = make(chan getOriginal2InterpreterRatioRequest, 10) - sm.getStateCh = make(chan getStateRequest, 10) + sm.setLanguageCh = make(chan setLanguageReq, 10) + sm.getLanguageCh = make(chan getLanguageReq, 10) + sm.setOriginal2InterpreterRatioCh = make(chan setOriginal2InterpreterRatioReq, 10) + sm.getOriginal2InterpreterRatioCh = make(chan getOriginal2InterpreterRatioReq, 10) + sm.getStateCh = make(chan getStateReq, 10) sm.quitCh = make(chan bool, 1) sm.exitedCh = make(chan struct{}) sm.mixerEventCh = make(chan mixer.Event, 1000) @@ -316,33 +316,33 @@ func (sm *StateMachine) Start() { } func (sm *StateMachine) SetLanguage(l Language) error { - resultCh := make(chan error) - sm.setLanguageCh <- setLanguageRequest{l, resultCh} - return <-resultCh + resCh := make(chan error) + sm.setLanguageCh <- setLanguageReq{l, resCh} + return <-resCh } func (sm *StateMachine) GetLanguage() Language { - resultCh := make(chan Language) - sm.getLanguageCh <- getLanguageRequest{resultCh} - return <-resultCh + resCh := make(chan Language) + sm.getLanguageCh <- getLanguageReq{resCh} + return <-resCh } func (sm *StateMachine) SetOriginal2InterpreterRatio(r float32) error { - resultCh := make(chan error) - sm.setOriginal2InterpreterRatioCh <- setOriginal2InterpreterRatioRequest{r, resultCh} - return <-resultCh + resCh := make(chan error) + sm.setOriginal2InterpreterRatioCh <- setOriginal2InterpreterRatioReq{r, resCh} + return <-resCh } func (sm *StateMachine) GetOriginal2InterpreterRatio() float32 { - resultCh := make(chan float32) - sm.getOriginal2InterpreterRatioCh <- getOriginal2InterpreterRatioRequest{resultCh} - return <-resultCh + resCh := make(chan float32) + sm.getOriginal2InterpreterRatioCh <- getOriginal2InterpreterRatioReq{resCh} + return <-resCh } func (sm *StateMachine) GetState() State { - resultCh := make(chan State) - sm.getStateCh <- getStateRequest{resultCh} - return <-resultCh + resCh := make(chan State) + sm.getStateCh <- getStateReq{resCh} + return <-resCh } func (sm *StateMachine) Shutdown() { |