diff --git a/client/components/ChanStrip.tsx b/client/components/ChanStrip.tsx index fbd3abe5..ac3226eb 100644 --- a/client/components/ChanStrip.tsx +++ b/client/components/ChanStrip.tsx @@ -520,7 +520,7 @@ const mapStateToProps = (state: any, props: any): IChanStripInjectProps => { selectedProtocol: state.settings[0].mixers[0].mixerProtocol, numberOfChannelsInType: state.settings[0].mixers[0].numberOfChannelsInType, - channel: state.channels[0].chConnection[0].channel, + channel: state.channels[0].chMixerConnection[0].channel, fader: state.faders[0].fader, auxSendIndex: -1, offtubeMode: state.settings[0].offtubeMode, @@ -531,7 +531,7 @@ const mapStateToProps = (state: any, props: any): IChanStripInjectProps => { selectedProtocol: state.settings[0].mixers[0].mixerProtocol, numberOfChannelsInType: state.settings[0].mixers[0].numberOfChannelsInType, - channel: state.channels[0].chConnection[0].channel, + channel: state.channels[0].chMixerConnection[0].channel, fader: state.faders[0].fader, auxSendIndex: state.faders[0].fader[props.faderIndex].monitor - 1, offtubeMode: state.settings[0].offtubeMode, diff --git a/client/components/ChanStripFull.tsx b/client/components/ChanStripFull.tsx index 75fb3d2e..fb813027 100644 --- a/client/components/ChanStripFull.tsx +++ b/client/components/ChanStripFull.tsx @@ -837,7 +837,7 @@ const mapStateToProps = (state: any, props: any): IChanStripFullInjectProps => { selectedProtocol: state.settings[0].mixers[0].mixerProtocol, numberOfChannelsInType: state.settings[0].mixers[0].numberOfChannelsInType, - channel: state.channels[0].chConnection[0].channel, + channel: state.channels[0].chMixerConnection[0].channel, fader: state.faders[0].fader, auxSendIndex: -1, offtubeMode: state.settings[0].offtubeMode, @@ -848,7 +848,7 @@ const mapStateToProps = (state: any, props: any): IChanStripFullInjectProps => { selectedProtocol: state.settings[0].mixers[0].mixerProtocol, numberOfChannelsInType: state.settings[0].mixers[0].numberOfChannelsInType, - channel: state.channels[0].chConnection[0].channel, + channel: state.channels[0].chMixerConnection[0].channel, fader: state.faders[0].fader, auxSendIndex: state.faders[0].fader[props.faderIndex].monitor - 1, offtubeMode: state.settings[0].offtubeMode, diff --git a/client/components/ChannelMonitorOptions.tsx b/client/components/ChannelMonitorOptions.tsx index df3f5d7c..173cb471 100644 --- a/client/components/ChannelMonitorOptions.tsx +++ b/client/components/ChannelMonitorOptions.tsx @@ -199,7 +199,7 @@ const mapStateToProps = ( label: state.faders[0].fader[props.faderIndex].label, selectedProtocol: state.settings[0].mixers[0].mixerProtocol, numberOfChannelsInType: state.settings[0].mixers[0].numberOfChannelsInType, - channel: state.channels[0].chConnection[0].channel, + channel: state.channels[0].chMixerConnection[0].channel, fader: state.faders[0].fader, settings: state.settings[0], } diff --git a/client/components/ChannelRouteSettings.tsx b/client/components/ChannelRouteSettings.tsx index 97acfa36..655a4136 100644 --- a/client/components/ChannelRouteSettings.tsx +++ b/client/components/ChannelRouteSettings.tsx @@ -7,12 +7,12 @@ import { Store } from 'redux' import { connect } from 'react-redux' import { storeShowOptions } from '../../server/reducers/settingsActions' import { SOCKET_SET_ASSIGNED_FADER } from '../../server/constants/SOCKET_IO_DISPATCHERS' -import { IChannel, IchConnection } from '../../server/reducers/channelsReducer' +import { IChannel, IchMixerConnection } from '../../server/reducers/channelsReducer' import { IFader } from '../../server/reducers/fadersReducer' interface IChannelSettingsInjectProps { label: string - chConnections: IchConnection[] + chMixerConnections: IchMixerConnection[] fader: IFader[] } @@ -73,9 +73,9 @@ class ChannelRouteSettings extends React.PureComponent< handleClearRouting() { if (window.confirm('REMOVE ALL FADER ASSIGNMENTS????')) { - this.props.chConnections.forEach( - (chConnection: IchConnection, mixerIndex: number) => { - chConnection.channel.forEach( + this.props.chMixerConnections.forEach( + (chMixerConnection: IchMixerConnection, mixerIndex: number) => { + chMixerConnection.channel.forEach( (channel: any, index: number) => { window.socketIoClient.emit( SOCKET_SET_ASSIGNED_FADER, @@ -95,7 +95,7 @@ class ChannelRouteSettings extends React.PureComponent< handle11Routing() { if (window.confirm('Reassign all Faders 1:1 to Channels????')) { this.props.fader.forEach((fader: any, index: number) => { - if (this.props.chConnections[0].channel.length > index) { + if (this.props.chMixerConnections[0].channel.length > index) { window.socketIoClient.emit(SOCKET_SET_ASSIGNED_FADER, { mixerIndex: 0, channel: index, @@ -110,14 +110,14 @@ class ChannelRouteSettings extends React.PureComponent< this.props.dispatch(storeShowOptions(this.faderIndex)) } - renderMixer(chConnection: IchConnection, mixerIndex: number) { + renderMixer(chMixerConnection: IchMixerConnection, mixerIndex: number) { return (

{' '} {'MIXER ' + (mixerIndex + 1)}

- {chConnection.channel.map((channel: any, index: number) => { + {chMixerConnection.channel.map((channel: any, index: number) => { return (

- {this.props.chConnections.map( - (chConnection: IchConnection, mixerIndex: number) => - this.renderMixer(chConnection, mixerIndex) + {this.props.chMixerConnections.map( + (chMixerConnection: IchMixerConnection, mixerIndex: number) => + this.renderMixer(chMixerConnection, mixerIndex) )}
) @@ -187,7 +187,7 @@ const mapStateToProps = ( ): IChannelSettingsInjectProps => { return { label: state.faders[0].fader[props.faderIndex].label, - chConnections: state.channels[0].chConnection, + chMixerConnections: state.channels[0].chMixerConnection, fader: state.faders[0].fader, } } diff --git a/client/components/Channels.tsx b/client/components/Channels.tsx index bc419fe2..016be4ab 100644 --- a/client/components/Channels.tsx +++ b/client/components/Channels.tsx @@ -340,7 +340,7 @@ class Channels extends React.Component { const mapStateToProps = (state: any): IChannelsInjectProps => { return { - channels: state.channels[0].chConnection[0].channel, + channels: state.channels[0].chMixerConnection[0].channel, faders: state.faders[0].fader, customPages: state.settings[0].customPages, settings: state.settings[0], diff --git a/client/components/MiniChanStrip.tsx b/client/components/MiniChanStrip.tsx index eeaa5fcb..85ec371e 100644 --- a/client/components/MiniChanStrip.tsx +++ b/client/components/MiniChanStrip.tsx @@ -108,7 +108,7 @@ const mapStateToProps = (state: any, props: any): IChanStripInjectProps => { selectedProtocol: state.settings[0].mixers[0].mixerProtocol, numberOfChannelsInType: state.settings[0].mixers[0].numberOfChannelsInType, - channel: state.channels[0].chConnection[0].channel, + channel: state.channels[0].chMixerConnection[0].channel, fader: state.faders[0].fader, auxSendIndex: -1, offtubeMode: state.settings[0].offtubeMode, @@ -119,7 +119,7 @@ const mapStateToProps = (state: any, props: any): IChanStripInjectProps => { selectedProtocol: state.settings[0].mixers[0].mixerProtocol, numberOfChannelsInType: state.settings[0].mixers[0].numberOfChannelsInType, - channel: state.channels[0].chConnection[0].channel, + channel: state.channels[0].chMixerConnection[0].channel, fader: state.faders[0].fader, auxSendIndex: state.faders[0].fader[props.faderIndex].monitor - 1, offtubeMode: state.settings[0].offtubeMode, diff --git a/client/components/MiniChannel.tsx b/client/components/MiniChannel.tsx index cf77ff69..b61facaf 100644 --- a/client/components/MiniChannel.tsx +++ b/client/components/MiniChannel.tsx @@ -83,12 +83,12 @@ class MiniChannel extends React.Component< const mapStateToProps = (state: any, props: any): IChannelInjectProps => { return { - channels: state.channels[0].chConnection[0].channel, + channels: state.channels[0].chMixerConnection[0].channel, fader: state.faders[0].fader[props.faderIndex], settings: state.settings[0], channelType: 0 /* TODO: state.channels[0].channel[props.channelIndex].channelType, */, channelTypeIndex: - props.faderIndex /* TODO: state.channels[0].chConnection[0].channel[props.channelIndex].channelTypeIndex, */, + props.faderIndex /* TODO: state.channels[0].chMixerConnection[0].channel[props.channelIndex].channelTypeIndex, */, } } diff --git a/client/components/MiniChannels.tsx b/client/components/MiniChannels.tsx index 7a0c00a4..88f08c27 100644 --- a/client/components/MiniChannels.tsx +++ b/client/components/MiniChannels.tsx @@ -63,7 +63,7 @@ class Channels extends React.Component { const mapStateToProps = (state: any): IChannelsInjectProps => { return { - channels: state.channels[0].chConnection[0].channel, + channels: state.channels[0].chMixerConnection[0].channel, faders: state.faders[0].fader, settings: state.settings[0], } diff --git a/client/utils/SocketClientHandlers.ts b/client/utils/SocketClientHandlers.ts index a989c58c..9cd366f3 100644 --- a/client/utils/SocketClientHandlers.ts +++ b/client/utils/SocketClientHandlers.ts @@ -24,7 +24,7 @@ import { SOCKET_RETURN_PAGES_LIST, } from '../../server/constants/SOCKET_IO_DISPATCHERS' import { - IchConnection, + IchMixerConnection, InumberOfChannels, } from '../../server/reducers/channelsReducer' import { VuType } from '../../server/utils/vuServer' @@ -53,11 +53,14 @@ export const socketClientHandlers = () => { // console.log('STATE RECEIVED :', payload) if (window.mixerProtocol) { let numberOfChannels: InumberOfChannels[] = [] - payload.channels[0].chConnection.forEach( - (chConnection: IchConnection, mixerIndex: number) => { + payload.channels[0].chMixerConnection.forEach( + ( + chMixerConnection: IchMixerConnection, + mixerIndex: number + ) => { numberOfChannels.push({ numberOfTypeInCh: [] }) numberOfChannels[mixerIndex].numberOfTypeInCh = [ - chConnection.channel.length, + chMixerConnection.channel.length, ] } ) diff --git a/server/MainThreadHandler.ts b/server/MainThreadHandler.ts index 4b13d537..1df56ee5 100644 --- a/server/MainThreadHandler.ts +++ b/server/MainThreadHandler.ts @@ -106,15 +106,17 @@ export class MainThreadHandlers { faderIndex: faderIndex, state: state.faders[0].fader[faderIndex], }) - state.channels[0].chMixerConnection.forEach((chConnection) => { - chConnection.channel.forEach((channel: IChannel, index: number) => { - if (channel.assignedFader === faderIndex) { - socketServer.emit(SOCKET_SET_STORE_CHANNEL, { - channelIndex: index, - state: channel, - }) + state.channels[0].chMixerConnection.forEach((chMixerConnection) => { + chMixerConnection.channel.forEach( + (channel: IChannel, index: number) => { + if (channel.assignedFader === faderIndex) { + socketServer.emit(SOCKET_SET_STORE_CHANNEL, { + channelIndex: index, + state: channel, + }) + } } - }) + ) }) } diff --git a/server/__tests__/__mocks__/parsedEmptyStore.json b/server/__tests__/__mocks__/parsedEmptyStore.json index 14992ca7..a46cfe14 100644 --- a/server/__tests__/__mocks__/parsedEmptyStore.json +++ b/server/__tests__/__mocks__/parsedEmptyStore.json @@ -7,7 +7,7 @@ ], "channels": [ { - "chConnection": [ + "chMixerConnection": [ { "channel": [ { diff --git a/server/__tests__/__mocks__/parsedFullStore.json b/server/__tests__/__mocks__/parsedFullStore.json index 1fa609ff..a3764298 100644 --- a/server/__tests__/__mocks__/parsedFullStore.json +++ b/server/__tests__/__mocks__/parsedFullStore.json @@ -585,7 +585,7 @@ ], "channels": [ { - "chConnection": [ + "chMixerConnection": [ { "channel": [ { diff --git a/server/__tests__/__mocks__/parsedSimpleStore.json b/server/__tests__/__mocks__/parsedSimpleStore.json index 61482595..a1cca6d6 100644 --- a/server/__tests__/__mocks__/parsedSimpleStore.json +++ b/server/__tests__/__mocks__/parsedSimpleStore.json @@ -33,7 +33,7 @@ ], "channels": [ { - "chConnection": [ + "chMixerConnection": [ { "channel": [ { diff --git a/server/__tests__/channelReducer.spec.ts b/server/__tests__/channelReducer.spec.ts index 9646991a..643008ab 100644 --- a/server/__tests__/channelReducer.spec.ts +++ b/server/__tests__/channelReducer.spec.ts @@ -20,7 +20,7 @@ describe('Test redux channelReducer actions', () => { it('should return the new output_level state on channels', () => { let parsedFullStore = JSON.parse(parsedFullStoreJSON) let nextState = JSON.parse(parsedFullStoreJSON) - nextState.channels[0].chConnection[0].channel[10].outputLevel = 0.5 + nextState.channels[0].chMixerConnection[0].channel[10].outputLevel = 0.5 expect( indexReducer(parsedFullStore, storeSetOutputLevel(0, 10, 0.5)) ).toEqual(nextState) @@ -33,7 +33,7 @@ describe('Test redux channelReducer actions', () => { it('should return the new assignedFader state on channels', () => { let parsedFullStore = JSON.parse(parsedFullStoreJSON) let nextState = JSON.parse(parsedFullStoreJSON) - nextState.channels[0].chConnection[0].channel[10].assignedFader = 2 + nextState.channels[0].chMixerConnection[0].channel[10].assignedFader = 2 expect( indexReducer(parsedFullStore, storeSetAssignedFader(0, 10, 2)) ).toEqual(nextState) @@ -46,7 +46,7 @@ describe('Test redux channelReducer actions', () => { it('should return the new FADE_ACTIVE state on channels', () => { let parsedFullStore = JSON.parse(parsedFullStoreJSON) let nextState = JSON.parse(parsedFullStoreJSON) - nextState.channels[0].chConnection[0].channel[10].fadeActive = true + nextState.channels[0].chMixerConnection[0].channel[10].fadeActive = true expect( indexReducer(parsedFullStore, storeFadeActive(0, 10, true)) ).toEqual(nextState) @@ -71,13 +71,15 @@ describe('Test redux channelReducer actions', () => { fadeActive: false, outputLevel: 0.75, }) - nextState.channels[0].chConnection[0].channel[i].outputLevel = 0.75 + nextState.channels[0].chMixerConnection[0].channel[ + i + ].outputLevel = 0.75 } expect( indexReducer( parsedFullStore, storeSetCompleteChState( - { chConnection: [{ channel: channels }] }, + { chMixerConnection: [{ channel: channels }] }, numberOfChannels ) ) diff --git a/server/reducers/channelsReducer.ts b/server/reducers/channelsReducer.ts index fa304f00..b926dbdf 100644 --- a/server/reducers/channelsReducer.ts +++ b/server/reducers/channelsReducer.ts @@ -76,32 +76,32 @@ export const channels = ( ): Array => { let nextState = [ { - chConnection: [...state[0].chMixerConnection], + chMixerConnection: [...state[0].chMixerConnection], }, ] switch (action.type) { case SET_OUTPUT_LEVEL: - nextState[0].chConnection[action.mixerIndex].channel[ + nextState[0].chMixerConnection[action.mixerIndex].channel[ action.channel ].outputLevel = parseFloat(action.level) return nextState case SET_COMPLETE_CH_STATE: nextState = defaultChannelsReducerState(action.numberOfTypeChannels) - nextState[0].chConnection.forEach( - (chConnection: IchMixerConnection, mixerIndex: number) => { - chConnection.channel.forEach( + nextState[0].chMixerConnection.forEach( + (chMixerConnection: IchMixerConnection, mixerIndex: number) => { + chMixerConnection.channel.forEach( (channel: any, index: number) => { if ( index < - action.allState.chConnection[mixerIndex] + action.allState.chMixerConnection[mixerIndex] ?.channel.length ) { - nextState[0].chConnection[mixerIndex].channel[ - index - ] = - action.allState.chConnection[ + nextState[0].chMixerConnection[ + mixerIndex + ].channel[index] = + action.allState.chMixerConnection[ mixerIndex ].channel[index] } @@ -112,31 +112,34 @@ export const channels = ( return nextState case SET_SINGLE_CH_STATE: - nextState[0].chConnection[0].channel[action.channelIndex] = + nextState[0].chMixerConnection[0].channel[action.channelIndex] = action.state return nextState case FADE_ACTIVE: - nextState[0].chConnection[action.mixerIndex].channel[ + nextState[0].chMixerConnection[action.mixerIndex].channel[ action.channel ].fadeActive = !!action.active return nextState case SET_ASSIGNED_FADER: - nextState[0].chConnection[action.mixerIndex].channel[ + nextState[0].chMixerConnection[action.mixerIndex].channel[ action.channel ].assignedFader = action.faderNumber return nextState case SET_AUX_LEVEL: - nextState[0].chConnection[action.mixerIndex].channel[ + nextState[0].chMixerConnection[action.mixerIndex].channel[ action.channel ].auxLevel[action.auxIndex] = parseFloat(action.level) return nextState case SET_PRIVATE: - if (!nextState[0].chConnection[0].channel[action.channel].private) { - nextState[0].chConnection[0].channel[ + if ( + !nextState[0].chMixerConnection[0].channel[action.channel] + .private + ) { + nextState[0].chMixerConnection[0].channel[ action.channel ].private = {} } - nextState[0].chConnection[0].channel[action.channel].private![ + nextState[0].chMixerConnection[0].channel[action.channel].private![ action.tag ] = action.value return nextState diff --git a/server/reducers/faderActions.ts b/server/reducers/faderActions.ts index b3d331e5..51d6f16f 100644 --- a/server/reducers/faderActions.ts +++ b/server/reducers/faderActions.ts @@ -36,10 +36,10 @@ export const SET_AMIX = 'SET_AMIX' export const SET_CAPABILITY = 'SET_CAPABILITY' export const TOGGLE_ALL_MANUAL = 'TOGGLE_ALL_MANUAL' -export const storeVuReductionLevel = (channel: number, level: number) => { +export const storeVuReductionLevel = (faderIndex: number, level: number) => { return { type: SET_VU_REDUCTION_LEVEL, - channel: channel, + faderIndex: faderIndex, level: level, } } @@ -63,146 +63,146 @@ export const storeSetSingleFaderState = (faderIndex: number, state: IFader) => { } } -export const storeFaderLevel = (channel: number, level: number) => { +export const storeFaderLevel = (faderIndex: number, level: number) => { return { type: SET_FADER_LEVEL, - channel: channel, + faderIndex: faderIndex, level: level, } } -export const storeInputGain = (channel: number, level: number) => { +export const storeInputGain = (faderIndex: number, level: number) => { return { type: SET_INPUT_GAIN, - channel: channel, + faderIndex: faderIndex, level: level, } } -export const storeInputSelector = (channel: number, selected: number) => { +export const storeInputSelector = (faderIndex: number, selected: number) => { return { type: SET_INPUT_SELECTOR, - channel: channel, + faderIndex: faderIndex, selected: selected, } } -export const storeFaderLabel = (channel: number, label: string) => { +export const storeFaderLabel = (faderIndex: number, label: string) => { return { type: SET_CHANNEL_LABEL, - channel: channel, + faderIndex: faderIndex, label: label, } } export const storeFaderFx = ( fxParam: fxParamsList, - channel: number, + faderIndex: number, level: number ) => { return { type: SET_FADER_FX, fxParam: fxParam, - channel: channel, + faderIndex: faderIndex, level: level, } } -export const storeFaderMonitor = (channel: number, auxIndex: number) => { +export const storeFaderMonitor = (faderIndex: number, auxIndex: number) => { return { type: SET_FADER_MONITOR, - channel: channel, + faderIndex: faderIndex, auxIndex: auxIndex, } } -export const storeTogglePgm = (channel: number) => { +export const storeTogglePgm = (faderIndex: number) => { return { type: TOGGLE_PGM, - channel: channel, + faderIndex: faderIndex, } } -export const storeSetPgm = (channel: number, pgmOn: boolean) => { +export const storeSetPgm = (faderIndex: number, pgmOn: boolean) => { return { type: SET_PGM, - channel: channel, + faderIndex: faderIndex, pgmOn: pgmOn, } } -export const storeToggleVo = (channel: number) => { +export const storeToggleVo = (faderIndex: number) => { return { type: TOGGLE_VO, - channel: channel, + faderIndex: faderIndex, } } -export const storeSetVo = (channel: number, voOn: boolean) => { +export const storeSetVo = (faderIndex: number, voOn: boolean) => { return { type: SET_VO, - channel: channel, + faderIndex: faderIndex, voOn: voOn, } } -export const storeTogglePst = (channel: number) => { +export const storeTogglePst = (faderIndex: number) => { return { type: TOGGLE_PST, - channel: channel, + faderIndex: faderIndex, } } -export const storeSetPst = (channel: number, pstOn: boolean) => { +export const storeSetPst = (faderIndex: number, pstOn: boolean) => { return { type: SET_PST, - channel: channel, + faderIndex: faderIndex, pstOn: pstOn, } } -export const storeSetPstVo = (channel: number, pstVoOn: boolean) => { +export const storeSetPstVo = (faderIndex: number, pstVoOn: boolean) => { return { type: SET_PST_VO, - channel: channel, + faderIndex: faderIndex, pstVoOn: pstVoOn, } } -export const storeTogglePfl = (channel: number) => { +export const storeTogglePfl = (faderIndex: number) => { return { type: TOGGLE_PFL, - channel: channel, + faderIndex: faderIndex, } } -export const storeSetPfl = (channel: number, pflOn: boolean) => { +export const storeSetPfl = (faderIndex: number, pflOn: boolean) => { return { type: SET_PFL, - channel: channel, + faderIndex: faderIndex, pflOn: pflOn, } } -export const storeToggleMute = (channel: number) => { +export const storeToggleMute = (faderIndex: number) => { return { type: TOGGLE_MUTE, - channel: channel, + faderIndex: faderIndex, } } -export const storeSetMute = (channel: number, muteOn: boolean) => { +export const storeSetMute = (faderIndex: number, muteOn: boolean) => { return { type: SET_MUTE, - channel: channel, + faderIndex: faderIndex, muteOn: muteOn, } } -export const storeShowChannel = (channel: number, showChannel: boolean) => { +export const storeShowChannel = (faderIndex: number, showChannel: boolean) => { return { type: SHOW_CHANNEL, - channel: channel, + faderIndex: faderIndex, showChannel: showChannel, } } @@ -218,10 +218,10 @@ export const storeShowInMiniMonitor = ( } } -export const storeToggleIgnoreAutomation = (channel: number) => { +export const storeToggleIgnoreAutomation = (faderIndex: number) => { return { type: IGNORE_AUTOMATION, - channel: channel, + faderIndex: faderIndex, } } @@ -249,37 +249,37 @@ export const storeClearPst = () => { } } -export const storeChannelDisabled = (channel: number, disabled: boolean) => { +export const storeChannelDisabled = (faderIndex: number, disabled: boolean) => { return { type: SET_CHANNEL_DISABLED, - channel: channel, + faderIndex: faderIndex, disabled: disabled, } } -export const storeToggleAMix = (channel: number) => { +export const storeToggleAMix = (faderIndex: number) => { return { type: TOGGLE_AMIX, - channel: channel, + faderIndex: faderIndex, } } -export const storeSetAMix = (channel: number, state: boolean) => { +export const storeSetAMix = (faderIndex: number, state: boolean) => { return { type: SET_AMIX, - channel: channel, + faderIndex: faderIndex, state: state, } } export const storeCapability = ( - channel: number, + faderIndex: number, capability: string, enabled: boolean ) => { return { type: SET_CAPABILITY, - channel: channel, + faderIndex: faderIndex, capability: capability, enabled: enabled, } diff --git a/server/reducers/fadersReducer.ts b/server/reducers/fadersReducer.ts index de77b764..e7e8d15b 100644 --- a/server/reducers/fadersReducer.ts +++ b/server/reducers/fadersReducer.ts @@ -116,18 +116,21 @@ export const faders = ( }, ] if ( - action.channel && - (action.channel < 0 || action.channel >= nextState[0].fader.length) + action.faderIndex && + (action.faderIndex < 0 || + action.faderIndex >= nextState[0].fader.length) ) { return nextState } switch (action.type) { case SET_VU_REDUCTION_LEVEL: - if (typeof nextState[0].vuMeters[action.channel] !== 'undefined') { - nextState[0].vuMeters[action.channel].reductionVal = parseFloat( - action.level - ) + if ( + typeof nextState[0].vuMeters[action.faderIndex] !== 'undefined' + ) { + nextState[0].vuMeters[ + action.faderIndex + ].reductionVal = parseFloat(action.level) } return nextState case SET_COMPLETE_FADER_STATE: @@ -150,95 +153,95 @@ export const faders = ( nextState[0].fader[action.faderIndex] = action.state return nextState case SET_FADER_LEVEL: - nextState[0].fader[action.channel].faderLevel = parseFloat( + nextState[0].fader[action.faderIndex].faderLevel = parseFloat( action.level ) return nextState case SET_INPUT_GAIN: - nextState[0].fader[action.channel].inputGain = parseFloat( + nextState[0].fader[action.faderIndex].inputGain = parseFloat( action.level ) return nextState case SET_INPUT_SELECTOR: - nextState[0].fader[action.channel].inputSelector = parseFloat( + nextState[0].fader[action.faderIndex].inputSelector = parseFloat( action.selected ) return nextState case SET_FADER_FX: - if (!nextState[0].fader[action.channel][action.fxParam]) { - nextState[0].fader[action.channel][action.fxParam] = [] + if (!nextState[0].fader[action.faderIndex][action.fxParam]) { + nextState[0].fader[action.faderIndex][action.fxParam] = [] } - nextState[0].fader[action.channel][action.fxParam][0] = parseFloat( - action.level ?? 0 - ) + nextState[0].fader[action.faderIndex][ + action.fxParam + ][0] = parseFloat(action.level ?? 0) return nextState case SET_FADER_MONITOR: - nextState[0].fader[action.channel].monitor = action.auxIndex + nextState[0].fader[action.faderIndex].monitor = action.auxIndex return nextState case SET_CHANNEL_LABEL: - if (!nextState[0].fader[action.channel]) return nextState - nextState[0].fader[action.channel].label = action.label + if (!nextState[0].fader[action.faderIndex]) return nextState + nextState[0].fader[action.faderIndex].label = action.label return nextState case TOGGLE_PGM: - nextState[0].fader[action.channel].pgmOn = !nextState[0].fader[ - action.channel + nextState[0].fader[action.faderIndex].pgmOn = !nextState[0].fader[ + action.faderIndex ].pgmOn - nextState[0].fader[action.channel].voOn = false + nextState[0].fader[action.faderIndex].voOn = false return nextState case SET_PGM: - nextState[0].fader[action.channel].pgmOn = !!action.pgmOn - nextState[0].fader[action.channel].voOn = false + nextState[0].fader[action.faderIndex].pgmOn = !!action.pgmOn + nextState[0].fader[action.faderIndex].voOn = false return nextState case TOGGLE_VO: - nextState[0].fader[action.channel].voOn = !nextState[0].fader[ - action.channel + nextState[0].fader[action.faderIndex].voOn = !nextState[0].fader[ + action.faderIndex ].voOn - nextState[0].fader[action.channel].pgmOn = false + nextState[0].fader[action.faderIndex].pgmOn = false return nextState case SET_VO: - nextState[0].fader[action.channel].voOn = !!action.voOn - nextState[0].fader[action.channel].pgmOn = false + nextState[0].fader[action.faderIndex].voOn = !!action.voOn + nextState[0].fader[action.faderIndex].pgmOn = false return nextState case TOGGLE_PST: - if (nextState[0].fader[action.channel].pstOn) { - nextState[0].fader[action.channel].pstOn = false + if (nextState[0].fader[action.faderIndex].pstOn) { + nextState[0].fader[action.faderIndex].pstOn = false // Disable toggle to pstVoOn, to enable change pstVoOn: true here: - nextState[0].fader[action.channel].pstVoOn = false - } else if (nextState[0].fader[action.channel].pstVoOn) { - nextState[0].fader[action.channel].pstOn = false - nextState[0].fader[action.channel].pstVoOn = false + nextState[0].fader[action.faderIndex].pstVoOn = false + } else if (nextState[0].fader[action.faderIndex].pstVoOn) { + nextState[0].fader[action.faderIndex].pstOn = false + nextState[0].fader[action.faderIndex].pstVoOn = false } else { - nextState[0].fader[action.channel].pstOn = true - nextState[0].fader[action.channel].pstVoOn = false + nextState[0].fader[action.faderIndex].pstOn = true + nextState[0].fader[action.faderIndex].pstVoOn = false } return nextState case SET_PST: - nextState[0].fader[action.channel].pstOn = !!action.pstOn - nextState[0].fader[action.channel].pstVoOn = false + nextState[0].fader[action.faderIndex].pstOn = !!action.pstOn + nextState[0].fader[action.faderIndex].pstVoOn = false return nextState case SET_PST_VO: - nextState[0].fader[action.channel].pstVoOn = !!action.pstVoOn - nextState[0].fader[action.channel].pstOn = false + nextState[0].fader[action.faderIndex].pstVoOn = !!action.pstVoOn + nextState[0].fader[action.faderIndex].pstOn = false return nextState case TOGGLE_PFL: - nextState[0].fader[action.channel].pflOn = !nextState[0].fader[ - action.channel + nextState[0].fader[action.faderIndex].pflOn = !nextState[0].fader[ + action.faderIndex ].pflOn return nextState case SET_PFL: - nextState[0].fader[action.channel].pflOn = !!action.pflOn + nextState[0].fader[action.faderIndex].pflOn = !!action.pflOn return nextState case TOGGLE_MUTE: - nextState[0].fader[action.channel].muteOn = !nextState[0].fader[ - action.channel + nextState[0].fader[action.faderIndex].muteOn = !nextState[0].fader[ + action.faderIndex ].muteOn return nextState case SET_MUTE: - nextState[0].fader[action.channel].muteOn = !!action.muteOn + nextState[0].fader[action.faderIndex].muteOn = !!action.muteOn return nextState case SHOW_CHANNEL: nextState[0].fader[ - action.channel + action.faderIndex ].showChannel = !!action.showChannel return nextState case SHOW_IN_MINI_MONITOR: //faderIndexz // showInMiniMonitor @@ -247,8 +250,10 @@ export const faders = ( ].showInMiniMonitor = !!action.showInMiniMonitor return nextState case IGNORE_AUTOMATION: //channel // ignoreAutomation - nextState[0].fader[action.channel].ignoreAutomation = !nextState[0] - .fader[action.channel].ignoreAutomation + nextState[0].fader[ + action.faderIndex + ].ignoreAutomation = !nextState[0].fader[action.faderIndex] + .ignoreAutomation return nextState case X_MIX: //none nextState[0].fader.forEach((item, index) => { @@ -281,28 +286,29 @@ export const faders = ( }) return nextState case SET_CHANNEL_DISABLED: - if (!nextState[0].fader[action.channel]) return nextState - nextState[0].fader[action.channel].disabled = action.disabled + if (!nextState[0].fader[action.faderIndex]) return nextState + nextState[0].fader[action.faderIndex].disabled = action.disabled return nextState case TOGGLE_AMIX: //channel - nextState[0].fader[action.channel].amixOn = !nextState[0].fader[ - action.channel + nextState[0].fader[action.faderIndex].amixOn = !nextState[0].fader[ + action.faderIndex ].amixOn return nextState case SET_AMIX: //channel - nextState[0].fader[action.channel].amixOn = action.state + nextState[0].fader[action.faderIndex].amixOn = action.state return nextState case SET_CAPABILITY: - nextState[0].fader[action.channel].capabilities = { - ...nextState[0].fader[action.channel].capabilities, + nextState[0].fader[action.faderIndex].capabilities = { + ...nextState[0].fader[action.faderIndex].capabilities, [action.capability]: action.enabled, } // remove object if empty: if ( - Object.entries(nextState[0].fader[action.channel].capabilities!) - .length === 0 + Object.entries( + nextState[0].fader[action.faderIndex].capabilities! + ).length === 0 ) { - delete nextState[0].fader[action.channel].capabilities + delete nextState[0].fader[action.faderIndex].capabilities } return nextState case TOGGLE_ALL_MANUAL: diff --git a/server/utils/MixerConnection.ts b/server/utils/MixerConnection.ts index 60d8dd3e..eaff9dd9 100644 --- a/server/utils/MixerConnection.ts +++ b/server/utils/MixerConnection.ts @@ -105,7 +105,7 @@ export class MixerGenericConnection { //Setup timers for fade in & out this.mixerTimers = [] state.channels[0].chMixerConnection.forEach( - (chConnection: IchMixerConnection, mixerIndex: number) => { + (chMixerConnection: IchMixerConnection, mixerIndex: number) => { this.mixerTimers.push({ chTimer: [], fadeActiveTimer: [] }) state.channels[0].chMixerConnection[mixerIndex].channel.forEach( (channel) => { @@ -178,8 +178,8 @@ export class MixerGenericConnection { } state.channels[0].chMixerConnection.forEach( - (chConnection: IchMixerConnection, mixerIndex: number) => { - chConnection.channel.forEach( + (chMixerConnection: IchMixerConnection, mixerIndex: number) => { + chMixerConnection.channel.forEach( (channel: IChannel, channelIndex: number) => { if (faderIndex === channel.assignedFader) { this.fadeInOut(mixerIndex, channelIndex, fadeTime) @@ -200,8 +200,8 @@ export class MixerGenericConnection { updateInputGain = (faderIndex: number) => { let level = state.faders[0].fader[faderIndex].inputGain state.channels[0].chMixerConnection.forEach( - (chConnection: IchMixerConnection, mixerIndex: number) => { - chConnection.channel.forEach( + (chMixerConnection: IchMixerConnection, mixerIndex: number) => { + chMixerConnection.channel.forEach( (channel: IChannel, channelIndex: number) => { if (faderIndex === channel.assignedFader) { this.mixerConnection[mixerIndex].updateInputGain( @@ -239,8 +239,8 @@ export class MixerGenericConnection { updateMuteState = (faderIndex: number) => { state.channels[0].chMixerConnection.forEach( - (chConnection: IchMixerConnection, mixerIndex: number) => { - chConnection.channel.forEach( + (chMixerConnection: IchMixerConnection, mixerIndex: number) => { + chMixerConnection.channel.forEach( (channel: IChannel, channelIndex: number) => { if (faderIndex === channel.assignedFader) { this.mixerConnection[mixerIndex].updateMuteState( @@ -256,8 +256,8 @@ export class MixerGenericConnection { updateAMixState = (faderIndex: number) => { state.channels[0].chMixerConnection.forEach( - (chConnection: IchMixerConnection, mixerIndex: number) => { - chConnection.channel.forEach( + (chMixerConnection: IchMixerConnection, mixerIndex: number) => { + chMixerConnection.channel.forEach( (channel: IChannel, channelIndex: number) => { if (faderIndex === channel.assignedFader) { this.mixerConnection[mixerIndex].updateAMixState( @@ -282,8 +282,8 @@ export class MixerGenericConnection { 100 } state.channels[0].chMixerConnection.forEach( - (chConnection: IchMixerConnection, mixerIndex: number) => { - chConnection.channel.forEach( + (chMixerConnection: IchMixerConnection, mixerIndex: number) => { + chMixerConnection.channel.forEach( (channel: IChannel, channelIndex: number) => { if (faderIndex === channel.assignedFader) { this.mixerConnection[mixerIndex].updateNextAux( @@ -300,8 +300,8 @@ export class MixerGenericConnection { updateFx = (fxParam: fxParamsList, faderIndex: number) => { let level: number = state.faders[0].fader[faderIndex][fxParam][0] state.channels[0].chMixerConnection.forEach( - (chConnection: IchMixerConnection, mixerIndex: number) => { - chConnection.channel.forEach( + (chMixerConnection: IchMixerConnection, mixerIndex: number) => { + chMixerConnection.channel.forEach( (channel: IChannel, channelIndex: number) => { if (faderIndex === channel.assignedFader) { this.mixerConnection[mixerIndex].updateFx( diff --git a/server/utils/mixerConnections/CasparCGConnection.ts b/server/utils/mixerConnections/CasparCGConnection.ts index d346063d..10db83e7 100644 --- a/server/utils/mixerConnections/CasparCGConnection.ts +++ b/server/utils/mixerConnections/CasparCGConnection.ts @@ -398,7 +398,7 @@ export class CasparCGConnection { state.faders[0].fader[channel.assignedFader].faderLevel ) // Ensure that all other non-SOLO channels are muted on MONITOR - // const others = state.channels[0].chConnection[this.mixerIndex].channel.map((ch: IChannel) => state.faders[0].fader[ch.assignedFader].pflOn ? undefined : index) + // const others = state.channels[0].chMixerConnection[this.mixerIndex].channel.map((ch: IChannel) => state.faders[0].fader[ch.assignedFader].pflOn ? undefined : index) const others = state.channels[0].chMixerConnection[ this.mixerIndex ].channel