Skip to content

Commit

Permalink
fix: SSL adjust fader all way to zero
Browse files Browse the repository at this point in the history
fix: All protocols - Jump in level when adjusting from -inf on the desk. Moved autoResetLevel prior to setting PGM ON
  • Loading branch information
olzzon committed Nov 8, 2019
1 parent 51bd2fb commit 894a406
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 49 deletions.
2 changes: 2 additions & 0 deletions src/components/Channel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class Channel extends React.Component<IChannelProps & IChannelInjectProps & Stor
}

handlePgm() {
window.mixerGenericConnection.checkForAutoResetThreshold(this.channelIndex)
this.props.dispatch({
type: TOGGLE_PGM,
channel: this.channelIndex
Expand All @@ -95,6 +96,7 @@ class Channel extends React.Component<IChannelProps & IChannelInjectProps & Stor
}

handleVo() {
window.mixerGenericConnection.checkForAutoResetThreshold(this.channelIndex)
this.props.dispatch({
type: TOGGLE_VO,
channel: this.channelIndex
Expand Down
2 changes: 2 additions & 0 deletions src/utils/AutomationConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,14 @@ export class AutomationConnection {
.CHANNEL_PGM_ON_OFF)){
let ch = message.address.split("/")[2];
if (message.args[0] === 1) {
window.mixerGenericConnection.checkForAutoResetThreshold(ch - 1)
window.storeRedux.dispatch({
type: SET_PGM,
channel: ch - 1,
pgmOn: true
});
} else if (message.args[0] === 2) {
window.mixerGenericConnection.checkForAutoResetThreshold(ch - 1)
window.storeRedux.dispatch({
type: SET_VO,
channel: ch - 1,
Expand Down
24 changes: 12 additions & 12 deletions src/utils/MixerConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ export class MixerGenericConnection {
this.fadeActiveTimer = new Array(this.store.channels[0].channel.length);
}


checkForAutoResetThreshold(channel: number) {
if (this.store.faders[0].fader[channel].faderLevel <= this.mixerProtocol.fader.min + (this.mixerProtocol.fader.max * this.store.settings[0].autoResetLevel / 100)) {
window.storeRedux.dispatch({
type: SET_FADER_LEVEL,
channel: channel,
level: this.mixerProtocol.fader.zero
})
}
}


updateFadeToBlack() {
this.store.faders[0].fader.map((channel: any, index: number) => {
this.updateOutLevel(index);
Expand Down Expand Up @@ -168,18 +180,6 @@ export class MixerGenericConnection {
let outputLevel = parseFloat(this.store.channels[0].channel[channelIndex].outputLevel);
let targetVal = parseFloat(this.store.faders[0].fader[faderIndex].faderLevel);

// Reset targetVal if it´s lower than AutoReset threshold:
if (targetVal < (this.store.settings[0].autoResetLevel/100)
&& this.store.channels[0].channel[channelIndex].outputLevel === this.mixerProtocol.fader.min
) {
targetVal = this.mixerProtocol.fader.zero
window.storeRedux.dispatch({
type: SET_FADER_LEVEL,
channel: faderIndex,
level: targetVal
});
}

if (this.store.faders[0].fader[faderIndex].voOn) {
targetVal = targetVal * (100-parseFloat(this.store.settings[0].voLevel))/100
}
Expand Down
28 changes: 14 additions & 14 deletions src/utils/OscMixerConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,20 +144,20 @@ export class OscMixerConnection {
} else if (this.store.faders[0].fader[assignedFaderIndex].pgmOn
|| this.store.faders[0].fader[assignedFaderIndex].voOn)
{
window.storeRedux.dispatch({
type: SET_FADER_LEVEL,
channel: assignedFaderIndex,
level: message.args[0]
});
this.store.channels[0].channel.forEach((item, index) => {
if (item.assignedFader === assignedFaderIndex) {
window.storeRedux.dispatch({
type: SET_OUTPUT_LEVEL,
channel: index,
level: message.args[0]
});
}
})
window.storeRedux.dispatch({
type: SET_FADER_LEVEL,
channel: assignedFaderIndex,
level: message.args[0]
});
this.store.channels[0].channel.forEach((item, index) => {
if (item.assignedFader === assignedFaderIndex) {
window.storeRedux.dispatch({
type: SET_OUTPUT_LEVEL,
channel: index,
level: message.args[0]
});
}
})
}
if (window.huiRemoteConnection) {
window.huiRemoteConnection.updateRemoteFaderState(assignedFaderIndex, message.args[0]);
Expand Down
63 changes: 40 additions & 23 deletions src/utils/SSLMixerConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,42 +84,59 @@ export class SSLMixerConnection {
buffers.forEach((buffer) => {
if (buffer[1] === 6 && buffer[2] === 255 && !lastWasAck) {
lastWasAck = false
// FADERLEVEL:
// FADERLEVEL COMMAND:
let commandHex = buffer.toString('hex')
let channel = buffer[6]
let value = buffer.readUInt16BE(7)/1024

let assignedFader = 1 + this.store.channels[0].channel[channel].assignedFader
if (!this.store.channels[0].channel[channel].fadeActive
&& value > this.mixerProtocol.fader.min) {
window.storeRedux.dispatch({
type: SET_FADER_LEVEL,
channel: assignedFader - 1,
level: value
});
if (!this.store.faders[0].fader[assignedFader - 1].pgmOn) {
let assignedFaderIndex = this.store.channels[0].channel[channel].assignedFader
if (!this.store.channels[0].channel[channel].fadeActive) {
if (value > this.mixerProtocol.fader.min + (this.mixerProtocol.fader.max * this.store.settings[0].autoResetLevel / 100)) {
window.storeRedux.dispatch({
type: TOGGLE_PGM,
channel: assignedFader - 1
type: SET_FADER_LEVEL,
channel: assignedFaderIndex,
level: value
});
}

if (window.huiRemoteConnection) {
window.huiRemoteConnection.updateRemoteFaderState(assignedFader - 1, value);
}
if (this.store.faders[0].fader[assignedFader - 1].pgmOn) {
this.store.channels[0].channel.map((channel: any, index: number) => {
if (channel.assignedFader === assignedFader - 1) {
this.updateOutLevel(index);
if (!this.store.faders[0].fader[assignedFaderIndex].pgmOn) {
window.storeRedux.dispatch({
type: TOGGLE_PGM,
channel: assignedFaderIndex
});
}

if (window.huiRemoteConnection) {
window.huiRemoteConnection.updateRemoteFaderState(assignedFaderIndex, value);
}
if (this.store.faders[0].fader[assignedFaderIndex].pgmOn) {
this.store.channels[0].channel.map((channel: any, index: number) => {
if (channel.assignedFader === assignedFaderIndex) {
this.updateOutLevel(index);
}
})
}
} else if (this.store.faders[0].fader[assignedFaderIndex].pgmOn
|| this.store.faders[0].fader[assignedFaderIndex].voOn)
{
window.storeRedux.dispatch({
type: SET_FADER_LEVEL,
channel: assignedFaderIndex,
level: value
});
this.store.channels[0].channel.forEach((item, index) => {
if (item.assignedFader === assignedFaderIndex) {
window.storeRedux.dispatch({
type: SET_OUTPUT_LEVEL,
channel: index,
level: value
});
}
})
}

}

} else if (buffer[1] === 5 && buffer[2] === 255 && buffer[4] === 1 && !lastWasAck) {
lastWasAck = false
// MUTE ON/OFF
// MUTE ON/OFF COMMAND
let commandHex = buffer.toString('hex')
let channelIndex = buffer[6]
let value: boolean = buffer[7] === 0 ? true : false
Expand Down

0 comments on commit 894a406

Please sign in to comment.