Skip to content

Commit

Permalink
fix: delay initial state commands to avoid overload of OSC commands t…
Browse files Browse the repository at this point in the history
…o Midas
  • Loading branch information
olzzon committed Jan 23, 2020
1 parent e84abaa commit 443325f
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions server/utils/mixerConnections/OscMixerConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import {
SET_FADER_RATIO,
SET_FADER_LO_MID,
SET_FADER_MID,
SET_FADER_HIGH
SET_FADER_HIGH,
SET_FADER_LOW
} from '../../reducers/faderActions'
import { SET_MIXER_ONLINE } from '../../reducers/settingsActions';
import { SOCKET_SET_VU } from '../../constants/SOCKET_IO_DISPATCHERS';
Expand Down Expand Up @@ -204,7 +205,7 @@ export class OscMixerConnection {
.LOW[0].mixerMessage)) {
let ch = message.address.split("/")[this.cmdChannelIndex];
store.dispatch({
type: SET_FADER_LO_MID,
type: SET_FADER_LOW,
channel: state.channels[0].channel[ch - 1].assignedFader,
level: message.args[0]
});
Expand Down Expand Up @@ -265,26 +266,29 @@ export class OscMixerConnection {
}

initialCommands() {
this.mixerProtocol.initializeCommands.forEach((item) => {
if (item.mixerMessage.includes("{channel}")) {
if (item.type === 'aux') {
state.channels[0].channel.forEach((channel: any, index: number) => {
channel.auxLevel.forEach((auxLevel: any, auxIndex: number) => {
setTimeout(() => {
this.sendOutRequestAux(item.mixerMessage, auxIndex +1, state.faders[0].fader[channel.assignedFader].monitor)
},
state.faders[0].fader[channel.assignedFader].monitor * 10 + auxIndex * 100)
this.mixerProtocol.initializeCommands.forEach((item, itemIndex: number) => {
setTimeout(() => {
if (item.mixerMessage.includes("{channel}")) {
if (item.type === 'aux') {
state.channels[0].channel.forEach((channel: any, index: number) => {
channel.auxLevel.forEach((auxLevel: any, auxIndex: number) => {
setTimeout(() => {
this.sendOutRequestAux(item.mixerMessage, auxIndex +1, state.faders[0].fader[channel.assignedFader].monitor)
},
state.faders[0].fader[channel.assignedFader].monitor * 10 + auxIndex * 100)
})
})
})
} else {
state.channels[0].channel.map((channel: any, index: any) => {
this.sendOutRequest(item.mixerMessage,(index +1));
});
}

} else {
state.channels[0].channel.map((channel: any, index: any) => {
this.sendOutRequest(item.mixerMessage,(index +1));
});
}

} else {
this.sendOutMessage(item.mixerMessage, 1, item.value, item.type);
}
this.sendOutMessage(item.mixerMessage, 1, item.value, item.type);
}
},
itemIndex * 100)
});
}

Expand Down

0 comments on commit 443325f

Please sign in to comment.