From ae04cc39b113a6909c7eb40cf4d20f3f97d38b3c Mon Sep 17 00:00:00 2001 From: Peter C <12292660+PeterC89@users.noreply.github.com> Date: Sun, 11 Feb 2024 20:58:12 +0000 Subject: [PATCH 01/15] feat: Input gain and selector control via automation --- server/src/utils/AutomationConnection.ts | 58 +++++++++++++++++++++++ shared/src/constants/AutomationPresets.ts | 12 +++++ 2 files changed, 70 insertions(+) diff --git a/server/src/utils/AutomationConnection.ts b/server/src/utils/AutomationConnection.ts index 9c0831d6..f0523584 100644 --- a/server/src/utils/AutomationConnection.ts +++ b/server/src/utils/AutomationConnection.ts @@ -181,6 +181,38 @@ export class AutomationConnection { } global.mainThreadHandler.updatePartialStore(ch - 1) }) + } else if (check('CHANNEL_INPUT_GAIN')) { + wrapChannelCommand((ch: any) => { + store.dispatch({ + type: FaderActionTypes.SET_INPUT_GAIN, + faderIndex: ch - 1, + level: message.args[0], + }) + if (message.args.length > 1) { + mixerGenericConnection.updateInputGain( + ch - 1, + ) + } else { + mixerGenericConnection.updateInputGain(ch - 1) + } + global.mainThreadHandler.updatePartialStore(ch - 1) + }) + } else if (check('CHANNEL_INPUT_SELECTOR')) { + wrapChannelCommand((ch: any) => { + store.dispatch({ + type: FaderActionTypes.SET_INPUT_SELECTOR, + faderIndex: ch - 1, + selected: message.args[0], + }) + if (message.args.length > 1) { + mixerGenericConnection.updateInputSelector( + ch - 1, + ) + } else { + mixerGenericConnection.updateInputSelector(ch - 1) + } + global.mainThreadHandler.updatePartialStore(ch - 1) + }) } else if (check('INJECT_COMMAND')) { wrapChannelCommand((ch: any) => { store.dispatch({ @@ -245,6 +277,8 @@ export class AutomationConnection { voOn, pstOn, showChannel, + inputGain, + inputSelector, }: Fader, index ) => ({ @@ -253,6 +287,8 @@ export class AutomationConnection { voOn, pstOn, showChannel, + inputGain, + inputSelector, label: getFaderLabel(index), }) ), @@ -301,6 +337,28 @@ export class AutomationConnection { info ) }) + } else if (check('STATE_CHANNEL_INPUT_GAIN')) { + wrapChannelCommand((ch) => { + this.sendOutMessage( + this.automationProtocol.toAutomation + .STATE_CHANNEL_INPUT_GAIN, + ch, + state.faders[0].fader[ch - 1].inputGain, + 'f', + info + ) + }) + } else if (check('STATE_CHANNEL_INPUT_SELECTOR')) { + wrapChannelCommand((ch) => { + this.sendOutMessage( + this.automationProtocol.toAutomation + .STATE_CHANNEL_INPUT_SELECTOR, + ch, + state.faders[0].fader[ch - 1].inputSelector, + 'i', + info + ) + }) } else if (check('PING')) { let pingValue = state.settings[0].mixers[0].mixerOnline ? message.address.split('/')[2] diff --git a/shared/src/constants/AutomationPresets.ts b/shared/src/constants/AutomationPresets.ts index e680c4be..22170b49 100644 --- a/shared/src/constants/AutomationPresets.ts +++ b/shared/src/constants/AutomationPresets.ts @@ -18,6 +18,8 @@ export interface AutomationProtocol { CHANNEL_PGM_ON_OFF: string CHANNEL_PST_ON_OFF: string CHANNEL_FADER_LEVEL: string + CHANNEL_INPUT_GAIN: string + CHANNEL_INPUT_SELECTOR: string INJECT_COMMAND: string CHANNEL_VISIBLE: string CHANNEL_MUTE: string @@ -29,6 +31,8 @@ export interface AutomationProtocol { STATE_CHANNEL_PGM: string STATE_CHANNEL_PST: string STATE_CHANNEL_FADER_LEVEL: string + STATE_CHANNEL_INPUT_GAIN: string + STATE_CHANNEL_INPUT_SELECTOR: string STATE_CHANNEL_MUTE: string STATE_FULL: string PING: string @@ -37,6 +41,8 @@ export interface AutomationProtocol { STATE_CHANNEL_PGM: string STATE_CHANNEL_PST: string STATE_CHANNEL_FADER_LEVEL: string + STATE_CHANNEL_INPUT_GAIN: string + STATE_CHANNEL_INPUT_SELECTOR: string STATE_CHANNEL_MUTE: string STATE_FULL: string PONG: string @@ -72,6 +78,8 @@ export const AutomationPresets: { [key: string]: AutomationProtocol } = { CHANNEL_PGM_ON_OFF: '/ch/{value1}/pgm', CHANNEL_PST_ON_OFF: '/ch/{value1}/pst', CHANNEL_FADER_LEVEL: '/ch/{value1}/faderlevel', + CHANNEL_INPUT_GAIN: '/ch/{value1}/inputgain', + CHANNEL_INPUT_SELECTOR: '/ch/{value1}/inputselector', CHANNEL_VISIBLE: '/ch/{value1}/visible', CHANNEL_MUTE: '/ch/{value1}/mute', X_MIX: '/take', @@ -83,6 +91,8 @@ export const AutomationPresets: { [key: string]: AutomationProtocol } = { STATE_CHANNEL_PGM: '/state/ch/{value1}/pgm', STATE_CHANNEL_PST: '/state/ch/{value1}/pst', STATE_CHANNEL_FADER_LEVEL: '/state/ch/{value1}/faderlevel', + STATE_CHANNEL_INPUT_GAIN: '/state/ch/{value1}/inputgain', + STATE_CHANNEL_INPUT_SELECTOR: '/state/ch/{value1}/inputselector', STATE_CHANNEL_MUTE: '/state/ch/{value1}/mute', STATE_FULL: '/state/full', PING: '/ping/{value1}', @@ -91,6 +101,8 @@ export const AutomationPresets: { [key: string]: AutomationProtocol } = { STATE_CHANNEL_PGM: '/state/ch/{value1}/pgm', STATE_CHANNEL_PST: '/state/ch/{value1}/pst', STATE_CHANNEL_FADER_LEVEL: '/state/ch/{value1}/faderlevel', + STATE_CHANNEL_INPUT_GAIN: '/state/ch/{value1}/inputgain', + STATE_CHANNEL_INPUT_SELECTOR: '/state/ch/{value1}/inputselector', STATE_CHANNEL_MUTE: '/state/ch/{value1}/mute', STATE_FULL: '/state/full', PONG: '/pong', From 74f6706c3020aae15ad85f415ee4d52916930065 Mon Sep 17 00:00:00 2001 From: olzzon Date: Wed, 13 Mar 2024 12:39:35 +0100 Subject: [PATCH 02/15] wip: automation enhancements - comment out inject command as it's currently not implemented. --- server/src/utils/AutomationConnection.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/src/utils/AutomationConnection.ts b/server/src/utils/AutomationConnection.ts index 9c0831d6..f107f4d6 100644 --- a/server/src/utils/AutomationConnection.ts +++ b/server/src/utils/AutomationConnection.ts @@ -182,6 +182,9 @@ export class AutomationConnection { global.mainThreadHandler.updatePartialStore(ch - 1) }) } else if (check('INJECT_COMMAND')) { + /* + The INJECT COMMAND is not implemented + It's planned for injecting commands directly from Sisyfos into the Audiomixer. wrapChannelCommand((ch: any) => { store.dispatch({ type: FaderActionTypes.SET_FADER_LABEL, @@ -190,6 +193,7 @@ export class AutomationConnection { }) mixerGenericConnection.injectCommand(message.args) }) + */ } else if (check('SNAP_RECALL')) { let snapNumber = message.address.split('/')[2] store.dispatch({ From 97bc197462e038c55f0be81a3dd5f7c810d1ff01 Mon Sep 17 00:00:00 2001 From: olzzon Date: Thu, 14 Mar 2024 16:04:09 +0100 Subject: [PATCH 03/15] feat: Get Full state from fader --- README.md | 4 ++ server/src/utils/AutomationConnection.ts | 59 +++++++++++++++-------- shared/src/constants/AutomationPresets.ts | 4 ++ 3 files changed, 48 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 43d1e513..6d51f7dc 100644 --- a/README.md +++ b/README.md @@ -258,6 +258,10 @@ Pass a command directly from Automation to Audiomixer /state/full - returns a json string with an array of channels: { pgmOn: boolean, pstOn: boolean, faderLevel: boolean } +#### Get full state of one fader: + +/state/ch/1/full - returns a json string with fader 1 settings: { pgmOn: boolean, pstOn: boolean, faderLevel: boolean } + #### Get state channel PGM: /state/ch/1/mix/pgm - returns pgm state integer { 0 or 1 } diff --git a/server/src/utils/AutomationConnection.ts b/server/src/utils/AutomationConnection.ts index f107f4d6..5fee6a97 100644 --- a/server/src/utils/AutomationConnection.ts +++ b/server/src/utils/AutomationConnection.ts @@ -37,12 +37,12 @@ export class AutomationConnection { const messageHandler = ( message: any, timetag: number | undefined, - info: any + info: any, ) => { const check = (key: keyof AutomationProtocol['fromAutomation']) => this.checkOscCommand( message.address, - this.automationProtocol.fromAutomation[key] + this.automationProtocol.fromAutomation[key], ) const wrapChannelCommand = (fn: (ch: any) => void) => { let ch: number @@ -55,14 +55,14 @@ export class AutomationConnection { .find( (f) => f.userLabel === chMessage || - f.label === chMessage + f.label === chMessage, ) const channel = state.channels[0].chMixerConnection .map((conn) => conn.channel.map((ch) => ({ assignedFader: ch.assignedFader, label: ch.label, - })) + })), ) .map((m) => m.find((ch) => ch.label === chMessage)) .find((m) => m) @@ -73,7 +73,7 @@ export class AutomationConnection { ch = channel.assignedFader + 1 } else { logger.error( - `Could not find fader with label: ${chMessage}` + `Could not find fader with label: ${chMessage}`, ) return } @@ -99,7 +99,7 @@ export class AutomationConnection { wrapChannelCommand((ch: any) => { if (message.args[0] === 1) { mixerGenericConnection.checkForAutoResetThreshold( - ch - 1 + ch - 1, ) store.dispatch({ type: FaderActionTypes.SET_PGM, @@ -108,7 +108,7 @@ export class AutomationConnection { }) } else if (message.args[0] === 2) { mixerGenericConnection.checkForAutoResetThreshold( - ch - 1 + ch - 1, ) store.dispatch({ type: FaderActionTypes.SET_VO, @@ -126,7 +126,7 @@ export class AutomationConnection { if (message.args.length > 1) { mixerGenericConnection.updateOutLevel( ch - 1, - parseFloat(message.args[1]) + parseFloat(message.args[1]), ) } else { mixerGenericConnection.updateOutLevel(ch - 1, -1) @@ -174,7 +174,7 @@ export class AutomationConnection { if (message.args.length > 1) { mixerGenericConnection.updateOutLevel( ch - 1, - parseFloat(message.args[1]) + parseFloat(message.args[1]), ) } else { mixerGenericConnection.updateOutLevel(ch - 1, -1) @@ -250,7 +250,7 @@ export class AutomationConnection { pstOn, showChannel, }: Fader, - index + index, ) => ({ faderLevel, pgmOn, @@ -258,12 +258,33 @@ export class AutomationConnection { pstOn, showChannel, label: getFaderLabel(index), - }) + }), ), }), 's', - info + info, ) + } else if (check('STATE_CHANNEL_FULL')) { + wrapChannelCommand((ch: any) => { + // Return state of fader to automation: + const currentFader = state.faders[0].fader[ch - 1] + this.sendOutMessage( + this.automationProtocol.toAutomation.STATE_FULL, + ch, + JSON.stringify({ + channel: { + faderLevel: currentFader.faderLevel, + pgmOn: currentFader.pgmOn, + currentFader: currentFader.voOn, + pstOn: currentFader.pstOn, + showChannel: currentFader.showChannel, + label: getFaderLabel(ch - 1), + }, + }), + 's', + info, + ) + }) } else if (check('STATE_CHANNEL_PGM')) { wrapChannelCommand((ch: any) => { this.sendOutMessage( @@ -271,7 +292,7 @@ export class AutomationConnection { ch, state.faders[0].fader[ch - 1].pgmOn, 'i', - info + info, ) }) } else if (check('STATE_CHANNEL_PST')) { @@ -281,7 +302,7 @@ export class AutomationConnection { ch, state.faders[0].fader[ch - 1].pstOn, 'i', - info + info, ) }) } else if (check('STATE_CHANNEL_MUTE')) { @@ -291,7 +312,7 @@ export class AutomationConnection { ch, state.faders[0].fader[ch - 1].muteOn, 'i', - info + info, ) }) } else if (check('STATE_CHANNEL_FADER_LEVEL')) { @@ -302,7 +323,7 @@ export class AutomationConnection { ch, state.faders[0].fader[ch - 1].faderLevel, 'f', - info + info, ) }) } else if (check('PING')) { @@ -315,7 +336,7 @@ export class AutomationConnection { 0, pingValue, 's', - info + info, ) } } @@ -358,7 +379,7 @@ export class AutomationConnection { channel: number, value: string | number | boolean, type: string, - to: { address: string; port: number } + to: { address: string; port: number }, ) { let channelString = this.automationProtocol.leadingZeros ? ('0' + channel).slice(-2) @@ -376,7 +397,7 @@ export class AutomationConnection { ], }, to.address, - to.port + to.port, ) } } diff --git a/shared/src/constants/AutomationPresets.ts b/shared/src/constants/AutomationPresets.ts index e680c4be..a042db35 100644 --- a/shared/src/constants/AutomationPresets.ts +++ b/shared/src/constants/AutomationPresets.ts @@ -31,6 +31,7 @@ export interface AutomationProtocol { STATE_CHANNEL_FADER_LEVEL: string STATE_CHANNEL_MUTE: string STATE_FULL: string + STATE_CHANNEL_FULL: string PING: string } toAutomation: { @@ -39,6 +40,7 @@ export interface AutomationProtocol { STATE_CHANNEL_FADER_LEVEL: string STATE_CHANNEL_MUTE: string STATE_FULL: string + STATE_CHANNEL_FULL: string PONG: string } fader: { @@ -85,6 +87,7 @@ export const AutomationPresets: { [key: string]: AutomationProtocol } = { STATE_CHANNEL_FADER_LEVEL: '/state/ch/{value1}/faderlevel', STATE_CHANNEL_MUTE: '/state/ch/{value1}/mute', STATE_FULL: '/state/full', + STATE_CHANNEL_FULL: '/state/ch/{value1}/full', PING: '/ping/{value1}', }, toAutomation: { @@ -93,6 +96,7 @@ export const AutomationPresets: { [key: string]: AutomationProtocol } = { STATE_CHANNEL_FADER_LEVEL: '/state/ch/{value1}/faderlevel', STATE_CHANNEL_MUTE: '/state/ch/{value1}/mute', STATE_FULL: '/state/full', + STATE_CHANNEL_FULL: '/state/ch/{value1}/full', PONG: '/pong', }, fader: { From 48980ed3383bfab8e47ff247596a3fb6ef229a5e Mon Sep 17 00:00:00 2001 From: olzzon Date: Thu, 14 Mar 2024 17:45:19 +0100 Subject: [PATCH 04/15] fix: change automation state commands so formatting fits with rest of the commands --- README.md | 16 ++++++++-------- shared/src/constants/AutomationPresets.ts | 20 ++++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 6d51f7dc..3a5ba985 100644 --- a/README.md +++ b/README.md @@ -260,35 +260,35 @@ Pass a command directly from Automation to Audiomixer #### Get full state of one fader: -/state/ch/1/full - returns a json string with fader 1 settings: { pgmOn: boolean, pstOn: boolean, faderLevel: boolean } +/ch/1/full/state - returns a json string with fader 1 settings: { pgmOn: boolean, pstOn: boolean, faderLevel: boolean } #### Get state channel PGM: -/state/ch/1/mix/pgm - returns pgm state integer { 0 or 1 } +/ch/1/mix/pgm/state - returns pgm state integer { 0 or 1 } #### get state channel PST: -/state/ch/1/mix/pst - returns pgm state integer { 0 or 1 } +/ch/1/mix/pst/state - returns pgm state integer { 0 or 1 } #### Get state channel faderlevel: -/state/ch/1/mix/faderlevel - float {between 0 and 1} +/ch/1/mix/faderlevel/state - float {between 0 and 1} #### get state channel Mute: -/state/ch/1/mute - returns mute state integer { 0 or 1 } +/ch/1/mute/state - returns mute state integer { 0 or 1 } #### Get state group PGM: -/state/ch/1/mix/pgm - returns pgm state integer { 0 or 1 } +/ch/1/mix/pgm/state - returns pgm state integer { 0 or 1 } #### get state group PST: -/state/ch/1/mix/pst - returns pgm state integer { 0 or 1 } +/ch/1/mix/pst/state - returns pgm state integer { 0 or 1 } #### Get state group faderlevel: -/state/ch/1/mix/faderlevel - float {between 0 and 1} +/ch/1/mix/faderlevel/state - returns float {between 0 and 1} ## Check connectivity diff --git a/shared/src/constants/AutomationPresets.ts b/shared/src/constants/AutomationPresets.ts index a042db35..78737e6c 100644 --- a/shared/src/constants/AutomationPresets.ts +++ b/shared/src/constants/AutomationPresets.ts @@ -82,21 +82,21 @@ export const AutomationPresets: { [key: string]: AutomationProtocol } = { FADE_TO_BLACK: '/fadetoblack', CLEAR_PST: '/clearpst', SNAP_RECALL: '/snap/{value1}', - STATE_CHANNEL_PGM: '/state/ch/{value1}/pgm', - STATE_CHANNEL_PST: '/state/ch/{value1}/pst', - STATE_CHANNEL_FADER_LEVEL: '/state/ch/{value1}/faderlevel', - STATE_CHANNEL_MUTE: '/state/ch/{value1}/mute', + STATE_CHANNEL_PGM: '/ch/{value1}/pgm/state', + STATE_CHANNEL_PST: '/ch/{value1}/pst/state', + STATE_CHANNEL_FADER_LEVEL: '/ch/{value1}/faderlevel/state', + STATE_CHANNEL_MUTE: '/ch/{value1}/mute/state', STATE_FULL: '/state/full', - STATE_CHANNEL_FULL: '/state/ch/{value1}/full', + STATE_CHANNEL_FULL: '/ch/{value1}/full/state', PING: '/ping/{value1}', }, toAutomation: { - STATE_CHANNEL_PGM: '/state/ch/{value1}/pgm', - STATE_CHANNEL_PST: '/state/ch/{value1}/pst', - STATE_CHANNEL_FADER_LEVEL: '/state/ch/{value1}/faderlevel', - STATE_CHANNEL_MUTE: '/state/ch/{value1}/mute', + STATE_CHANNEL_PGM: '/ch/{value1}/pgm/state', + STATE_CHANNEL_PST: '/ch/{value1}/pst/state', + STATE_CHANNEL_FADER_LEVEL: '/ch/{value1}/faderlevel/state', + STATE_CHANNEL_MUTE: '/ch/{value1}/mute/state', STATE_FULL: '/state/full', - STATE_CHANNEL_FULL: '/state/ch/{value1}/full', + STATE_CHANNEL_FULL: '/ch/{value1}/full/state', PONG: '/pong', }, fader: { From 8d4279f41e9268fab21f6abb513198d3119fe721 Mon Sep 17 00:00:00 2001 From: olzzon Date: Thu, 14 Mar 2024 18:47:57 +0100 Subject: [PATCH 05/15] feat: rename to STATE_CHANNEL --- server/src/utils/AutomationConnection.ts | 2 +- shared/src/constants/AutomationPresets.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/server/src/utils/AutomationConnection.ts b/server/src/utils/AutomationConnection.ts index 5fee6a97..3893ed02 100644 --- a/server/src/utils/AutomationConnection.ts +++ b/server/src/utils/AutomationConnection.ts @@ -264,7 +264,7 @@ export class AutomationConnection { 's', info, ) - } else if (check('STATE_CHANNEL_FULL')) { + } else if (check('STATE_CHANNEL')) { wrapChannelCommand((ch: any) => { // Return state of fader to automation: const currentFader = state.faders[0].fader[ch - 1] diff --git a/shared/src/constants/AutomationPresets.ts b/shared/src/constants/AutomationPresets.ts index 78737e6c..4bd62a1c 100644 --- a/shared/src/constants/AutomationPresets.ts +++ b/shared/src/constants/AutomationPresets.ts @@ -31,7 +31,7 @@ export interface AutomationProtocol { STATE_CHANNEL_FADER_LEVEL: string STATE_CHANNEL_MUTE: string STATE_FULL: string - STATE_CHANNEL_FULL: string + STATE_CHANNEL: string PING: string } toAutomation: { @@ -40,7 +40,7 @@ export interface AutomationProtocol { STATE_CHANNEL_FADER_LEVEL: string STATE_CHANNEL_MUTE: string STATE_FULL: string - STATE_CHANNEL_FULL: string + STATE_CHANNEL: string PONG: string } fader: { @@ -87,7 +87,7 @@ export const AutomationPresets: { [key: string]: AutomationProtocol } = { STATE_CHANNEL_FADER_LEVEL: '/ch/{value1}/faderlevel/state', STATE_CHANNEL_MUTE: '/ch/{value1}/mute/state', STATE_FULL: '/state/full', - STATE_CHANNEL_FULL: '/ch/{value1}/full/state', + STATE_CHANNEL: '/ch/{value1}/state', PING: '/ping/{value1}', }, toAutomation: { @@ -96,7 +96,7 @@ export const AutomationPresets: { [key: string]: AutomationProtocol } = { STATE_CHANNEL_FADER_LEVEL: '/ch/{value1}/faderlevel/state', STATE_CHANNEL_MUTE: '/ch/{value1}/mute/state', STATE_FULL: '/state/full', - STATE_CHANNEL_FULL: '/ch/{value1}/full/state', + STATE_CHANNEL: '/ch/{value1}/state', PONG: '/pong', }, fader: { From aa1d28624eda8a60c1ac13400ff617924689b312 Mon Sep 17 00:00:00 2001 From: olzzon Date: Thu, 14 Mar 2024 18:50:17 +0100 Subject: [PATCH 06/15] feat: update readme with ch/xx/state --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3a5ba985..6d7ad1c5 100644 --- a/README.md +++ b/README.md @@ -258,9 +258,9 @@ Pass a command directly from Automation to Audiomixer /state/full - returns a json string with an array of channels: { pgmOn: boolean, pstOn: boolean, faderLevel: boolean } -#### Get full state of one fader: +#### Get all state of one fader: -/ch/1/full/state - returns a json string with fader 1 settings: { pgmOn: boolean, pstOn: boolean, faderLevel: boolean } +/ch/1/state - returns a json string with fader 1 settings: { pgmOn: boolean, pstOn: boolean, faderLevel: boolean } #### Get state channel PGM: From 7494b6543548197a5d4d041c29b4f8d159925184 Mon Sep 17 00:00:00 2001 From: olzzon Date: Fri, 15 Mar 2024 09:17:19 +0100 Subject: [PATCH 07/15] feat: automation state now returns mute, inputGain, inputSelector --- README.md | 17 +++++++++++++++-- server/src/utils/AutomationConnection.ts | 11 ++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6d7ad1c5..79186334 100644 --- a/README.md +++ b/README.md @@ -256,11 +256,24 @@ Pass a command directly from Automation to Audiomixer #### Get full state of all channels: -/state/full - returns a json string with an array of channels: { pgmOn: boolean, pstOn: boolean, faderLevel: boolean } +/state/full - returns a json string with an array of channels with: +``` +channel: { + faderLevel, + pgmOn, + voOn, + pstOn, + showChannel, + label, + mute, + inputGain, + inputSelector +} +``` #### Get all state of one fader: -/ch/1/state - returns a json string with fader 1 settings: { pgmOn: boolean, pstOn: boolean, faderLevel: boolean } +/ch/1/state - returns a json in same format as the full state but only for the channel specified in the path #### Get state channel PGM: diff --git a/server/src/utils/AutomationConnection.ts b/server/src/utils/AutomationConnection.ts index 3893ed02..a5a7abb6 100644 --- a/server/src/utils/AutomationConnection.ts +++ b/server/src/utils/AutomationConnection.ts @@ -249,6 +249,9 @@ export class AutomationConnection { voOn, pstOn, showChannel, + muteOn, + inputGain, + inputSelector, }: Fader, index, ) => ({ @@ -258,6 +261,9 @@ export class AutomationConnection { pstOn, showChannel, label: getFaderLabel(index), + muteOn, + inputGain, + inputSelector, }), ), }), @@ -275,10 +281,13 @@ export class AutomationConnection { channel: { faderLevel: currentFader.faderLevel, pgmOn: currentFader.pgmOn, - currentFader: currentFader.voOn, + voOn: currentFader.voOn, pstOn: currentFader.pstOn, showChannel: currentFader.showChannel, label: getFaderLabel(ch - 1), + mute: currentFader.muteOn, + inputGain: currentFader.inputGain, + inputSelector: currentFader.inputSelector, }, }), 's', From 9a20bc78fea1c5b67a5d1b80b8378054f55be876 Mon Sep 17 00:00:00 2001 From: olzzon Date: Fri, 15 Mar 2024 10:14:16 +0100 Subject: [PATCH 08/15] fix: double inputGain and selector in state/full return --- server/src/utils/AutomationConnection.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/server/src/utils/AutomationConnection.ts b/server/src/utils/AutomationConnection.ts index f24b53a8..2aff9fac 100644 --- a/server/src/utils/AutomationConnection.ts +++ b/server/src/utils/AutomationConnection.ts @@ -296,8 +296,6 @@ export class AutomationConnection { inputSelector, label: getFaderLabel(index), muteOn, - inputGain, - inputSelector, }), ), }), From 353edcee96e7ddff79fc00b0e43f9526d423aab0 Mon Sep 17 00:00:00 2001 From: olzzon Date: Fri, 15 Mar 2024 10:14:45 +0100 Subject: [PATCH 09/15] feat: update readme.md with inputGain and inputSelector commands --- README.md | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 79186334..a8f52c1c 100644 --- a/README.md +++ b/README.md @@ -197,11 +197,11 @@ The monitor sends are the same as those on the Channel Strip. ## Automation Support: -It´s possible to control the Producers-Audio-Mixer from an automationsystem, for it to act as middleware. +It´s possible to control Sisyfos from an automationsystem, for it to act as middleware. ## Set state: -To set the state send these OSC commands from you Automation to ProducersAudioMixer Port: 5255: +To set the state send these OSC commands from you Automation to Sisyfos Port: 5255: #### Set channel to PGM (optional: indiviaul fadetime): @@ -277,31 +277,27 @@ channel: { #### Get state channel PGM: -/ch/1/mix/pgm/state - returns pgm state integer { 0 or 1 } +/ch/1/pgm/state - returns pgm state integer { 0 or 1 } #### get state channel PST: -/ch/1/mix/pst/state - returns pgm state integer { 0 or 1 } +/ch/1/pst/state - returns pgm state integer { 0 or 1 } #### Get state channel faderlevel: -/ch/1/mix/faderlevel/state - float {between 0 and 1} +/ch/1/faderlevel/state - float {between 0 and 1} #### get state channel Mute: /ch/1/mute/state - returns mute state integer { 0 or 1 } -#### Get state group PGM: +#### get state InputGain: -/ch/1/mix/pgm/state - returns pgm state integer { 0 or 1 } +/ch/1/inputgain/state - returns inputgain state float {between 0 and 1} -#### get state group PST: +#### get state InputSelector: -/ch/1/mix/pst/state - returns pgm state integer { 0 or 1 } - -#### Get state group faderlevel: - -/ch/1/mix/faderlevel/state - returns float {between 0 and 1} +/ch/1/inputselector/state - returns inputselector state integer { 0 or 1 } ## Check connectivity From 3fd0d04eeaedd18b7ee1c700ae87ab82f00cf371 Mon Sep 17 00:00:00 2001 From: olzzon Date: Fri, 15 Mar 2024 10:38:57 +0100 Subject: [PATCH 10/15] feat: added Type to Automation API --- README.md | 23 +++++++++--------- server/src/utils/AutomationConnection.ts | 29 ++++++++++++----------- shared/src/constants/AutomationPresets.ts | 12 ++++++++++ 3 files changed, 39 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index a8f52c1c..85fdf44e 100644 --- a/README.md +++ b/README.md @@ -227,11 +227,12 @@ To set the state send these OSC commands from you Automation to Sisyfos Port: 52 /ch/1/label - string {name of channel} -#### Inject Command: +#### Inject Command: (currently not implemented) Pass a command directly from Automation to Audiomixer /inject + #### Crossfade between PGM and PST: /take @@ -258,16 +259,16 @@ Pass a command directly from Automation to Audiomixer /state/full - returns a json string with an array of channels with: ``` -channel: { - faderLevel, - pgmOn, - voOn, - pstOn, - showChannel, - label, - mute, - inputGain, - inputSelector +export interface AutomationChannelAPI { + faderLevel: number + pgmOn: boolean + voOn: boolean + pstOn: boolean + visible: boolean + muteOn: boolean + inputGain: number + inputSelector: number + label: string } ``` diff --git a/server/src/utils/AutomationConnection.ts b/server/src/utils/AutomationConnection.ts index 2aff9fac..79b537fe 100644 --- a/server/src/utils/AutomationConnection.ts +++ b/server/src/utils/AutomationConnection.ts @@ -7,11 +7,11 @@ import { mixerGenericConnection } from '../mainClasses' import { AutomationProtocol, AutomationPresets, + AutomationChannelAPI, } from '../../../shared/src/constants/AutomationPresets' import { Fader } from '../../../shared/src/reducers/fadersReducer' import { FaderActionTypes, - FaderActions, } from '../../../shared/src/actions/faderActions' import { getFaderLabel } from './labels' import { logger } from './logger' @@ -286,12 +286,12 @@ export class AutomationConnection { inputSelector, }: Fader, index, - ) => ({ + ): AutomationChannelAPI => ({ faderLevel, pgmOn, voOn, pstOn, - showChannel, + visible: showChannel, inputGain, inputSelector, label: getFaderLabel(index), @@ -306,21 +306,22 @@ export class AutomationConnection { wrapChannelCommand((ch: any) => { // Return state of fader to automation: const currentFader = state.faders[0].fader[ch - 1] + const channelState: AutomationChannelAPI = { + faderLevel: currentFader.faderLevel, + pgmOn: currentFader.pgmOn, + voOn: currentFader.voOn, + pstOn: currentFader.pstOn, + visible: currentFader.showChannel, + label: getFaderLabel(ch - 1), + muteOn: currentFader.muteOn, + inputGain: currentFader.inputGain, + inputSelector: currentFader.inputSelector, + } this.sendOutMessage( this.automationProtocol.toAutomation.STATE_FULL, ch, JSON.stringify({ - channel: { - faderLevel: currentFader.faderLevel, - pgmOn: currentFader.pgmOn, - voOn: currentFader.voOn, - pstOn: currentFader.pstOn, - showChannel: currentFader.showChannel, - label: getFaderLabel(ch - 1), - mute: currentFader.muteOn, - inputGain: currentFader.inputGain, - inputSelector: currentFader.inputSelector, - }, + channel: channelState, }), 's', info, diff --git a/shared/src/constants/AutomationPresets.ts b/shared/src/constants/AutomationPresets.ts index e7b9143f..022e0681 100644 --- a/shared/src/constants/AutomationPresets.ts +++ b/shared/src/constants/AutomationPresets.ts @@ -63,6 +63,18 @@ export interface AutomationProtocol { } } +export interface AutomationChannelAPI { + faderLevel: number + pgmOn: boolean + voOn: boolean + pstOn: boolean + visible: boolean + muteOn: boolean + inputGain: number + inputSelector: number + label: string +} + export const AutomationPresets: { [key: string]: AutomationProtocol } = { sofie: { protocol: 'OSC', From 5d273c3f94fc68a74e27cdfc7d34faa2c62b9b53 Mon Sep 17 00:00:00 2001 From: olzzon Date: Fri, 15 Mar 2024 11:03:01 +0100 Subject: [PATCH 11/15] feat: SET_CHANNEL_STATE from automation --- server/src/utils/AutomationConnection.ts | 22 +++++++++++++++++++--- shared/src/constants/AutomationPresets.ts | 2 ++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/server/src/utils/AutomationConnection.ts b/server/src/utils/AutomationConnection.ts index 79b537fe..b27e8ff8 100644 --- a/server/src/utils/AutomationConnection.ts +++ b/server/src/utils/AutomationConnection.ts @@ -179,7 +179,6 @@ export class AutomationConnection { } else { mixerGenericConnection.updateOutLevel(ch - 1, -1) } - global.mainThreadHandler.updatePartialStore(ch - 1) }) } else if (check('CHANNEL_INPUT_GAIN')) { wrapChannelCommand((ch: any) => { @@ -195,7 +194,6 @@ export class AutomationConnection { } else { mixerGenericConnection.updateInputGain(ch - 1) } - global.mainThreadHandler.updatePartialStore(ch - 1) }) } else if (check('CHANNEL_INPUT_SELECTOR')) { wrapChannelCommand((ch: any) => { @@ -211,7 +209,25 @@ export class AutomationConnection { } else { mixerGenericConnection.updateInputSelector(ch - 1) } - global.mainThreadHandler.updatePartialStore(ch - 1) + }) + } else if (check('SET_CHANNEL_STATE')) { + wrapChannelCommand((ch: any) => { + const apiState: AutomationChannelAPI = JSON.parse(message.args[0]) + const channelState: Fader = {... state.faders[0].fader[ch - 1], + faderLevel: apiState.faderLevel, + pgmOn: apiState.pgmOn, + voOn: apiState.voOn, + pstOn: apiState.pstOn, + showChannel: apiState.visible, + muteOn: apiState.muteOn, + inputGain: apiState.inputGain, + inputSelector: apiState.inputSelector, + } + store.dispatch({ + type: FaderActionTypes.SET_SINGLE_FADER_STATE, + faderIndex: ch - 1, + state: channelState, + }) }) } else if (check('INJECT_COMMAND')) { /* diff --git a/shared/src/constants/AutomationPresets.ts b/shared/src/constants/AutomationPresets.ts index 022e0681..f35ee80e 100644 --- a/shared/src/constants/AutomationPresets.ts +++ b/shared/src/constants/AutomationPresets.ts @@ -20,6 +20,7 @@ export interface AutomationProtocol { CHANNEL_FADER_LEVEL: string CHANNEL_INPUT_GAIN: string CHANNEL_INPUT_SELECTOR: string + SET_CHANNEL_STATE: string INJECT_COMMAND: string CHANNEL_VISIBLE: string CHANNEL_MUTE: string @@ -95,6 +96,7 @@ export const AutomationPresets: { [key: string]: AutomationProtocol } = { CHANNEL_INPUT_GAIN: '/ch/{value1}/inputgain', CHANNEL_INPUT_SELECTOR: '/ch/{value1}/inputselector', CHANNEL_VISIBLE: '/ch/{value1}/visible', + SET_CHANNEL_STATE: '/setchannel/{value1}', CHANNEL_MUTE: '/ch/{value1}/mute', X_MIX: '/take', INJECT_COMMAND: '/inject', From a335cafeadf914211d2557ef027f8ee0a61e121d Mon Sep 17 00:00:00 2001 From: olzzon Date: Fri, 15 Mar 2024 11:03:22 +0100 Subject: [PATCH 12/15] feat: SET_CHANNEL_STATE update README.md --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index 85fdf44e..bc8f5f57 100644 --- a/README.md +++ b/README.md @@ -227,6 +227,24 @@ To set the state send these OSC commands from you Automation to Sisyfos Port: 52 /ch/1/label - string {name of channel} +#### Set channel state: + +/setchannel/{value1} set the channel state of all settings exposed to automation parsing a json, with this type: + +``` +export interface AutomationChannelAPI { + faderLevel: number + pgmOn: boolean + voOn: boolean + pstOn: boolean + visible: boolean + muteOn: boolean + inputGain: number + inputSelector: number + label: string +} +``` + #### Inject Command: (currently not implemented) Pass a command directly from Automation to Audiomixer From b43067a90b987435caa61a42149a0eff7ead3b1c Mon Sep 17 00:00:00 2001 From: olzzon Date: Wed, 20 Mar 2024 11:44:26 +0100 Subject: [PATCH 13/15] feat: make setChannel/xx payload arg optional. --- README.md | 16 +++++++------- server/src/utils/AutomationConnection.ts | 28 ++++++++++++------------ 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index bc8f5f57..c55f6638 100644 --- a/README.md +++ b/README.md @@ -233,14 +233,14 @@ To set the state send these OSC commands from you Automation to Sisyfos Port: 52 ``` export interface AutomationChannelAPI { - faderLevel: number - pgmOn: boolean - voOn: boolean - pstOn: boolean - visible: boolean - muteOn: boolean - inputGain: number - inputSelector: number + faderLevel?: number + pgmOn?: boolean + voOn?: boolean + pstOn?: boolean + visible?: boolean + muteOn?: boolean + inputGain?: number + inputSelector?: number label: string } ``` diff --git a/server/src/utils/AutomationConnection.ts b/server/src/utils/AutomationConnection.ts index b27e8ff8..24264840 100644 --- a/server/src/utils/AutomationConnection.ts +++ b/server/src/utils/AutomationConnection.ts @@ -90,9 +90,7 @@ export class AutomationConnection { global.mainThreadHandler.updatePartialStore(ch - 1) } - logger - .data(message) - .debug(`RECIEVED AUTOMATION MESSAGE: ${message.address}`) + console.log(`RECIEVED AUTOMATION MESSAGE: ${message.address}`) // Set state of Sisyfos: if (check('CHANNEL_PGM_ON_OFF')) { @@ -214,14 +212,15 @@ export class AutomationConnection { wrapChannelCommand((ch: any) => { const apiState: AutomationChannelAPI = JSON.parse(message.args[0]) const channelState: Fader = {... state.faders[0].fader[ch - 1], - faderLevel: apiState.faderLevel, - pgmOn: apiState.pgmOn, - voOn: apiState.voOn, - pstOn: apiState.pstOn, - showChannel: apiState.visible, - muteOn: apiState.muteOn, - inputGain: apiState.inputGain, - inputSelector: apiState.inputSelector, + faderLevel: apiState.faderLevel || state.faders[0].fader[ch - 1].faderLevel, + pgmOn: apiState.pgmOn || state.faders[0].fader[ch - 1].pgmOn, + voOn: apiState.voOn || state.faders[0].fader[ch - 1].voOn, + pstOn: apiState.pstOn || state.faders[0].fader[ch - 1].pstOn, + showChannel: apiState.visible || state.faders[0].fader[ch - 1].showChannel, + muteOn: apiState.muteOn || state.faders[0].fader[ch - 1].muteOn, + inputGain: apiState.inputGain || state.faders[0].fader[ch - 1].inputGain, + inputSelector: apiState.inputSelector || state.faders[0].fader[ch - 1].inputSelector, + label: apiState.label || state.faders[0].fader[ch - 1].label, } store.dispatch({ type: FaderActionTypes.SET_SINGLE_FADER_STATE, @@ -407,9 +406,10 @@ export class AutomationConnection { ) }) } else if (check('PING')) { - let pingValue = state.settings[0].mixers[0].mixerOnline - ? message.address.split('/')[2] - : 'offline' + // let pingValue = state.settings[0].mixers[0].mixerOnline + // ? message.address.split('/')[2] + // : 'offline' + let pingValue = message.address.split('/')[2] this.sendOutMessage( this.automationProtocol.toAutomation.PONG, From 4e8e9dc1aa18f0a85a0fa2017204b85dccc82093 Mon Sep 17 00:00:00 2001 From: olzzon Date: Thu, 21 Mar 2024 08:59:49 +0100 Subject: [PATCH 14/15] fix: revert log message back to logger (was changed during debugging.) --- server/src/utils/AutomationConnection.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/src/utils/AutomationConnection.ts b/server/src/utils/AutomationConnection.ts index 24264840..a36b4400 100644 --- a/server/src/utils/AutomationConnection.ts +++ b/server/src/utils/AutomationConnection.ts @@ -90,7 +90,9 @@ export class AutomationConnection { global.mainThreadHandler.updatePartialStore(ch - 1) } - console.log(`RECIEVED AUTOMATION MESSAGE: ${message.address}`) + logger + .data(message) + .debug(`RECIEVED AUTOMATION MESSAGE: ${message.address}`) // Set state of Sisyfos: if (check('CHANNEL_PGM_ON_OFF')) { From 4c99f29ac7997e142783053719677cad65e501c9 Mon Sep 17 00:00:00 2001 From: olzzon Date: Thu, 21 Mar 2024 10:12:57 +0100 Subject: [PATCH 15/15] fix: Automation API returned STATE_CHANNEL as STATE_FULL --- server/src/utils/AutomationConnection.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/utils/AutomationConnection.ts b/server/src/utils/AutomationConnection.ts index a36b4400..c32a6306 100644 --- a/server/src/utils/AutomationConnection.ts +++ b/server/src/utils/AutomationConnection.ts @@ -333,9 +333,9 @@ export class AutomationConnection { muteOn: currentFader.muteOn, inputGain: currentFader.inputGain, inputSelector: currentFader.inputSelector, - } + } this.sendOutMessage( - this.automationProtocol.toAutomation.STATE_FULL, + this.automationProtocol.toAutomation.STATE_CHANNEL, ch, JSON.stringify({ channel: channelState,