From f4628411784c9fb47d3c7349db8d43afe436c65a Mon Sep 17 00:00:00 2001 From: Olzzon Date: Thu, 30 Jan 2020 12:07:12 +0100 Subject: [PATCH] feat: yamaha qlcl - inital req of fader levels. - split buffers - 2 byte channel message --- server/constants/mixerProtocols/yamahaQLCL.ts | 19 +++++++--- .../mixerConnections/YamahaQlClConnection.ts | 37 ++++++++----------- 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/server/constants/mixerProtocols/yamahaQLCL.ts b/server/constants/mixerProtocols/yamahaQLCL.ts index c76a719b..42dececd 100644 --- a/server/constants/mixerProtocols/yamahaQLCL.ts +++ b/server/constants/mixerProtocols/yamahaQLCL.ts @@ -9,13 +9,22 @@ export const YamahaQLCL: IMixerProtocol = { pingCommand: [emptyMixerMessage()], pingResponseCommand: [emptyMixerMessage()], pingTime: 10000, - initializeCommands: [emptyMixerMessage()], + initializeCommands: [ + { + mixerMessage: 'f0 43 30 3e 19 01 00 37 00 00 {channel} f7', + value: 0, + type: '', + min: 0, + max: 1, + zero: 0.75 + } + ], channelTypes: [{ channelTypeName: 'CH', channelTypeColor: '#2f2f2f', fromMixer: { CHANNEL_FADER_LEVEL: [emptyMixerMessage()], //PgmChange 0 - ignores this command - CHANNEL_OUT_GAIN: [{ mixerMessage: 'f0 43 10 3e 19 01 00 37 00 00 00 {channel} 00 00 00 {level} f7', value: 0, type: '', min: 0, max: 1, zero: 0.75}], //PgmChange 0 - ignores this command + CHANNEL_OUT_GAIN: [{ mixerMessage: 'f0 43 10 3e 19 01 00 37 00 00 {channel} 00 00 00 {level} f7', value: 0, type: '', min: 0, max: 1, zero: 0.75}], //PgmChange 0 - ignores this command CHANNEL_VU: [{ mixerMessage: "0", value: 0, type: 'f', min: 0, max: 1, zero: 0.75}], //PgmChange 0 - ignores this command CHANNEL_NAME: [emptyMixerMessage()], PFL: [emptyMixerMessage()], @@ -32,7 +41,7 @@ export const YamahaQLCL: IMixerProtocol = { }, toMixer: { CHANNEL_FADER_LEVEL: [emptyMixerMessage()], - CHANNEL_OUT_GAIN: [{ mixerMessage: 'f0 43 10 3e 19 01 00 37 00 00 00 {channel} 00 00 00 {level} f7', value: 0, type: '', min: 0, max: 1, zero: 0.75}], + CHANNEL_OUT_GAIN: [{ mixerMessage: 'f0 43 10 3e 19 01 00 37 00 00 {channel} 00 00 00 {level} f7', value: 0, type: '', min: 0, max: 1, zero: 0.75}], CHANNEL_NAME: [emptyMixerMessage()], PFL_ON: [emptyMixerMessage()], PFL_OFF: [emptyMixerMessage()], @@ -44,8 +53,8 @@ export const YamahaQLCL: IMixerProtocol = { MID: [emptyMixerMessage()], HIGH: [emptyMixerMessage()], AUX_LEVEL: [emptyMixerMessage()], - CHANNEL_MUTE_ON: [{ mixerMessage: 'f0 43 10 3e 19 01 00 35 00 00 00 {channel} 00 00 00 00 00 f7', value: 0, type: '', min: 0, max: 1, zero: 0.75}], - CHANNEL_MUTE_OFF: [{ mixerMessage: 'f0 43 10 3e 19 01 00 35 00 00 00 {channel} 00 00 00 00 01 f7', value: 0, type: '', min: 0, max: 1, zero: 0.75}] + CHANNEL_MUTE_ON: [{ mixerMessage: 'f0 43 10 3e 19 01 00 35 00 00 {channel} 00 00 00 00 00 f7', value: 0, type: '', min: 0, max: 1, zero: 0.75}], + CHANNEL_MUTE_OFF: [{ mixerMessage: 'f0 43 10 3e 19 01 00 35 00 00 {channel} 00 00 00 00 01 f7', value: 0, type: '', min: 0, max: 1, zero: 0.75}] }, }], fader: { diff --git a/server/utils/mixerConnections/YamahaQlClConnection.ts b/server/utils/mixerConnections/YamahaQlClConnection.ts index a7d12531..dce0f868 100644 --- a/server/utils/mixerConnections/YamahaQlClConnection.ts +++ b/server/utils/mixerConnections/YamahaQlClConnection.ts @@ -54,12 +54,13 @@ export class QlClMixerConnection { this.mixerProtocol.initializeCommands.map((item) => { if (item.mixerMessage.includes("{channel}")) { state.channels[0].channel.map((channel: any, index: any) => { - this.sendOutRequest(item.mixerMessage, (index + 1)); - }); + this.sendOutMessage(item.mixerMessage, (index + 1), 0, '') + }) } else { - this.sendOutMessage(item.mixerMessage, 0, item.value, item.type); + this.sendOutMessage(item.mixerMessage, 0, item.value, item.type) } - }); + }) + global.mainThreadHandler.updateFullClientStore() }) .on('data', (data: any) => { clearTimeout(this.mixerOnlineTimer) @@ -71,8 +72,8 @@ export class QlClMixerConnection { let buffers = [] let lastIndex = 0 for (let index=1; index> 8, + (channel & 0x00ff), + ]) + + let command = message.replace('{channel}', channelByte[0].toString(16) + ' ' + channelByte[1].toString(16)) command = command.replace('{level}', valueByte[0].toString(16) + ' ' + valueByte[1].toString(16)) let a = command.split(' ') let buf = new Buffer(a.map((val:string) => { return parseInt(val, 16) })) + console.log("Sending Command :", command) this.midiConnection.write(buf) } - - sendOutRequest(oscMessage: string, channel: number) { - let channelString = channel.toString(); - let message = oscMessage.replace( - "{channel}", - channelString - ); - if (message != 'none') { - this.midiConnection.send({ - address: message - }); - } - } - updateOutLevel(channelIndex: number) { let channelType = state.channels[0].channel[channelIndex].channelType; let channelTypeIndex = state.channels[0].channel[channelIndex].channelTypeIndex;