Skip to content

Commit

Permalink
feat: multiple mixers - prepare channel-fader Routing
Browse files Browse the repository at this point in the history
  • Loading branch information
olzzon authored and olzzon committed Oct 5, 2020
1 parent 7a36470 commit 5f55b95
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
4 changes: 4 additions & 0 deletions client/components/ChannelRouteSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class ChannelRouteSettings extends React.PureComponent<
)
) {
window.socketIoClient.emit(SOCKET_SET_ASSIGNED_FADER, {
mixerIndex: 0,
channel: channel,
faderAssign: -1,
})
Expand All @@ -58,6 +59,7 @@ class ChannelRouteSettings extends React.PureComponent<
)
) {
window.socketIoClient.emit(SOCKET_SET_ASSIGNED_FADER, {
mixerIndex: 0,
channel: channel,
faderAssign: this.faderIndex,
})
Expand All @@ -69,6 +71,7 @@ class ChannelRouteSettings extends React.PureComponent<
if (window.confirm('REMOVE ALL FADER ASSIGNMENTS????')) {
this.props.channel.forEach((channel: any, index: number) => {
window.socketIoClient.emit(SOCKET_SET_ASSIGNED_FADER, {
mixerIndex: 0,
channel: index,
faderAssign: -1,
})
Expand All @@ -81,6 +84,7 @@ class ChannelRouteSettings extends React.PureComponent<
this.props.fader.forEach((fader: any, index: number) => {
if (this.props.channel.length > index) {
window.socketIoClient.emit(SOCKET_SET_ASSIGNED_FADER, {
mixerIndex: 0,
channel: index,
faderAssign: index,
})
Expand Down
10 changes: 8 additions & 2 deletions server/MainThreadHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,20 @@ export class MainThreadHandlers {
})
.on(SOCKET_SET_ASSIGNED_FADER, (payload: any) => {
logger.verbose(
'Set assigned fader. Channel:' +
'Set assigned fader. Mixer:' +
String(payload.mixerIndex + 1) +
'Channel:' +
String(payload.channel) +
'Fader :' +
String(payload.faderAssign),
{}
)
store.dispatch(
storeSetAssignedFader(payload.channel, payload.faderAssign)
storeSetAssignedFader(
payload.mixerIndex,
payload.channel,
payload.faderAssign
)
)
this.updateFullClientStore()
})
Expand Down
7 changes: 6 additions & 1 deletion server/reducers/channelActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,14 @@ export const storeFadeActive = (
}
}

export const storeSetAssignedFader = (channel: number, faderNumber: number) => {
export const storeSetAssignedFader = (
mixerIndex: number,
channel: number,
faderNumber: number
) => {
return {
type: SET_ASSIGNED_FADER,
mixerIndex: mixerIndex,
channel: channel,
faderNumber: faderNumber,
}
Expand Down
15 changes: 8 additions & 7 deletions server/reducers/channelsReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ export const channels = (
]

switch (action.type) {
case SET_OUTPUT_LEVEL: //channel: level:
case SET_OUTPUT_LEVEL:
nextState[0].chConnection[action.mixerIndex].channel[
action.channel
].outputLevel = parseFloat(action.level)
return nextState
case SET_COMPLETE_CH_STATE: //allState //numberOfChannels
case SET_COMPLETE_CH_STATE:
nextState = defaultChannelsReducerState(action.numberOfTypeChannels)
if (
action.allState.chConnection[0].channel.length ==
Expand All @@ -91,7 +91,7 @@ export const channels = (
)
}
return nextState
case SET_SINGLE_CH_STATE: //channelIndex //state
case SET_SINGLE_CH_STATE:
nextState[0].chConnection[0].channel[action.channelIndex] =
action.state
return nextState
Expand All @@ -100,11 +100,12 @@ export const channels = (
action.channel
].fadeActive = !!action.active
return nextState
case SET_ASSIGNED_FADER: //channel: faderNumber:
nextState[0].chConnection[0].channel[action.channel].assignedFader =
action.faderNumber
case SET_ASSIGNED_FADER:
nextState[0].chConnection[action.mixerIndex].channel[
action.channel
].assignedFader = action.faderNumber
return nextState
case SET_AUX_LEVEL: //channel: auxIndex: level:
case SET_AUX_LEVEL:
nextState[0].chConnection[0].channel[action.channel].auxLevel[
action.auxIndex
] = parseFloat(action.level)
Expand Down

0 comments on commit 5f55b95

Please sign in to comment.