Skip to content

Commit

Permalink
fix: when receiving fader update from mixer, responded level should b…
Browse files Browse the repository at this point in the history
…e faderlevel not outgain
  • Loading branch information
olzzon committed Sep 3, 2019
1 parent a8c6da8 commit 0fd1bd5
Showing 1 changed file with 25 additions and 21 deletions.
46 changes: 25 additions & 21 deletions src/utils/OscMixerConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,43 +68,54 @@ export class OscMixerConnection {
} else if ( this.checkOscCommand(message.address, this.mixerProtocol.channelTypes[0].fromMixer
.CHANNEL_FADER_LEVEL[0].mixerMessage)){
let ch = message.address.split("/")[this.cmdChannelIndex];
let assignedFader = 1 + this.store.channels[0].channel[ch - 1].assignedFader

window.storeRedux.dispatch({
type:'SET_FADER_LEVEL',
channel: this.store.channels[0].channel[ch - 1].assignedFader,
channel: assignedFader - 1,
level: message.args[0]
});

if (window.huiRemoteConnection) {
window.huiRemoteConnection.updateRemoteFaderState(ch-1, message.args[0]);
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.mixerProtocol.mode === 'master') {
if (this.store.faders[0].fader[this.store.channels[0].channel[ch - 1].assignedFader].pgmOn)
{
this.updateOutLevel(ch-1);
}
if (!this.store.faders[0].fader[assignedFader - 1].pgmOn) {
window.storeRedux.dispatch({
type:'TOGGLE_PGM',
channel: assignedFader - 1
});
}

if (window.huiRemoteConnection) {
window.huiRemoteConnection.updateRemoteFaderState(assignedFader-1, message.args[0]);
}
} else if ( this.checkOscCommand(message.address, this.mixerProtocol.channelTypes[0].fromMixer
.CHANNEL_OUT_GAIN[0].mixerMessage)){
let ch = message.address.split("/")[this.cmdChannelIndex];
let assignedFader = 1 + this.store.channels[0].channel[ch - 1].assignedFader
if (this.mixerProtocol.mode === 'master'
&& !this.store.channels[0].channel[ch - 1].fadeActive
&& message.args[0] > this.mixerProtocol.fader.min)
{
window.storeRedux.dispatch({
type:'SET_FADER_LEVEL',
channel: this.store.channels[0].channel[ch - 1].assignedFader,
channel: assignedFader - 1,
level: message.args[0]
});
if (!this.store.faders[0].fader[ch - 1].pgmOn) {
if (!this.store.faders[0].fader[assignedFader - 1].pgmOn) {
window.storeRedux.dispatch({
type:'TOGGLE_PGM',
channel: this.store.channels[0].channel[ch - 1].assignedFader
channel: assignedFader
});
}

if (window.huiRemoteConnection) {
window.huiRemoteConnection.updateRemoteFaderState(ch-1, message.args[0]);
window.huiRemoteConnection.updateRemoteFaderState(assignedFader - 1, message.args[0]);
}

}
Expand Down Expand Up @@ -207,20 +218,13 @@ export class OscMixerConnection {
updateOutLevel(channelIndex: number) {
let channelType = this.store.channels[0].channel[channelIndex].channelType;
let channelTypeIndex = this.store.channels[0].channel[channelIndex].channelTypeIndex;
let faderIndex = this.store.channels[0].channel[channelIndex].assignedFader;
this.sendOutMessage(
this.mixerProtocol.channelTypes[channelType].toMixer.CHANNEL_OUT_GAIN[0].mixerMessage,
channelTypeIndex+1,
this.store.channels[0].channel[channelIndex].outputLevel,
this.store.faders[0].fader[faderIndex].faderLevel,
"f"
);
/* ToDo: skip client protocol mode, or incorporate separate fader in store.channels[0]
this.sendOutMessage(
this.mixerProtocol.channelTypes[channelType].toMixer.CHANNEL_FADER_LEVEL[0].mixerMessage,
channelTypeIndex+1,
this.store.faders[0].fader[channelIndex].faderLevel,
"f"
);
*/
}

updatePflState(channelIndex: number) {
Expand Down

0 comments on commit 0fd1bd5

Please sign in to comment.