diff --git a/src/utils/OscMixerConnection.ts b/src/utils/OscMixerConnection.ts index 7835b22d..fb39445a 100644 --- a/src/utils/OscMixerConnection.ts +++ b/src/utils/OscMixerConnection.ts @@ -68,43 +68,54 @@ export class OscMixerConnection { } else if ( this.checkOscCommand(message.address, this.mixerProtocol.channelTypes[0].fromMixer .CHANNEL_FADER_LEVEL[0].mixerMessage)){ let ch = message.address.split("/")[this.cmdChannelIndex]; + let assignedFader = 1 + this.store.channels[0].channel[ch - 1].assignedFader + window.storeRedux.dispatch({ type:'SET_FADER_LEVEL', - channel: this.store.channels[0].channel[ch - 1].assignedFader, + channel: assignedFader - 1, level: message.args[0] }); - if (window.huiRemoteConnection) { - window.huiRemoteConnection.updateRemoteFaderState(ch-1, message.args[0]); + if (this.store.faders[0].fader[assignedFader - 1].pgmOn) + { + this.store.channels[0].channel.map((channel: any, index: number) => { + if (channel.assignedFader === assignedFader - 1) + this.updateOutLevel(index); + }) } - if (this.mixerProtocol.mode === 'master') { - if (this.store.faders[0].fader[this.store.channels[0].channel[ch - 1].assignedFader].pgmOn) - { - this.updateOutLevel(ch-1); - } + if (!this.store.faders[0].fader[assignedFader - 1].pgmOn) { + window.storeRedux.dispatch({ + type:'TOGGLE_PGM', + channel: assignedFader - 1 + }); + } + + if (window.huiRemoteConnection) { + window.huiRemoteConnection.updateRemoteFaderState(assignedFader-1, message.args[0]); } } else if ( this.checkOscCommand(message.address, this.mixerProtocol.channelTypes[0].fromMixer .CHANNEL_OUT_GAIN[0].mixerMessage)){ let ch = message.address.split("/")[this.cmdChannelIndex]; + let assignedFader = 1 + this.store.channels[0].channel[ch - 1].assignedFader if (this.mixerProtocol.mode === 'master' && !this.store.channels[0].channel[ch - 1].fadeActive && message.args[0] > this.mixerProtocol.fader.min) { window.storeRedux.dispatch({ type:'SET_FADER_LEVEL', - channel: this.store.channels[0].channel[ch - 1].assignedFader, + channel: assignedFader - 1, level: message.args[0] }); - if (!this.store.faders[0].fader[ch - 1].pgmOn) { + if (!this.store.faders[0].fader[assignedFader - 1].pgmOn) { window.storeRedux.dispatch({ type:'TOGGLE_PGM', - channel: this.store.channels[0].channel[ch - 1].assignedFader + channel: assignedFader }); } if (window.huiRemoteConnection) { - window.huiRemoteConnection.updateRemoteFaderState(ch-1, message.args[0]); + window.huiRemoteConnection.updateRemoteFaderState(assignedFader - 1, message.args[0]); } } @@ -207,20 +218,13 @@ export class OscMixerConnection { updateOutLevel(channelIndex: number) { let channelType = this.store.channels[0].channel[channelIndex].channelType; let channelTypeIndex = this.store.channels[0].channel[channelIndex].channelTypeIndex; + let faderIndex = this.store.channels[0].channel[channelIndex].assignedFader; this.sendOutMessage( this.mixerProtocol.channelTypes[channelType].toMixer.CHANNEL_OUT_GAIN[0].mixerMessage, channelTypeIndex+1, - this.store.channels[0].channel[channelIndex].outputLevel, + this.store.faders[0].fader[faderIndex].faderLevel, "f" ); - /* ToDo: skip client protocol mode, or incorporate separate fader in store.channels[0] - this.sendOutMessage( - this.mixerProtocol.channelTypes[channelType].toMixer.CHANNEL_FADER_LEVEL[0].mixerMessage, - channelTypeIndex+1, - this.store.faders[0].fader[channelIndex].faderLevel, - "f" - ); - */ } updatePflState(channelIndex: number) {