Skip to content

Commit

Permalink
Merge pull request #85 from olzzon/develop
Browse files Browse the repository at this point in the history
feat/Next send to Aux
  • Loading branch information
olzzon authored Oct 14, 2019
2 parents 71050cc + 48ed2ae commit 8317496
Show file tree
Hide file tree
Showing 11 changed files with 84 additions and 36 deletions.
3 changes: 2 additions & 1 deletion src/components/Channel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,12 @@ class Channel extends React.Component<IChannelProps & IChannelInjectProps & Stor
}
}

handlePst() {
handlePst() {
this.props.dispatch({
type:'TOGGLE_PST',
channel: this.channelIndex
});
window.mixerGenericConnection.updateNextAux(this.channelIndex);
}

handlePfl() {
Expand Down
8 changes: 4 additions & 4 deletions src/constants/mixerProtocols/SSLsystemT.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ export const SSLSystemT: IMixerProtocol = {
},
toMixer: {
CHANNEL_FADER_LEVEL: [emptyMixerMessage()],
CHANNEL_OUT_GAIN: [{ mixerMessage: "f1 06 00 80 00 00 {channel} {level}", value: 0, type: '', min: 0, max: 1, zero: 0.75}],
CHANNEL_OUT_GAIN: [{ mixerMessage: "f1 06 00 80 00 {channel} {level}", value: 0, type: '', min: 0, max: 1, zero: 0.75}],
CHANNEL_NAME: [emptyMixerMessage()],
PFL_ON: [{ mixerMessage: "f1 05 00 80 05 00 {channel} 01", value: 0, type: '', min: 0, max: 1, zero: 0.75}],
PFL_OFF: [{ mixerMessage: "f1 05 00 80 05 00 {channel} 00", value: 0, type: '', min: 0, max: 1, zero: 0.75}],
AUX_SEND: [emptyMixerMessage()],
PFL_ON: [{ mixerMessage: "f1 05 00 80 05 {channel} 01", value: 0, type: '', min: 0, max: 1, zero: 0.75}],
PFL_OFF: [{ mixerMessage: "f1 05 00 80 05 {channel} 00", value: 0, type: '', min: 0, max: 1, zero: 0.75}],
AUX_SEND: [{ mixerMessage: "f1 06 00 80 00 {channel} {level}", value: 0, type: '', min: 0, max: 1, zero: 0.75}],
},
}],
fader: {
Expand Down
2 changes: 1 addition & 1 deletion src/reducers/fadersReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const defaultFadersReducerState = (numberOfFaders: number) => {

for (let index=0; index < numberOfFaders; index++) {
defaultObj[0].fader[index] = ({
faderLevel: 0,
faderLevel: 0.75,
label: "",
pgmOn: false,
voOn: false,
Expand Down
4 changes: 2 additions & 2 deletions src/utils/AutomationConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class AutomationConnection {
pstOn: false
});
}
window.mixerGenericConnection.updateOutLevel(ch-1);
window.mixerGenericConnection.updateNextAux(ch-1);
} else if ( this.checkOscCommand(message.address, this.automationProtocol.fromAutomation
.CHANNEL_FADER_LEVEL)){
let ch = message.address.split("/")[2];
Expand Down Expand Up @@ -135,7 +135,7 @@ export class AutomationConnection {
window.storeRedux.dispatch({
type:'FADE_TO_BLACK'
});
window.mixerGenericConnection.updateOutLevels();
window.mixerGenericConnection.updateFadeToBlack();
} else if (this.checkOscCommand(message.address, this.automationProtocol.fromAutomation
.CLEAR_PST)) {
window.storeRedux.dispatch({
Expand Down
3 changes: 3 additions & 0 deletions src/utils/CasparCGConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,9 @@ export class CasparCGConnection {
}
}

updateNextAux(channelIndex: number, level: number) {
return true
}

updateFadeIOLevel(channelIndex: number, outputLevel: number) {
if (channelIndex > this.mixerProtocol.toMixer.PGM_CHANNEL_FADER_LEVEL.length - 1) {
Expand Down
4 changes: 4 additions & 0 deletions src/utils/EmberMixerConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ export class EmberMixerConnection {
}
}

updateNextAux(channelIndex: number, level: number) {
return true
}

updateFadeIOLevel(channelIndex: number, outputLevel: number) {
let channelType = this.store.channels[0].channel[channelIndex].channelType;
let channelTypeIndex = this.store.channels[0].channel[channelIndex].channelTypeIndex;
Expand Down
4 changes: 4 additions & 0 deletions src/utils/MidiMixerConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ return true;
}
}

updateNextAux(channelIndex: number, level: number) {
return true
}


updateFadeIOLevel(channelIndex: number, outputLevel: number) {
this.sendOutMessage(
Expand Down
33 changes: 29 additions & 4 deletions src/utils/MixerConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,16 @@ export class MixerGenericConnection {
this.fadeActiveTimer = new Array(this.store.channels[0].channel.length);
}

updateFadeToBlack() {
this.store.faders[0].fader.map((channel: any, index: number) => {
this.updateOutLevel(index);
});
}

updateOutLevels() {
this.store.faders[0].fader.map((channel: any, index: number) => {
this.updateOutLevel(index);
this.updateNextAux(index);
});
}

Expand All @@ -70,22 +77,34 @@ export class MixerGenericConnection {
}
}

this.store.channels[0].channel.map((channel: IChannel, index: number) => {
this.store.channels[0].channel.map((channel: IChannel, channelIndex: number) => {
if (faderIndex === channel.assignedFader) {
this.fadeInOut(index, fadeTime);
//this.mixerConnection.updateOutLevel(index);
this.fadeInOut(channelIndex, fadeTime);
}
})
if (window.huiRemoteConnection) {
window.huiRemoteConnection.updateRemoteFaderState(faderIndex, this.store.faders[0].fader[faderIndex].faderLevel)
}
}


updatePflState(channelIndex: number) {
this.mixerConnection.updatePflState(channelIndex);
}

updateNextAux(faderIndex: number) {
let level = 0
if (this.store.faders[0].fader[faderIndex].pstOn) {
level = this.store.faders[0].fader[faderIndex].faderLevel
} else if (this.store.faders[0].fader[faderIndex].pstVoOn) {
level = this.store.faders[0].fader[faderIndex].faderLevel * (100-parseFloat(this.store.settings[0].voLevel))/100
}
this.store.channels[0].channel.map((channel: IChannel, channelIndex: number) => {
if (faderIndex === channel.assignedFader) {
this.mixerConnection.updateNextAux(channelIndex, level)
}
})
}

updateChannelName(channelIndex: number) {
this.mixerConnection.updateChannelName(channelIndex);
}
Expand All @@ -110,6 +129,12 @@ export class MixerGenericConnection {

fadeInOut (channelIndex: number, fadeTime: number){
let faderIndex = this.store.channels[0].channel[channelIndex].assignedFader
if (!this.store.faders[0].fader[faderIndex].pgmOn
&& !this.store.faders[0].fader[faderIndex].voOn
&& this.store.channels[0].channel[channelIndex].outputLevel === 0
) {
return
}
//Clear Old timer or set Fade to active:
if (this.store.channels[0].channel[channelIndex].fadeActive) {
clearInterval(this.fadeActiveTimer[channelIndex]);
Expand Down
5 changes: 5 additions & 0 deletions src/utils/OscMixerConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@ export class OscMixerConnection {
}
}

updateNextAux(channelIndex: number, level: number) {
return true
}


updateFadeIOLevel(channelIndex: number, outputLevel: number) {
let channelType = this.store.channels[0].channel[channelIndex].channelType;
let channelTypeIndex = this.store.channels[0].channel[channelIndex].channelTypeIndex;
Expand Down
4 changes: 4 additions & 0 deletions src/utils/QlClMixerConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ export class QlClMixerConnection {
}
}

updateNextAux(channelIndex: number, level: number) {
return true
}

updateFadeIOLevel(channelIndex: number, outputLevel: number) {
let channelType = this.store.channels[0].channel[channelIndex].channelType;
let channelTypeIndex = this.store.channels[0].channel[channelIndex].channelTypeIndex;
Expand Down
50 changes: 26 additions & 24 deletions src/utils/SSLMixerConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export class SSLMixerConnection {

constructor(mixerProtocol: IMixerProtocol) {
this.sendOutLevelMessage = this.sendOutLevelMessage.bind(this);
this.pingMixerCommand = this.pingMixerCommand.bind(this);

this.store = window.storeRedux.getState();
const unsubscribe = window.storeRedux.subscribe(() => {
Expand Down Expand Up @@ -55,7 +54,7 @@ export class SSLMixerConnection {
this.sendOutRequest(item.mixerMessage, index);
});
} else {
this.sendOutLevelMessage(item.mixerMessage, 0, item.value, item.type);
this.sendOutLevelMessage(item.mixerMessage, 0, item.value);
}
});
})
Expand Down Expand Up @@ -120,18 +119,6 @@ export class SSLMixerConnection {
});
}

pingMixerCommand() {
//Ping OSC mixer if mixerProtocol needs it.
this.mixerProtocol.pingCommand.map((command) => {
this.sendOutLevelMessage(
command.mixerMessage,
0,
command.value,
command.type
);
});
}

checkSSLCommand(message: string, command: string) {
if (!message) return false
if (message.slice(0, command.length) === command) return true;
Expand Down Expand Up @@ -170,7 +157,7 @@ export class SSLMixerConnection {
}


sendOutLevelMessage(sslMessage: string, channelIndex: number, value: string | number, type: string) {
sendOutLevelMessage(sslMessage: string, channelIndex: number, value: string | number) {
let valueNumber: number
if (typeof value === 'string') {
value = parseFloat(value)
Expand All @@ -180,8 +167,13 @@ export class SSLMixerConnection {
(valueNumber & 0x0000ff00) >> 8,
(valueNumber & 0x000000ff),
])

let channelByte = new Uint8Array([
(channelIndex & 0x0000ff00) >> 8,
(channelIndex & 0x000000ff),
])

sslMessage = sslMessage.replace('{channel}', ('0' + channelIndex.toString(16).slice(-2)))
sslMessage = sslMessage.replace('{channel}', ('0' + channelByte[0].toString(16)).slice(-2) + ' ' + ('0' + channelByte[1].toString(16)).slice(-2))
sslMessage = sslMessage.replace('{level}', ('0' + valueByte[0].toString(16)).slice(-2) + ' ' + ('0' + valueByte[1].toString(16)).slice(-2) + ' ')
sslMessage = sslMessage + this.calculate_checksum8(sslMessage.slice(9))
let a = sslMessage.split(' ')
Expand All @@ -191,10 +183,13 @@ export class SSLMixerConnection {
this.SSLConnection.write(buf)
}


sendOutRequest(sslMessage: string, channelIndex: number) {
//let sslMessage = 'f1 06 00 80 00 00 {channel} {level}'
sslMessage = sslMessage.replace('{channel}', ('0' + channelIndex.toString(16).slice(-2)))
let channelByte = new Uint8Array([
(channelIndex & 0x0000ff00) >> 8,
(channelIndex & 0x000000ff),
])
sslMessage = sslMessage.replace('{channel}', ('0' + channelByte[0].toString(16)).slice(-2) + ' ' + ('0' + channelByte[1].toString(16)).slice(-2))
sslMessage = sslMessage + ' ' + this.calculate_checksum8(sslMessage.slice(9))
let a = sslMessage.split(' ')
let buf = new Buffer(a.map((val:string) => { return parseInt(val, 16) }))
Expand All @@ -217,8 +212,7 @@ export class SSLMixerConnection {
this.sendOutLevelMessage(
this.mixerProtocol.channelTypes[channelType].toMixer.CHANNEL_OUT_GAIN[0].mixerMessage,
channelTypeIndex,
this.store.channels[0].channel[channelIndex].outputLevel,
"f"
this.store.channels[0].channel[channelIndex].outputLevel
);
}

Expand All @@ -244,21 +238,29 @@ export class SSLMixerConnection {
this.sendOutLevelMessage(
this.mixerProtocol.channelTypes[channelType].toMixer.CHANNEL_OUT_GAIN[0].mixerMessage,
channelTypeIndex,
String(outputLevel),
"f"
String(outputLevel)
);
}

updateNextAux(channelIndex: number, level: number) {
this.sendOutLevelMessage(
this.mixerProtocol.channelTypes[0].toMixer.AUX_SEND[0].mixerMessage,
channelIndex + 128,
level
);
}

updateChannelName(channelIndex: number) {
let channelType = this.store.channels[0].channel[channelIndex].channelType;
let channelTypeIndex = this.store.channels[0].channel[channelIndex].channelTypeIndex;
let channelName = this.store.faders[0].fader[channelIndex].label;
/*
this.sendOutLevelMessage(
this.mixerProtocol.channelTypes[channelType].toMixer.CHANNEL_NAME[0].mixerMessage,
channelTypeIndex,
channelName,
"s"
channelName
);
*/
}
}

0 comments on commit 8317496

Please sign in to comment.