Skip to content

Commit

Permalink
feat: QlCl - added mute support FROM Sisyfos
Browse files Browse the repository at this point in the history
  • Loading branch information
olzzon committed Jan 29, 2020
1 parent e96f902 commit 8793170
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 14 deletions.
4 changes: 2 additions & 2 deletions server/constants/mixerProtocols/yamahaQLCL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export const YamahaQLCL: IMixerProtocol = {
MID: [emptyMixerMessage()],
HIGH: [emptyMixerMessage()],
AUX_LEVEL: [emptyMixerMessage()],
CHANNEL_MUTE_ON: [emptyMixerMessage()],
CHANNEL_MUTE_OFF: [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}]
},
}],
fader: {
Expand Down
2 changes: 1 addition & 1 deletion server/utils/MixerConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { MixerProtocolPresets } from '../constants/MixerProtocolPresets';
import { IMixerProtocol, IMixerProtocolGeneric, ICasparCGMixerGeometry } from '../constants/MixerProtocolInterface';
import { OscMixerConnection } from './mixerConnections/OscMixerConnection';
import { MidiMixerConnection } from './mixerConnections/MidiMixerConnection';
import { QlClMixerConnection } from './mixerConnections/QlClMixerConnection';
import { QlClMixerConnection } from './mixerConnections/YamahaQlClConnection';
import { SSLMixerConnection } from './mixerConnections/SSLMixerConnection';
import { EmberMixerConnection } from './mixerConnections/EmberMixerConnection';
import { CasparCGConnection } from './mixerConnections/CasparCGConnection';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { logger } from '../logger'
export class QlClMixerConnection {
mixerProtocol: IMixerProtocol;
cmdChannelIndex: number;
scpConnection: any;
midiConnection: any;

constructor(mixerProtocol: IMixerProtocol) {
this.sendOutMessage = this.sendOutMessage.bind(this);
Expand All @@ -30,8 +30,8 @@ export class QlClMixerConnection {

this.cmdChannelIndex = this.mixerProtocol.channelTypes[0].fromMixer.CHANNEL_OUT_GAIN[0].mixerMessage.split('/').findIndex(ch => ch === '{channel}');

this.scpConnection = new net.Socket()
this.scpConnection.connect(50000, state.settings[0].deviceIp, () => {
this.midiConnection = new net.Socket()
this.midiConnection.connect(50000, state.settings[0].deviceIp, () => {
logger.info('Connected to Yamaha mixer', {})

}
Expand All @@ -40,7 +40,7 @@ export class QlClMixerConnection {
}

setupMixerConnection() {
this.scpConnection
this.midiConnection
.on("ready", () => {
logger.info("Receiving state of desk", {})
this.mixerProtocol.initializeCommands.map((item) => {
Expand All @@ -56,7 +56,8 @@ export class QlClMixerConnection {
.on('data', (buffer: any) => {
let messages: string[] = buffer.toString().split('\n')
messages.forEach((message) => {
if (this.checkSCPCommand(message, this.mixerProtocol.channelTypes[0].fromMixer
console.log("Received Message : ", message)
if (this.checkMidiCommand(message, this.mixerProtocol.channelTypes[0].fromMixer
.CHANNEL_VU[0].mixerMessage)) {
let mixerValues: string[] = message.split(' ')
let ch = parseInt(mixerValues[3])
Expand All @@ -68,7 +69,7 @@ export class QlClMixerConnection {
level: mixerValue
}
)
} else if (this.checkSCPCommand(message, this.mixerProtocol.channelTypes[0].fromMixer
} else if (this.checkMidiCommand(message, this.mixerProtocol.channelTypes[0].fromMixer
.CHANNEL_OUT_GAIN[0].mixerMessage)) {
let mixerValues: string[] = message.split(' ')
let ch = 1 + parseInt(mixerValues[3])
Expand Down Expand Up @@ -141,7 +142,7 @@ export class QlClMixerConnection {
});
}

checkSCPCommand(message: string, command: string) {
checkMidiCommand(message: string, command: string) {
if (!message) return false
if (message.slice(0, command.length) === command) return true;
return false;
Expand All @@ -163,8 +164,7 @@ export class QlClMixerConnection {
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) }))
this.scpConnection.write(buf)
// this.scpConnection.write(oscMessage + ' ' + (channel - 1) + ' 0 ' + valueNumber.toFixed(0) + '\n');
this.midiConnection.write(buf)
}


Expand All @@ -175,7 +175,7 @@ export class QlClMixerConnection {
channelString
);
if (message != 'none') {
this.scpConnection.send({
this.midiConnection.send({
address: message
});
}
Expand Down Expand Up @@ -221,7 +221,23 @@ export class QlClMixerConnection {
}

updateMuteState(channelIndex: number, muteOn: boolean) {
return true
let channelType = state.channels[0].channel[channelIndex].channelType;
let channelTypeIndex = state.channels[0].channel[channelIndex].channelTypeIndex;
if (muteOn === true) {
this.sendOutMessage(
this.mixerProtocol.channelTypes[channelType].toMixer.CHANNEL_MUTE_ON[0].mixerMessage,
channelTypeIndex,
'',
''
);
} else {
this.sendOutMessage(
this.mixerProtocol.channelTypes[channelType].toMixer.CHANNEL_MUTE_OFF[0].mixerMessage,
channelTypeIndex,
'',
''
);
}
}

updateNextAux(channelIndex: number, level: number) {
Expand Down

0 comments on commit 8793170

Please sign in to comment.