diff --git a/packages/timeline-state-resolver-types/src/generated/sisyfos.ts b/packages/timeline-state-resolver-types/src/generated/sisyfos.ts index 2fee893d5..368b24fbb 100644 --- a/packages/timeline-state-resolver-types/src/generated/sisyfos.ts +++ b/packages/timeline-state-resolver-types/src/generated/sisyfos.ts @@ -38,13 +38,22 @@ export interface SetSisyfosChannelStatePayload { channel: number } +export interface LoadMixerPresetPayload { + /** + * The name of the preset to load + */ + name: string +} + export enum SisyfosActions { Reinit = 'reinit', - SetSisyfosChannelState = 'setSisyfosChannelState' + SetSisyfosChannelState = 'setSisyfosChannelState', + LoadMixerPreset = 'loadMixerPreset' } export interface SisyfosActionExecutionResults { reinit: () => void, - setSisyfosChannelState: (payload: SetSisyfosChannelStatePayload) => void + setSisyfosChannelState: (payload: SetSisyfosChannelStatePayload) => void, + loadMixerPreset: (payload: LoadMixerPresetPayload) => void } export type SisyfosActionExecutionPayload = Parameters< SisyfosActionExecutionResults[A] diff --git a/packages/timeline-state-resolver/src/integrations/sisyfos/$schemas/actions.json b/packages/timeline-state-resolver/src/integrations/sisyfos/$schemas/actions.json index 5c3c73ac7..12f3516d7 100644 --- a/packages/timeline-state-resolver/src/integrations/sisyfos/$schemas/actions.json +++ b/packages/timeline-state-resolver/src/integrations/sisyfos/$schemas/actions.json @@ -22,6 +22,23 @@ }, "destructive": false, "timeout": 5000 + }, + { + "id": "loadMixerPreset", + "name": "Load Mixer Preset", + "destructive": false, + "timeout": 5000, + "payload": { + "type": "object", + "properties": { + "name": { + "description": "The name of the preset to load", + "type": "string" + } + }, + "required": ["name"], + "additionalProperties": false + } } ] } \ No newline at end of file diff --git a/packages/timeline-state-resolver/src/integrations/sisyfos/connection.ts b/packages/timeline-state-resolver/src/integrations/sisyfos/connection.ts index 6a35231c6..e90f1d8bd 100644 --- a/packages/timeline-state-resolver/src/integrations/sisyfos/connection.ts +++ b/packages/timeline-state-resolver/src/integrations/sisyfos/connection.ts @@ -176,6 +176,8 @@ export class SisyfosApi extends EventEmitter { ...command.values, } this.setSisyfosChannel(command.channel + 1, channelState) + } else if (command.type === SisyfosCommandType.LOAD_MIXER_PRESET) { + this.sendLoadMixerPresetCommand(command.presetName) } } @@ -371,6 +373,21 @@ export class SisyfosApi extends EventEmitter { return deviceState } + + protected sendLoadMixerPresetCommand(presetName: string) { + if (!this._oscClient) { + throw new Error(`Can't load mixer preset, OSC client not initialised`) + } + this._oscClient.send({ + address: `/loadmixerpreset`, + args: [ + { + type: 's', + value: presetName, + }, + ], + }) + } } export enum SisyfosCommandType { @@ -387,6 +404,7 @@ export enum SisyfosCommandType { RESYNC = 'resync', RESYNC_CHANNEL = 'resyncChannel', SET_CHANNEL = 'setChannel', + LOAD_MIXER_PRESET = 'loadMixerPreset', } export interface BaseCommand { @@ -399,6 +417,11 @@ export interface SetChannelCommand { values: Partial } +export interface LoadMixerPresetCommand { + type: SisyfosCommandType.LOAD_MIXER_PRESET + presetName: string +} + export interface ChannelCommand extends BaseCommand { type: | SisyfosCommandType.SET_FADER @@ -417,6 +440,10 @@ export interface GlobalCommand extends BaseCommand { type: SisyfosCommandType.CLEAR_PST_ROW | SisyfosCommandType.TAKE | SisyfosCommandType.RESYNC } +export interface GlobalCommand extends BaseCommand { + type: SisyfosCommandType.CLEAR_PST_ROW | SisyfosCommandType.TAKE | SisyfosCommandType.RESYNC +} + export interface BoolCommand extends ChannelCommand { type: SisyfosCommandType.VISIBLE | SisyfosCommandType.SET_MUTE value: boolean @@ -448,6 +475,7 @@ export type SisyfosCommand = | BoolCommand | StringCommand | SetChannelCommand + | LoadMixerPresetCommand export interface SisyfosChannel extends SisyfosChannelAPI { timelineObjIds: string[] diff --git a/packages/timeline-state-resolver/src/integrations/sisyfos/index.ts b/packages/timeline-state-resolver/src/integrations/sisyfos/index.ts index 6ba1283e7..4d283af7c 100644 --- a/packages/timeline-state-resolver/src/integrations/sisyfos/index.ts +++ b/packages/timeline-state-resolver/src/integrations/sisyfos/index.ts @@ -19,13 +19,15 @@ import { ActionExecutionResultCode, SisyfosActionExecutionPayload, SisyfosActionExecutionResult, + SetSisyfosChannelStatePayload, + LoadMixerPresetPayload, } from 'timeline-state-resolver-types' import { DoOnTime, SendMode } from '../../devices/doOnTime' import { SisyfosApi, SisyfosCommand, SisyfosState, SisyfosChannel, SisyfosCommandType } from './connection' import Debug from 'debug' -import { startTrace, endTrace, actionNotFoundMessage } from '../../lib' +import { startTrace, endTrace, actionNotFoundMessage, t } from '../../lib' const debug = Debug('timeline-state-resolver:sisyfos') export interface DeviceOptionsSisyfosInternal extends DeviceOptionsSisyfos { @@ -206,7 +208,7 @@ export class SisyfosMessageDevice extends DeviceWithState( actionId0: A, - payload: SisyfosActionExecutionPayload + payload0: SisyfosActionExecutionPayload ): Promise> { const actionId = actionId0 switch (actionId) { @@ -218,7 +220,8 @@ export class SisyfosMessageDevice extends DeviceWithState ({ result: ActionExecutionResultCode.Error, })) - case SisyfosActions.SetSisyfosChannelState: + case SisyfosActions.SetSisyfosChannelState: { + const payload = payload0 as SetSisyfosChannelStatePayload if (typeof payload?.channel !== 'number') { return { result: ActionExecutionResultCode.Error, @@ -228,6 +231,14 @@ export class SisyfosMessageDevice extends DeviceWithState