From 33400f36899e95ab9d5f96dbc43f49269f2be369 Mon Sep 17 00:00:00 2001 From: olzzon Date: Thu, 27 Jun 2019 13:59:59 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20moved=20channelTypes=20to=20IMixerProtoc?= =?UTF-8?q?olGeneric=20as=20it=C2=B4s=20need=20when=20initialising=20the?= =?UTF-8?q?=20App=20for=20total=20number=20of=20channels=20chore:=20Added?= =?UTF-8?q?=20empty=20channelTypes=20in=20CasparCG=20for=20now.=20fix:=20n?= =?UTF-8?q?umber=20of=20channels=20is=20based=20on=20totalNumber=20of=20ch?= =?UTF-8?q?annels=20in=20channelTypes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/App.tsx | 9 +++++- src/constants/MixerProtocolPresets.ts | 4 +-- .../mixerProtocols/casparCGMaster.ts | 32 ++++++++++++++++++- 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/src/components/App.tsx b/src/components/App.tsx index c6af6ea6..6991e56f 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -11,6 +11,8 @@ import { loadSnapshotState, saveSnapshotState } from '../utils/SettingsStorage'; import { MixerGenericConnection } from '../utils/MixerConnection'; import { AutomationConnection } from '../utils/AutomationConnection'; import { HuiMidiRemoteConnection } from '../utils/HuiMidiRemoteConnection'; +import { MixerProtocolPresets } from '../constants/MixerProtocolPresets'; + import { Store, AnyAction } from 'redux'; import { ISettings } from '../reducers/settingsReducer'; import { IChannels } from '../reducers/channelsReducer'; @@ -30,7 +32,12 @@ class App extends React.Component { (window as any).automationConnection = new AutomationConnection(); (window as any).huiRemoteConnection = new HuiMidiRemoteConnection(); this.snapShopStoreTimer(); - loadSnapshotState(this.props.store.channels[0], this.props.store.settings[0].numberOfChannelsInType[0]); + let totalNumberOfChannels = 0; + let selectedProtocol = MixerProtocolPresets[this.props.store.settings[0].mixerProtocol]; + selectedProtocol.channelTypes.forEach((item, index) => { + totalNumberOfChannels =+ this.props.store.settings[0].numberOfChannelsInType[index]; + }); + loadSnapshotState(this.props.store.channels[0], totalNumberOfChannels); } public shouldComponentUpdate(nextProps: IAppProps) { diff --git a/src/constants/MixerProtocolPresets.ts b/src/constants/MixerProtocolPresets.ts index 55eadd07..abf3a739 100644 --- a/src/constants/MixerProtocolPresets.ts +++ b/src/constants/MixerProtocolPresets.ts @@ -22,7 +22,8 @@ export interface IMixerProtocolGeneric { max: number, zero: number, test: number, - } + }, + channelTypes: Array } export interface IMixerProtocol extends IMixerProtocolGeneric{ @@ -30,7 +31,6 @@ export interface IMixerProtocol extends IMixerProtocolGeneric{ pingCommand: Array, pingTime: number, initializeCommands: Array, - channelTypes: Array } export interface IChannelTypes { diff --git a/src/constants/mixerProtocols/casparCGMaster.ts b/src/constants/mixerProtocols/casparCGMaster.ts index fb5d2450..c4adbe73 100644 --- a/src/constants/mixerProtocols/casparCGMaster.ts +++ b/src/constants/mixerProtocols/casparCGMaster.ts @@ -44,7 +44,37 @@ if (geometry) { test: 0.6, }, channelLabels: geometry.channelLabels, - sourceOptions: geometry.sourceOptions + sourceOptions: geometry.sourceOptions, + //CHANNELTYES ARE NOT IMPLEMENTED. + //THIS IS JUST TO AVOID ERRORS AS + //channelTypes are moved to IMixerProtocolGeneric + channelTypes: [{ + channelTypeName: 'Channels', + channelTypeColor: '#2f2f2f', + fromMixer: { + CHANNEL_FADER_LEVEL: ['none'], + CHANNEL_OUT_GAIN: ['none'], + CHANNEL_VU: ['none'], + CHANNEL_NAME: 'none', + PFL: ['todo'], + AUX_SEND: ['none'], + }, + toMixer: { + CHANNEL_FADER_LEVEL: ['none'], + CHANNEL_OUT_GAIN: ['none'], + PFL_ON: [{ + mixerMessage: "none", + value: 1, + type: "i" + }], + PFL_OFF: [{ + mixerMessage: "none", + value: 0, + type: "i" + }], + AUX_SEND: ['none'], + }, + }] } }