From fc22e4e5adb7c95a124bc88bbee0fbfc43d181da Mon Sep 17 00:00:00 2001 From: olzzon Date: Tue, 16 Mar 2021 11:22:10 +0100 Subject: [PATCH] feat: refactor - rename chConnection to chMixerConnection --- server/MainThreadHandler.ts | 2 +- server/reducers/channelsReducer.ts | 14 +-- server/utils/MixerConnection.ts | 66 ++++++------ .../mixerConnections/CasparCGConnection.ts | 58 +++++----- .../mixerConnections/EmberMixerConnection.ts | 43 ++++---- .../mixerConnections/LawoRubyConnection.ts | 25 +++-- .../mixerConnections/MidiMixerConnection.ts | 13 ++- .../mixerConnections/OscMixerConnection.ts | 87 +++++++-------- .../mixerConnections/SSLMixerConnection.ts | 46 ++++---- .../mixerConnections/StuderMixerConnection.ts | 28 ++--- .../StuderVistaMixerConnection.ts | 101 +++++++++--------- .../mixerConnections/YamahaQlClConnection.ts | 41 +++---- .../mixerConnections/productSpecific/midas.ts | 3 +- .../SkaarhojRemoteConnection.ts | 22 ++-- 14 files changed, 278 insertions(+), 271 deletions(-) diff --git a/server/MainThreadHandler.ts b/server/MainThreadHandler.ts index 3081f9fc..4b13d537 100644 --- a/server/MainThreadHandler.ts +++ b/server/MainThreadHandler.ts @@ -106,7 +106,7 @@ export class MainThreadHandlers { faderIndex: faderIndex, state: state.faders[0].fader[faderIndex], }) - state.channels[0].chConnection.forEach((chConnection) => { + state.channels[0].chMixerConnection.forEach((chConnection) => { chConnection.channel.forEach((channel: IChannel, index: number) => { if (channel.assignedFader === faderIndex) { socketServer.emit(SOCKET_SET_STORE_CHANNEL, { diff --git a/server/reducers/channelsReducer.ts b/server/reducers/channelsReducer.ts index cfffa839..fa304f00 100644 --- a/server/reducers/channelsReducer.ts +++ b/server/reducers/channelsReducer.ts @@ -9,10 +9,10 @@ import { } from './channelActions' export interface IChannels { - chConnection: IchConnection[] + chMixerConnection: IchMixerConnection[] } -export interface IchConnection { +export interface IchMixerConnection { channel: Array } @@ -37,7 +37,7 @@ const defaultChannelsReducerState = ( ): IChannels[] => { let defaultObj: IChannels[] = [ { - chConnection: [], + chMixerConnection: [], }, ] @@ -47,11 +47,11 @@ const defaultChannelsReducerState = ( mixerIndex++ ) { let totalNumberOfChannels = 0 - defaultObj[0].chConnection.push({ channel: [] }) + defaultObj[0].chMixerConnection.push({ channel: [] }) numberOfChannels[mixerIndex].numberOfTypeInCh.forEach( (channelTypeSize: any, typeIndex: number) => { for (let index = 0; index < channelTypeSize; index++) { - defaultObj[0].chConnection[mixerIndex].channel[ + defaultObj[0].chMixerConnection[mixerIndex].channel[ totalNumberOfChannels ] = { channelType: typeIndex, @@ -76,7 +76,7 @@ export const channels = ( ): Array => { let nextState = [ { - chConnection: [...state[0].chConnection], + chConnection: [...state[0].chMixerConnection], }, ] @@ -90,7 +90,7 @@ export const channels = ( nextState = defaultChannelsReducerState(action.numberOfTypeChannels) nextState[0].chConnection.forEach( - (chConnection: IchConnection, mixerIndex: number) => { + (chConnection: IchMixerConnection, mixerIndex: number) => { chConnection.channel.forEach( (channel: any, index: number) => { if ( diff --git a/server/utils/MixerConnection.ts b/server/utils/MixerConnection.ts index 6a6c7af3..60d8dd3e 100644 --- a/server/utils/MixerConnection.ts +++ b/server/utils/MixerConnection.ts @@ -18,7 +18,7 @@ import { LawoRubyMixerConnection } from './mixerConnections/LawoRubyConnection' import { StuderMixerConnection } from './mixerConnections/StuderMixerConnection' import { StuderVistaMixerConnection } from './mixerConnections/StuderVistaMixerConnection' import { CasparCGConnection } from './mixerConnections/CasparCGConnection' -import { IChannel, IchConnection } from '../reducers/channelsReducer' +import { IChannel, IchMixerConnection } from '../reducers/channelsReducer' import { storeFadeActive, storeSetOutputLevel, @@ -104,10 +104,10 @@ export class MixerGenericConnection { initializeTimers = () => { //Setup timers for fade in & out this.mixerTimers = [] - state.channels[0].chConnection.forEach( - (chConnection: IchConnection, mixerIndex: number) => { + state.channels[0].chMixerConnection.forEach( + (chConnection: IchMixerConnection, mixerIndex: number) => { this.mixerTimers.push({ chTimer: [], fadeActiveTimer: [] }) - state.channels[0].chConnection[mixerIndex].channel.forEach( + state.channels[0].chMixerConnection[mixerIndex].channel.forEach( (channel) => { this.mixerTimers[mixerIndex].chTimer.push(undefined) this.mixerTimers[mixerIndex].fadeActiveTimer.push( @@ -177,8 +177,8 @@ export class MixerGenericConnection { } } - state.channels[0].chConnection.forEach( - (chConnection: IchConnection, mixerIndex: number) => { + state.channels[0].chMixerConnection.forEach( + (chConnection: IchMixerConnection, mixerIndex: number) => { chConnection.channel.forEach( (channel: IChannel, channelIndex: number) => { if (faderIndex === channel.assignedFader) { @@ -199,8 +199,8 @@ export class MixerGenericConnection { updateInputGain = (faderIndex: number) => { let level = state.faders[0].fader[faderIndex].inputGain - state.channels[0].chConnection.forEach( - (chConnection: IchConnection, mixerIndex: number) => { + state.channels[0].chMixerConnection.forEach( + (chConnection: IchMixerConnection, mixerIndex: number) => { chConnection.channel.forEach( (channel: IChannel, channelIndex: number) => { if (faderIndex === channel.assignedFader) { @@ -218,9 +218,9 @@ export class MixerGenericConnection { updateInputSelector = (faderIndex: number) => { let inputSelected = state.faders[0].fader[faderIndex].inputSelector console.log(faderIndex, inputSelected) - state.channels[0].chConnection.forEach( - (chConnection: IchConnection, mixerIndex: number) => { - chConnection.channel.forEach( + state.channels[0].chMixerConnection.forEach( + (chMixerConnection: IchMixerConnection, mixerIndex: number) => { + chMixerConnection.channel.forEach( (channel: IChannel, channelIndex: number) => { if (faderIndex === channel.assignedFader) { this.mixerConnection[ @@ -238,8 +238,8 @@ export class MixerGenericConnection { } updateMuteState = (faderIndex: number) => { - state.channels[0].chConnection.forEach( - (chConnection: IchConnection, mixerIndex: number) => { + state.channels[0].chMixerConnection.forEach( + (chConnection: IchMixerConnection, mixerIndex: number) => { chConnection.channel.forEach( (channel: IChannel, channelIndex: number) => { if (faderIndex === channel.assignedFader) { @@ -255,8 +255,8 @@ export class MixerGenericConnection { } updateAMixState = (faderIndex: number) => { - state.channels[0].chConnection.forEach( - (chConnection: IchConnection, mixerIndex: number) => { + state.channels[0].chMixerConnection.forEach( + (chConnection: IchMixerConnection, mixerIndex: number) => { chConnection.channel.forEach( (channel: IChannel, channelIndex: number) => { if (faderIndex === channel.assignedFader) { @@ -281,8 +281,8 @@ export class MixerGenericConnection { (100 - state.settings[0].voLevel)) / 100 } - state.channels[0].chConnection.forEach( - (chConnection: IchConnection, mixerIndex: number) => { + state.channels[0].chMixerConnection.forEach( + (chConnection: IchMixerConnection, mixerIndex: number) => { chConnection.channel.forEach( (channel: IChannel, channelIndex: number) => { if (faderIndex === channel.assignedFader) { @@ -299,8 +299,8 @@ export class MixerGenericConnection { updateFx = (fxParam: fxParamsList, faderIndex: number) => { let level: number = state.faders[0].fader[faderIndex][fxParam][0] - state.channels[0].chConnection.forEach( - (chConnection: IchConnection, mixerIndex: number) => { + state.channels[0].chMixerConnection.forEach( + (chConnection: IchMixerConnection, mixerIndex: number) => { chConnection.channel.forEach( (channel: IChannel, channelIndex: number) => { if (faderIndex === channel.assignedFader) { @@ -316,7 +316,8 @@ export class MixerGenericConnection { ) } updateAuxLevel = (channelIndex: number, auxSendIndex: number) => { - let channel = state.channels[0].chConnection[0].channel[channelIndex] + let channel = + state.channels[0].chMixerConnection[0].channel[channelIndex] if (channel.auxLevel[auxSendIndex] > -1) { this.mixerConnection[0].updateAuxLevel( channelIndex, @@ -354,13 +355,15 @@ export class MixerGenericConnection { fadeTime: number ) => { let faderIndex = - state.channels[0].chConnection[mixerIndex].channel[channelIndex] - .assignedFader + state.channels[0].chMixerConnection[mixerIndex].channel[ + channelIndex + ].assignedFader if ( !state.faders[0].fader[faderIndex].pgmOn && !state.faders[0].fader[faderIndex].voOn && - state.channels[0].chConnection[mixerIndex].channel[channelIndex] - .outputLevel === 0 + state.channels[0].chMixerConnection[mixerIndex].channel[ + channelIndex + ].outputLevel === 0 ) { return } @@ -372,8 +375,9 @@ export class MixerGenericConnection { } //Clear Old timer or set Fade to active: if ( - state.channels[0].chConnection[mixerIndex].channel[channelIndex] - .fadeActive + state.channels[0].chMixerConnection[mixerIndex].channel[ + channelIndex + ].fadeActive ) { clearInterval( this.mixerTimers[mixerIndex].fadeActiveTimer[channelIndex] @@ -398,8 +402,9 @@ export class MixerGenericConnection { faderIndex: number ) => { let outputLevel = - state.channels[0].chConnection[mixerIndex].channel[channelIndex] - .outputLevel + state.channels[0].chMixerConnection[mixerIndex].channel[ + channelIndex + ].outputLevel let targetVal = state.faders[0].fader[faderIndex].faderLevel if (state.faders[0].fader[faderIndex].voOn) { @@ -513,8 +518,9 @@ export class MixerGenericConnection { fadeDown = (mixerIndex: number, channelIndex: number, fadeTime: number) => { let outputLevel = - state.channels[0].chConnection[mixerIndex].channel[channelIndex] - .outputLevel + state.channels[0].chMixerConnection[mixerIndex].channel[ + channelIndex + ].outputLevel const step = outputLevel / (fadeTime / FADE_INOUT_SPEED) const dispatchResolution: number = this.mixerProtocol[mixerIndex].FADE_DISPATCH_RESOLUTION * step diff --git a/server/utils/mixerConnections/CasparCGConnection.ts b/server/utils/mixerConnections/CasparCGConnection.ts index a1bec6be..d346063d 100644 --- a/server/utils/mixerConnections/CasparCGConnection.ts +++ b/server/utils/mixerConnections/CasparCGConnection.ts @@ -138,7 +138,7 @@ export class CasparCGConnection { ][vuChannelIndex] ) { const faderIndex = - state.channels[0].chConnection[ + state.channels[0].chMixerConnection[ this.mixerIndex ].channel[channelIndex].assignedFader sendVuLevel( @@ -228,7 +228,7 @@ export class CasparCGConnection { } // Restore mixer values to the ones we have internally - state.channels[0].chConnection[this.mixerIndex].channel.forEach( + state.channels[0].chMixerConnection[this.mixerIndex].channel.forEach( (channel: IChannel, index) => { // const fader = state.faders[0].fader[channel.assignedFader] this.updateFadeIOLevel(index, channel.outputLevel) @@ -379,11 +379,11 @@ export class CasparCGConnection { } logger.verbose('Update PFL state for ' + channelIndex) const channel: IChannel = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ] const fader: IFader = state.faders[0].fader[channel.assignedFader] - const otherFaders: Array = state.channels[0].chConnection[ + const otherFaders: Array = state.channels[0].chMixerConnection[ this.mixerIndex ].channel .filter((_ch: any, i: number) => i !== channelIndex) @@ -399,7 +399,7 @@ export class CasparCGConnection { ) // 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].chConnection[ + const others = state.channels[0].chMixerConnection[ this.mixerIndex ].channel .map((ch: IChannel, index: number) => @@ -437,25 +437,24 @@ export class CasparCGConnection { this.setAllLayers(pairs, this.mixerProtocol.fader.min) } else { // There are no other SOLO channels, restore PFL to match PGM - state.channels[0].chConnection[this.mixerIndex].channel.forEach( - (_ch: IChannel, index: number) => { - if ( - index > - this.mixerProtocol.toMixer.PFL_AUX_FADER_LEVEL - .length - - 1 - ) { - return - } - const pairs = this.mixerProtocol.toMixer - .PFL_AUX_FADER_LEVEL[index] - this.setAllLayers( - pairs, - state.channels[0].chConnection[this.mixerIndex] - .channel[index].outputLevel - ) + state.channels[0].chMixerConnection[ + this.mixerIndex + ].channel.forEach((_ch: IChannel, index: number) => { + if ( + index > + this.mixerProtocol.toMixer.PFL_AUX_FADER_LEVEL.length - + 1 + ) { + return } - ) + const pairs = this.mixerProtocol.toMixer + .PFL_AUX_FADER_LEVEL[index] + this.setAllLayers( + pairs, + state.channels[0].chMixerConnection[this.mixerIndex] + .channel[index].outputLevel + ) + }) } } } @@ -474,7 +473,7 @@ export class CasparCGConnection { logger.verbose('Update NEXT AUX for ' + channelIndex) if (this.mixerProtocol.toMixer.NEXT_AUX_FADER_LEVEL) { const faderIndex: number = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].assignedFader if (state.faders[0].fader[faderIndex].pstOn === true) { @@ -502,15 +501,16 @@ export class CasparCGConnection { updateInputSelector(channelIndex: number, inputSelected: number) { if ( this.mixerProtocol.toMixer.CHANNEL_INPUT_SELECTOR && - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].private ) { const pair = this.mixerProtocol.sourceOptions.sources[channelIndex] - const producer = state.channels[0].chConnection[this.mixerIndex] - .channel[channelIndex].private!['producer'] + const producer = state.channels[0].chMixerConnection[ + this.mixerIndex + ].channel[channelIndex].private!['producer'] let filePath = String( - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].private!['file_path'] ) @@ -547,7 +547,7 @@ export class CasparCGConnection { ) const faderIndex: number = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].assignedFader const pgmPairs = this.mixerProtocol.toMixer.PGM_CHANNEL_FADER_LEVEL[ diff --git a/server/utils/mixerConnections/EmberMixerConnection.ts b/server/utils/mixerConnections/EmberMixerConnection.ts index 0dfd384a..38e9d267 100644 --- a/server/utils/mixerConnections/EmberMixerConnection.ts +++ b/server/utils/mixerConnections/EmberMixerConnection.ts @@ -187,7 +187,7 @@ export class EmberMixerConnection { ) { const mixerMessage = 'Channels.Inputs.${channel}.Fader' const channel = - state.channels[0].chConnection[this.mixerIndex].channel[ch - 1] + state.channels[0].chMixerConnection[this.mixerIndex].channel[ch - 1] await this.subscribeToEmberNode( channelTypeIndex, @@ -270,9 +270,8 @@ export class EmberMixerConnection { const val = (parameter.value as number) / parameter.factor const level = this._faderLevelToFloat(val, typeIndex) const channel = - state.channels[0].chConnection[this.mixerIndex].channel[ - ch - 1 - ] + state.channels[0].chMixerConnection[this.mixerIndex] + .channel[ch - 1] logger.verbose( `Receiving Level from Ch "${ch}", val: ${val}, level: ${level}` @@ -320,7 +319,7 @@ export class EmberMixerConnection { const mixerMessage = this.mixerProtocol.channelTypes[typeIndex] .fromMixer.CHANNEL_NAME[0].mixerMessage const channel = - state.channels[0].chConnection[this.mixerIndex].channel[ch - 1] + state.channels[0].chMixerConnection[this.mixerIndex].channel[ch - 1] await this.subscribeToEmberNode( channelTypeIndex, mixerMessage, @@ -363,7 +362,7 @@ export class EmberMixerConnection { const mixerMessage = this.mixerProtocol.channelTypes[typeIndex] .fromMixer.PFL[0].mixerMessage const channel = - state.channels[0].chConnection[this.mixerIndex].channel[ch - 1] + state.channels[0].chMixerConnection[this.mixerIndex].channel[ch - 1] await this.subscribeToEmberNode( channelTypeIndex, @@ -395,7 +394,7 @@ export class EmberMixerConnection { const mixerMessage = this.mixerProtocol.channelTypes[typeIndex] .fromMixer.CHANNEL_INPUT_GAIN[0].mixerMessage const channel = - state.channels[0].chConnection[this.mixerIndex].channel[ch - 1] + state.channels[0].chMixerConnection[this.mixerIndex].channel[ch - 1] await this.subscribeToEmberNode( channelTypeIndex, @@ -431,7 +430,7 @@ export class EmberMixerConnection { channelTypeIndex: number ) { const channel = - state.channels[0].chConnection[this.mixerIndex].channel[ch - 1] + state.channels[0].chMixerConnection[this.mixerIndex].channel[ch - 1] for (const i in this.mixerProtocol.channelTypes[typeIndex].fromMixer .CHANNEL_INPUT_SELECTOR) { const proto = this.mixerProtocol.channelTypes[typeIndex].fromMixer @@ -479,7 +478,7 @@ export class EmberMixerConnection { // subscription for enabling input selectors const mixerMessage = 'Channels.Inputs.${channel}.Channel States.Stereo' const channel = - state.channels[0].chConnection[this.mixerIndex].channel[ch - 1] + state.channels[0].chMixerConnection[this.mixerIndex].channel[ch - 1] await this.subscribeToEmberNode( channelTypeIndex, mixerMessage, @@ -558,7 +557,7 @@ export class EmberMixerConnection { channelTypeIndex: number ) { const channel = - state.channels[0].chConnection[this.mixerIndex].channel[ch - 1] + state.channels[0].chMixerConnection[this.mixerIndex].channel[ch - 1] if (this.mixerProtocol.label === LawoMC2.label) { // subscription for enabling amix button const mixerMessage = @@ -691,17 +690,17 @@ export class EmberMixerConnection { updateOutLevel(channelIndex: number) { let channelType = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelType let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelTypeIndex let protocol = this.mixerProtocol.channelTypes[channelType].toMixer .CHANNEL_OUT_GAIN[0] let level = - (state.channels[0].chConnection[this.mixerIndex].channel[ + (state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].outputLevel - protocol.min) * @@ -711,11 +710,11 @@ export class EmberMixerConnection { updateFadeIOLevel(channelIndex: number, outputLevel: number) { let channelType = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelType let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelTypeIndex // let protocol = this.mixerProtocol.channelTypes[channelType].toMixer @@ -729,11 +728,11 @@ export class EmberMixerConnection { updatePflState(channelIndex: number) { let channelType = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelType let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelTypeIndex @@ -770,7 +769,7 @@ export class EmberMixerConnection { updateInputGain(channelIndex: number, gain: number) { const channel = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ] let channelType = channel.channelType @@ -791,7 +790,7 @@ export class EmberMixerConnection { } updateInputSelector(channelIndex: number, inputSelected: number) { const channel = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ] let channelType = channel.channelType @@ -849,11 +848,11 @@ export class EmberMixerConnection { updateChannelName(channelIndex: number) { let channelType = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelType let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelTypeIndex let channelName = state.faders[0].fader[channelIndex].label @@ -868,7 +867,7 @@ export class EmberMixerConnection { updateAMixState(channelIndex: number, amixOn: boolean) { const channel = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ] let channelType = channel.channelType diff --git a/server/utils/mixerConnections/LawoRubyConnection.ts b/server/utils/mixerConnections/LawoRubyConnection.ts index 52e82466..fce9d136 100644 --- a/server/utils/mixerConnections/LawoRubyConnection.ts +++ b/server/utils/mixerConnections/LawoRubyConnection.ts @@ -247,9 +247,8 @@ export class LawoRubyMixerConnection { this.emberConnection.subscribe(node, () => { logger.verbose('Receiving Level from Ch ' + String(ch)) if ( - !state.channels[0].chConnection[this.mixerIndex].channel[ - ch - 1 - ].fadeActive && + !state.channels[0].chMixerConnection[this.mixerIndex] + .channel[ch - 1].fadeActive && (node.contents as Model.Parameter).value > this.mixerProtocol.channelTypes[typeIndex].fromMixer .CHANNEL_OUT_GAIN[0].min @@ -452,17 +451,17 @@ export class LawoRubyMixerConnection { updateOutLevel(channelIndex: number) { let channelType = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelType let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelTypeIndex let protocol = this.mixerProtocol.channelTypes[channelType].toMixer .CHANNEL_OUT_GAIN[0] let level = - (state.channels[0].chConnection[this.mixerIndex].channel[ + (state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].outputLevel - protocol.min) * @@ -472,11 +471,11 @@ export class LawoRubyMixerConnection { updateFadeIOLevel(channelIndex: number, outputLevel: number) { let channelType = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelType let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelTypeIndex let protocol = this.mixerProtocol.channelTypes[channelType].toMixer @@ -489,12 +488,12 @@ export class LawoRubyMixerConnection { async updatePflState(channelIndex: number) { const channel = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ] let channelType = channel.channelType let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelTypeIndex @@ -528,7 +527,7 @@ export class LawoRubyMixerConnection { updateAMixState(channelIndex: number, amixOn: boolean) { const channel = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ] let channelType = channel.channelType @@ -550,7 +549,7 @@ export class LawoRubyMixerConnection { updateInputGain(channelIndex: number, gain: number) { const channel = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ] let channelType = channel.channelType @@ -570,7 +569,7 @@ export class LawoRubyMixerConnection { updateInputSelector(channelIndex: number, inputSelected: number) { logger.debug('input select', channelIndex, inputSelected) const channel = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ] let channelType = channel.channelType diff --git a/server/utils/mixerConnections/MidiMixerConnection.ts b/server/utils/mixerConnections/MidiMixerConnection.ts index 1866fc9c..9aa2841c 100644 --- a/server/utils/mixerConnections/MidiMixerConnection.ts +++ b/server/utils/mixerConnections/MidiMixerConnection.ts @@ -86,16 +86,15 @@ export class MidiMixerConnection { ) let faderChannel = 1 + - state.channels[0].chConnection[this.mixerIndex].channel[ - ch - 1 - ].assignedFader + state.channels[0].chMixerConnection[this.mixerIndex] + .channel[ch - 1].assignedFader store.dispatch( storeFaderLevel(faderChannel - 1, message.data[2]) ) if (!state.faders[0].fader[faderChannel - 1].pgmOn) { store.dispatch( storeTogglePgm( - state.channels[0].chConnection[this.mixerIndex] + state.channels[0].chMixerConnection[this.mixerIndex] .channel[ch - 1].assignedFader - 1 ) ) @@ -107,7 +106,7 @@ export class MidiMixerConnection { ) } if (state.faders[0].fader[faderChannel - 1].pgmOn) { - state.channels[0].chConnection[ + state.channels[0].chMixerConnection[ this.mixerIndex ].channel.forEach((channel: any, index: number) => { if (channel.assignedFader === faderChannel - 1) { @@ -181,7 +180,7 @@ export class MidiMixerConnection { updateOutLevel(channelIndex: number) { let faderIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].assignedFader if (state.faders[0].fader[faderIndex].pgmOn) { @@ -198,7 +197,7 @@ export class MidiMixerConnection { .mixerMessage, channelIndex + 1, String( - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].outputLevel ) diff --git a/server/utils/mixerConnections/OscMixerConnection.ts b/server/utils/mixerConnections/OscMixerConnection.ts index 3ba4a0c5..3d9106fa 100644 --- a/server/utils/mixerConnections/OscMixerConnection.ts +++ b/server/utils/mixerConnections/OscMixerConnection.ts @@ -48,8 +48,10 @@ export class OscMixerConnection { this.mixerProtocol = mixerProtocol this.mixerIndex = mixerIndex //If default store has been recreated multiple mixers are not created - if (!state.channels[0].chConnection[this.mixerIndex]) { - state.channels[0].chConnection[this.mixerIndex] = { channel: [] } + if (!state.channels[0].chMixerConnection[this.mixerIndex]) { + state.channels[0].chMixerConnection[this.mixerIndex] = { + channel: [], + } } this.cmdChannelIndex = this.mixerProtocol.channelTypes[0].fromMixer.CHANNEL_OUT_GAIN[0].mixerMessage @@ -114,7 +116,7 @@ export class OscMixerConnection { this.cmdChannelIndex ] sendVuLevel( - state.channels[0].chConnection[this.mixerIndex] + state.channels[0].chMixerConnection[this.mixerIndex] .channel[ch - 1].assignedFader, VuType.Channel, 0, @@ -130,9 +132,8 @@ export class OscMixerConnection { ) { let ch = message.address.split('/')[this.cmdChannelIndex] sendVuLevel( - state.channels[0].chConnection[this.mixerIndex].channel[ - ch - 1 - ].assignedFader, + state.channels[0].chMixerConnection[this.mixerIndex] + .channel[ch - 1].assignedFader, VuType.Reduction, 0, message.args[0] @@ -146,13 +147,12 @@ export class OscMixerConnection { ) { let ch = message.address.split('/')[this.cmdChannelIndex] let assignedFaderIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ - ch - 1 - ].assignedFader + state.channels[0].chMixerConnection[this.mixerIndex] + .channel[ch - 1].assignedFader if ( assignedFaderIndex >= 0 && - !state.channels[0].chConnection[this.mixerIndex] + !state.channels[0].chMixerConnection[this.mixerIndex] .channel[ch - 1].fadeActive ) { if ( @@ -166,7 +166,7 @@ export class OscMixerConnection { message.args[0] ) ) - state.channels[0].chConnection[ + state.channels[0].chMixerConnection[ this.mixerIndex ].channel.forEach((item, index) => { if (item.assignedFader === assignedFaderIndex) { @@ -202,7 +202,7 @@ export class OscMixerConnection { message.args[0] ) ) - state.channels[0].chConnection[ + state.channels[0].chMixerConnection[ this.mixerIndex ].channel.forEach((item, index) => { if (item.assignedFader === assignedFaderIndex) { @@ -251,9 +251,8 @@ export class OscMixerConnection { } ) if ( - state.channels[0].chConnection[this.mixerIndex].channel[ - ch - 1 - ].auxLevel[auxIndex] > -1 + state.channels[0].chMixerConnection[this.mixerIndex] + .channel[ch - 1].auxLevel[auxIndex] > -1 ) { logger.verbose( 'Aux Message Channel : ' + @@ -286,15 +285,14 @@ export class OscMixerConnection { let ch = message.address.split('/')[this.cmdChannelIndex] store.dispatch( storeFaderLabel( - state.channels[0].chConnection[this.mixerIndex] + state.channels[0].chMixerConnection[this.mixerIndex] .channel[ch - 1].assignedFader, message.args[0] ) ) global.mainThreadHandler.updatePartialStore( - state.channels[0].chConnection[this.mixerIndex].channel[ - ch - 1 - ].assignedFader + state.channels[0].chMixerConnection[this.mixerIndex] + .channel[ch - 1].assignedFader ) } else if ( this.checkOscCommand( @@ -306,15 +304,14 @@ export class OscMixerConnection { let ch = message.address.split('/')[this.cmdChannelIndex] store.dispatch( storeSetMute( - state.channels[0].chConnection[this.mixerIndex] + state.channels[0].chMixerConnection[this.mixerIndex] .channel[ch - 1].assignedFader, message.args[0] === 0 ) ) global.mainThreadHandler.updatePartialStore( - state.channels[0].chConnection[this.mixerIndex].channel[ - ch - 1 - ].assignedFader + state.channels[0].chMixerConnection[this.mixerIndex] + .channel[ch - 1].assignedFader ) } else { this.checkFxCommands(message) @@ -355,7 +352,7 @@ export class OscMixerConnection { setTimeout(() => { if (item.mixerMessage.includes('{channel}')) { if (item.type !== undefined && item.type === 'aux') { - state.channels[0].chConnection[ + state.channels[0].chMixerConnection[ this.mixerIndex ].channel.forEach((channel: any) => { channel.auxLevel.forEach( @@ -382,7 +379,7 @@ export class OscMixerConnection { ) }) } else { - state.channels[0].chConnection[ + state.channels[0].chMixerConnection[ this.mixerIndex ].channel.forEach((channel: any, index: any) => { this.sendOutRequest( @@ -433,16 +430,14 @@ export class OscMixerConnection { store.dispatch( storeFaderFx( fxParamsList[fxKey], - state.channels[0].chConnection[this.mixerIndex].channel[ - ch - 1 - ].assignedFader, + state.channels[0].chMixerConnection[this.mixerIndex] + .channel[ch - 1].assignedFader, message.args[0] ) ) global.mainThreadHandler.updatePartialStore( - state.channels[0].chConnection[this.mixerIndex].channel[ - ch - 1 - ].assignedFader + state.channels[0].chMixerConnection[this.mixerIndex] + .channel[ch - 1].assignedFader ) } @@ -529,18 +524,18 @@ export class OscMixerConnection { updateOutLevel(channelIndex: number) { let channelType = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelType let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelTypeIndex this.sendOutMessage( this.mixerProtocol.channelTypes[channelType].toMixer .CHANNEL_OUT_GAIN[0].mixerMessage, channelTypeIndex + 1, - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].outputLevel, 'f' @@ -549,11 +544,11 @@ export class OscMixerConnection { updatePflState(channelIndex: number) { let channelType = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelType let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelTypeIndex if (state.faders[0].fader[channelIndex].pflOn === true) { @@ -581,11 +576,11 @@ export class OscMixerConnection { updateMuteState(channelIndex: number, muteOn: boolean) { let channelType = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelType let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelTypeIndex if (muteOn === true) { @@ -626,11 +621,11 @@ export class OscMixerConnection { updateFx(fxParam: fxParamsList, channelIndex: number, level: number) { let channelType = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelType let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelTypeIndex let fx = this.mixerProtocol.channelTypes[channelType].toMixer[ @@ -641,11 +636,11 @@ export class OscMixerConnection { updateAuxLevel(channelIndex: number, auxSendIndex: number, level: number) { let channelType = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelType let channel = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelTypeIndex + 1 let auxSendCmd = this.mixerProtocol.channelTypes[channelType].toMixer @@ -663,11 +658,11 @@ export class OscMixerConnection { updateFadeIOLevel(channelIndex: number, outputLevel: number) { let channelType = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelType let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelTypeIndex this.sendOutMessage( @@ -681,11 +676,11 @@ export class OscMixerConnection { updateChannelName(channelIndex: number) { let channelType = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelType let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelTypeIndex let channelName = state.faders[0].fader[channelIndex].label diff --git a/server/utils/mixerConnections/SSLMixerConnection.ts b/server/utils/mixerConnections/SSLMixerConnection.ts index d961f102..86f7648a 100644 --- a/server/utils/mixerConnections/SSLMixerConnection.ts +++ b/server/utils/mixerConnections/SSLMixerConnection.ts @@ -66,7 +66,7 @@ export class SSLMixerConnection { logger.info('Receiving state of desk', {}) this.mixerProtocol.initializeCommands.map((item) => { if (item.mixerMessage.includes('{channel}')) { - state.channels[0].chConnection[ + state.channels[0].chMixerConnection[ this.mixerIndex ].channel.forEach((channel: any, index: any) => { this.sendOutRequest(item.mixerMessage, index) @@ -103,11 +103,13 @@ export class SSLMixerConnection { let value = buffer.readUInt16BE(7) / 1024 let assignedFaderIndex = - state.channels[0].chConnection[this.mixerIndex] - .channel[channelIndex].assignedFader + state.channels[0].chMixerConnection[ + this.mixerIndex + ].channel[channelIndex].assignedFader if ( - !state.channels[0].chConnection[this.mixerIndex] - .channel[channelIndex].fadeActive + !state.channels[0].chMixerConnection[ + this.mixerIndex + ].channel[channelIndex].fadeActive ) { if ( value > @@ -117,7 +119,7 @@ export class SSLMixerConnection { 100 ) { if ( - state.channels[0].chConnection[ + state.channels[0].chMixerConnection[ this.mixerIndex ].channel[channelIndex].outputLevel !== value @@ -151,7 +153,7 @@ export class SSLMixerConnection { assignedFaderIndex ].pgmOn ) { - state.channels[0].chConnection[ + state.channels[0].chMixerConnection[ this.mixerIndex ].channel.forEach( ( @@ -182,7 +184,7 @@ export class SSLMixerConnection { value ) ) - state.channels[0].chConnection[ + state.channels[0].chMixerConnection[ this.mixerIndex ].channel.forEach((item, index) => { if ( @@ -228,7 +230,7 @@ export class SSLMixerConnection { ) let assignedFaderIndex = - state.channels[0].chConnection[this.mixerIndex] + state.channels[0].chMixerConnection[this.mixerIndex] .channel[channelIndex].assignedFader store.dispatch(storeSetMute(assignedFaderIndex, value)) @@ -239,7 +241,7 @@ export class SSLMixerConnection { value ? 1 : 0 ) } - state.channels[0].chConnection[ + state.channels[0].chMixerConnection[ this.mixerIndex ].channel.forEach((channel: any, index: number) => { if ( @@ -419,15 +421,15 @@ export class SSLMixerConnection { updateOutLevel(channelIndex: number) { let channelType = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelType let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelTypeIndex let faderIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].assignedFader if (state.faders[0].fader[faderIndex].pgmOn) { @@ -443,7 +445,7 @@ export class SSLMixerConnection { this.mixerProtocol.channelTypes[channelType].toMixer .CHANNEL_OUT_GAIN[0].mixerMessage, channelTypeIndex, - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].outputLevel ) @@ -451,11 +453,11 @@ export class SSLMixerConnection { updatePflState(channelIndex: number) { let channelType = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelType let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelTypeIndex if (state.faders[0].fader[channelIndex].pflOn === true) { @@ -475,11 +477,11 @@ export class SSLMixerConnection { updateMuteState(channelIndex: number, muteOn: boolean) { let channelType = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelType let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelTypeIndex if (muteOn === true) { @@ -499,11 +501,11 @@ export class SSLMixerConnection { updateFadeIOLevel(channelIndex: number, outputLevel: number) { let channelType = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelType let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelTypeIndex this.sendOutLevelMessage( @@ -538,11 +540,11 @@ export class SSLMixerConnection { updateChannelName(channelIndex: number) { let channelType = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelType let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelTypeIndex let channelName = state.faders[0].fader[channelIndex].label diff --git a/server/utils/mixerConnections/StuderMixerConnection.ts b/server/utils/mixerConnections/StuderMixerConnection.ts index bf4d50fd..fbf17cd1 100644 --- a/server/utils/mixerConnections/StuderMixerConnection.ts +++ b/server/utils/mixerConnections/StuderMixerConnection.ts @@ -111,9 +111,9 @@ export class StuderMixerConnection { this.emberConnection.subscribe(node, () => { logger.verbose('Receiving Level from Ch ' + String(ch)) if ( - !state.channels[0].chConnection[this.mixerIndex] + !state.channels[0].chMixerConnection[this.mixerIndex] .channel[ch - 1].fadeActive && - !state.channels[0].chConnection[this.mixerIndex] + !state.channels[0].chMixerConnection[this.mixerIndex] .channel[ch - 1].fadeActive && node.contents.value > this.mixerProtocol.channelTypes[typeIndex].fromMixer @@ -202,11 +202,13 @@ export class StuderMixerConnection { let levelMessage: string let channelVal: number let channelType = - state.channels[0].chConnection[this.mixerIndex].channel[channel - 1] - .channelType + state.channels[0].chMixerConnection[this.mixerIndex].channel[ + channel - 1 + ].channelType let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[channel - 1] - .channelTypeIndex + state.channels[0].chMixerConnection[this.mixerIndex].channel[ + channel - 1 + ].channelTypeIndex if (channel < 25) { levelMessage = this.mixerProtocol.channelTypes[channelType].toMixer @@ -262,11 +264,11 @@ export class StuderMixerConnection { updateOutLevel(channelIndex: number) { let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelTypeIndex let outputlevel = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].outputLevel let level = 20 * Math.log((1.3 * outputlevel) / 0.775) @@ -280,7 +282,7 @@ export class StuderMixerConnection { updateFadeIOLevel(channelIndex: number, outputLevel: number) { let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelTypeIndex let level = 20 * Math.log((1.3 * outputLevel) / 0.775) @@ -294,11 +296,11 @@ export class StuderMixerConnection { updatePflState(channelIndex: number) { let channelType = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelType let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelTypeIndex @@ -349,11 +351,11 @@ export class StuderMixerConnection { updateChannelName(channelIndex: number) { let channelType = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelType let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelTypeIndex let channelName = state.faders[0].fader[channelIndex].label diff --git a/server/utils/mixerConnections/StuderVistaMixerConnection.ts b/server/utils/mixerConnections/StuderVistaMixerConnection.ts index fa755d3d..1c0d426f 100644 --- a/server/utils/mixerConnections/StuderVistaMixerConnection.ts +++ b/server/utils/mixerConnections/StuderVistaMixerConnection.ts @@ -128,7 +128,7 @@ export class StuderVistaMixerConnection { findChannelInArray(channelType: number, channelTypeIndex: number): number { let channelArrayIndex = 0 - state.channels[0].chConnection[this.mixerIndex].channel.forEach( + state.channels[0].chMixerConnection[this.mixerIndex].channel.forEach( (channel: IChannel, index: number) => { if ( channel.channelType === channelType && @@ -186,12 +186,12 @@ export class StuderVistaMixerConnection { channelTypeIndex ) let assignedFader = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelArrayIndex ].assignedFader if ( - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelArrayIndex ].fadeActive ) { @@ -204,15 +204,15 @@ export class StuderVistaMixerConnection { state.faders[0].fader[assignedFader].voOn ) { store.dispatch(storeFaderLevel(assignedFader, value)) - state.channels[0].chConnection[this.mixerIndex].channel.forEach( - (item, index) => { - if (item.assignedFader === assignedFader) { - store.dispatch( - storeSetOutputLevel(this.mixerIndex, index, value) - ) - } + state.channels[0].chMixerConnection[ + this.mixerIndex + ].channel.forEach((item, index) => { + if (item.assignedFader === assignedFader) { + store.dispatch( + storeSetOutputLevel(this.mixerIndex, index, value) + ) } - ) + }) if (!state.faders[0].fader[assignedFader].pgmOn) { if (value > 0) { store.dispatch(storeTogglePgm(assignedFader)) @@ -279,7 +279,7 @@ export class StuderVistaMixerConnection { // Update store: let assignedFader = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ this.findChannelInArray(channelType, channelTypeIndex) ].assignedFader @@ -372,35 +372,33 @@ export class StuderVistaMixerConnection { pingChannel(mixerMessage: string) { state.faders[0].fader.forEach((fader: IFader, index: number) => { - state.channels[0].chConnection[this.mixerIndex].channel.forEach( - (channel: IChannel) => { - if (channel.assignedFader === index) { - let message = mixerMessage - .replace( - '{ch-type}', - (channel.channelType + 1 + 160).toString(16) - ) - .replace( - '{channel}', - (channel.channelTypeIndex + 1 + 160).toString( - 16 - ) - ) - if (message.includes('{aux}')) { - this.pingAuxSend(message) - } else { - let hexArray = message.split(' ') - let buf = Buffer.from( - hexArray.map((val: string) => { - return parseInt(val, 16) - }) - ) - // console.log('Pinging : ', buf) - this.mixerConnection.write(buf) - } + state.channels[0].chMixerConnection[ + this.mixerIndex + ].channel.forEach((channel: IChannel) => { + if (channel.assignedFader === index) { + let message = mixerMessage + .replace( + '{ch-type}', + (channel.channelType + 1 + 160).toString(16) + ) + .replace( + '{channel}', + (channel.channelTypeIndex + 1 + 160).toString(16) + ) + if (message.includes('{aux}')) { + this.pingAuxSend(message) + } else { + let hexArray = message.split(' ') + let buf = Buffer.from( + hexArray.map((val: string) => { + return parseInt(val, 16) + }) + ) + // console.log('Pinging : ', buf) + this.mixerConnection.write(buf) } } - ) + }) }) } @@ -432,8 +430,9 @@ export class StuderVistaMixerConnection { ) { let channelVal: number let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[channel - 1] - .channelTypeIndex + state.channels[0].chMixerConnection[this.mixerIndex].channel[ + channel - 1 + ].channelTypeIndex channelVal = 160 + channelTypeIndex + 1 @@ -477,11 +476,13 @@ export class StuderVistaMixerConnection { let levelMessage: string let channelVal: number let channelType = - state.channels[0].chConnection[this.mixerIndex].channel[channel - 1] - .channelType + state.channels[0].chMixerConnection[this.mixerIndex].channel[ + channel - 1 + ].channelType let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[channel - 1] - .channelTypeIndex + state.channels[0].chMixerConnection[this.mixerIndex].channel[ + channel - 1 + ].channelTypeIndex levelMessage = this.mixerProtocol.channelTypes[channelType].toMixer .CHANNEL_OUT_GAIN[0].mixerMessage @@ -525,7 +526,7 @@ export class StuderVistaMixerConnection { updateOutLevel(channelIndex: number) { let outputlevel = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].outputLevel let level = 40 * Math.log(1.295 * outputlevel) @@ -553,11 +554,11 @@ export class StuderVistaMixerConnection { updateMuteState(channelIndex: number, muteOn: boolean) { let channelType = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelType let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelTypeIndex if (muteOn === true) { @@ -599,11 +600,11 @@ export class StuderVistaMixerConnection { } updateAuxLevel(channelIndex: number, auxSendIndex: number, level: number) { let channelType = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelType let channel = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelTypeIndex + 1 let auxSendCmd = this.mixerProtocol.channelTypes[channelType].toMixer diff --git a/server/utils/mixerConnections/YamahaQlClConnection.ts b/server/utils/mixerConnections/YamahaQlClConnection.ts index b4971894..3b9762e0 100644 --- a/server/utils/mixerConnections/YamahaQlClConnection.ts +++ b/server/utils/mixerConnections/YamahaQlClConnection.ts @@ -55,7 +55,7 @@ export class QlClMixerConnection { logger.info('Receiving state of desk', {}) this.mixerProtocol.initializeCommands.map((item) => { if (item.mixerMessage.includes('{channel}')) { - state.channels[0].chConnection[ + state.channels[0].chMixerConnection[ this.mixerIndex ].channel.forEach((channel: any, index: any) => { this.sendOutMessage( @@ -107,7 +107,7 @@ export class QlClMixerConnection { let ch = parseInt(mixerValues[3]) let assignedFader = 1 + - state.channels[0].chConnection[this.mixerIndex] + state.channels[0].chMixerConnection[this.mixerIndex] .channel[ch - 1].assignedFader let mixerValue = parseInt(mixerValues[6]) sendVuLevel( @@ -126,15 +126,16 @@ export class QlClMixerConnection { let ch = 1 + (message[11] | (message[10] << 8)) let assignedFader = 1 + - state.channels[0].chConnection[this.mixerIndex] + state.channels[0].chMixerConnection[this.mixerIndex] .channel[ch - 1].assignedFader let mixerLevel: number = message[16] | (message[15] << 8) // parseFloat(message[16]) let faderLevel = Math.pow(2, mixerLevel / 1920) - 1 //let faderLevel = Math.log10((mixerLevel + 32768) / (1000 + 32768)) if ( - !state.channels[0].chConnection[this.mixerIndex] - .channel[ch - 1].fadeActive && + !state.channels[0].chMixerConnection[ + this.mixerIndex + ].channel[ch - 1].fadeActive && faderLevel > this.mixerProtocol.fader.min ) { store.dispatch( @@ -157,7 +158,7 @@ export class QlClMixerConnection { if ( state.faders[0].fader[assignedFader - 1].pgmOn ) { - state.channels[0].chConnection[ + state.channels[0].chMixerConnection[ this.mixerIndex ].channel.forEach( (channel: any, index: number) => { @@ -193,7 +194,7 @@ export class QlClMixerConnection { ) let assignedFaderIndex = - state.channels[0].chConnection[this.mixerIndex] + state.channels[0].chMixerConnection[this.mixerIndex] .channel[channelIndex].assignedFader store.dispatch(storeSetMute(assignedFaderIndex, value)) @@ -204,7 +205,7 @@ export class QlClMixerConnection { value ? 1 : 0 ) } - state.channels[0].chConnection[ + state.channels[0].chMixerConnection[ this.mixerIndex ].channel.forEach((channel: any, index: number) => { if ( @@ -304,15 +305,15 @@ export class QlClMixerConnection { updateOutLevel(channelIndex: number) { let channelType = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelType let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelTypeIndex let faderIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].assignedFader if (state.faders[0].fader[faderIndex].pgmOn) { @@ -328,7 +329,7 @@ export class QlClMixerConnection { this.mixerProtocol.channelTypes[channelType].toMixer .CHANNEL_OUT_GAIN[0].mixerMessage, channelTypeIndex, - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].outputLevel, 'f' @@ -337,11 +338,11 @@ export class QlClMixerConnection { updatePflState(channelIndex: number) { let channelType = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelType let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelTypeIndex if (state.faders[0].fader[channelIndex].pflOn === true) { @@ -369,11 +370,11 @@ export class QlClMixerConnection { updateMuteState(channelIndex: number, muteOn: boolean) { let channelType = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelType let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelTypeIndex if (muteOn === true) { @@ -415,11 +416,11 @@ export class QlClMixerConnection { updateFadeIOLevel(channelIndex: number, outputLevel: number) { let channelType = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelType let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelTypeIndex this.sendOutMessage( @@ -433,11 +434,11 @@ export class QlClMixerConnection { updateChannelName(channelIndex: number) { let channelType = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelType let channelTypeIndex = - state.channels[0].chConnection[this.mixerIndex].channel[ + state.channels[0].chMixerConnection[this.mixerIndex].channel[ channelIndex ].channelTypeIndex let channelName = state.faders[0].fader[channelIndex].label diff --git a/server/utils/mixerConnections/productSpecific/midas.ts b/server/utils/mixerConnections/productSpecific/midas.ts index 96385c64..e0160dee 100644 --- a/server/utils/mixerConnections/productSpecific/midas.ts +++ b/server/utils/mixerConnections/productSpecific/midas.ts @@ -13,7 +13,8 @@ export const midasMeter = (mixerIndex: number, message: any) => { for (let i = 0; i < numberOfChannels; i++) { assignedFader = - state.channels[0].chConnection[mixerIndex].channel[i].assignedFader + state.channels[0].chMixerConnection[mixerIndex].channel[i] + .assignedFader if (assignedFader < state.settings[0].numberOfFaders) { level = dataview.getFloat32(4 * i + DATA_OFFSET, true) reductionLevel = dataview.getFloat32( diff --git a/server/utils/remoteConnections/SkaarhojRemoteConnection.ts b/server/utils/remoteConnections/SkaarhojRemoteConnection.ts index c2d2d8b0..c1f55768 100644 --- a/server/utils/remoteConnections/SkaarhojRemoteConnection.ts +++ b/server/utils/remoteConnections/SkaarhojRemoteConnection.ts @@ -145,20 +145,22 @@ export class SkaarhojRemoteConnection { } let chIndex = 0 let btnIndex = 1 - state.channels[0].chConnection[0].channel.forEach((ch: any, index) => { - if (ch.auxLevel[auxSendIndex] >= 0) { - if (btnIndex === auxBtnNumber) { - chIndex = index - btnIndex++ - } else if (btnIndex < auxBtnNumber) { - btnIndex++ + state.channels[0].chMixerConnection[0].channel.forEach( + (ch: any, index) => { + if (ch.auxLevel[auxSendIndex] >= 0) { + if (btnIndex === auxBtnNumber) { + chIndex = index + btnIndex++ + } else if (btnIndex < auxBtnNumber) { + btnIndex++ + } } } - }) + ) let event = command.slice(command.indexOf('=') + 1) let level = - state.channels[0].chConnection[0].channel[chIndex].auxLevel[ + state.channels[0].chMixerConnection[0].channel[chIndex].auxLevel[ auxSendIndex ] if (event === 'Enc:1') { @@ -230,7 +232,7 @@ export class SkaarhojRemoteConnection { return } let hwButton = panelNumber * 10 + 70 + 1 - state.channels[0].chConnection[0].channel.forEach( + state.channels[0].chMixerConnection[0].channel.forEach( (ch: any, index: number) => { if ( ch.auxLevel[auxSendIndex] >= 0 &&