Skip to content

Commit

Permalink
feat: added protocol latency in settings. So setting "fadeActive" to …
Browse files Browse the repository at this point in the history
…false waits until last response from protocol.
  • Loading branch information
olzzon committed Aug 20, 2019
1 parent 12f89b0 commit 6d949ed
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 17 deletions.
6 changes: 6 additions & 0 deletions src/components/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,12 @@ class Settings extends React.PureComponent<IAppProps & Store, IState> {
<input name="devicePort" type="text" value={this.state.settings.devicePort} onChange={this.handleChange} />
</label>
<br/>
<label className="settings-input-field">
PROTOCOL LATENCY :
<input name="protocolLatency" type="text" value={this.state.settings.protocolLatency} onChange={this.handleChange} />
</label>
<br/>
<br/>
<label className="settings-input-field">
SHOW PFL CONTROLS:
<input
Expand Down
2 changes: 2 additions & 0 deletions src/reducers/settingsReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface ISettings {
localOscPort: number,
deviceIp: string,
devicePort: number,
protocolLatency: number,
enableRemoteFader: boolean,
mixerMidiInputPort: string,
mixerMidiOutputPort: string,
Expand All @@ -32,6 +33,7 @@ const defaultSettingsReducerState: Array<ISettings> = [
localOscPort: 1234,
deviceIp: "0.0.0.0",
devicePort: 10024,
protocolLatency: 20,
enableRemoteFader: false,
mixerMidiInputPort: "",
mixerMidiOutputPort: "",
Expand Down
29 changes: 14 additions & 15 deletions src/utils/MixerConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@ export class MixerGenericConnection {
}
}

delayedFadeActiveDisable (channelIndex: number) {
let delayedTimer = setTimeout( ()=>{
window.storeRedux.dispatch({
type:'FADE_ACTIVE',
channel: channelIndex,
active: false
})
},
this.store.settings[0].protocolLatency)
}

fadeInOut (channelIndex: number, fadeTime: number){
//Clear Old timer or set Fade to active:
if (this.store.channels[0].channel[channelIndex].fadeActive) {
Expand Down Expand Up @@ -132,11 +143,7 @@ export class MixerGenericConnection {
channel: channelIndex,
level: outputLevel
});
window.storeRedux.dispatch({
type:'FADE_ACTIVE',
channel: channelIndex,
active: false
});
this.delayedFadeActiveDisable(channelIndex);
return true;
}
}, FADE_INOUT_SPEED);
Expand Down Expand Up @@ -165,11 +172,7 @@ export class MixerGenericConnection {
channel: channelIndex,
level: outputLevel
});
window.storeRedux.dispatch({
type:'FADE_ACTIVE',
channel: channelIndex,
active: false
});
this.delayedFadeActiveDisable(channelIndex);
return true;
}

Expand Down Expand Up @@ -207,11 +210,7 @@ export class MixerGenericConnection {
channel: channelIndex,
level: outputLevel
});
window.storeRedux.dispatch({
type:'FADE_ACTIVE',
channel: channelIndex,
active: false
});
this.delayedFadeActiveDisable(channelIndex);
return true;
}

Expand Down
4 changes: 2 additions & 2 deletions src/utils/OscMixerConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ export class OscMixerConnection {
updatePflState(channelIndex: number) {
let channelType = this.store.channels[0].channel[channelIndex].channelType;
let channelTypeIndex = this.store.channels[0].channel[channelIndex].channelTypeIndex;
if (this.store.channels[0].channel[channelIndex].pflOn === true) {
if (this.store.faders[0].fader[channelIndex].pflOn === true) {
this.sendOutMessage(
this.mixerProtocol.channelTypes[channelType].toMixer.PFL_ON[0].mixerMessage,
channelTypeIndex+1,
Expand Down Expand Up @@ -255,7 +255,7 @@ export class OscMixerConnection {
updateChannelName(channelIndex: number) {
let channelType = this.store.channels[0].channel[channelIndex].channelType;
let channelTypeIndex = this.store.channels[0].channel[channelIndex].channelTypeIndex;
let channelName = this.store.channels[0].channel[channelIndex].label;
let channelName = this.store.faders[0].fader[channelIndex].label;
this.sendOutMessage(
this.mixerProtocol.channelTypes[channelType].toMixer.CHANNEL_NAME[0].mixerMessage,
channelTypeIndex+1,
Expand Down

0 comments on commit 6d949ed

Please sign in to comment.