Skip to content

Commit

Permalink
Fix: Midas/Behringer X32 Gain reduction metering, implemented in new …
Browse files Browse the repository at this point in the history
…metering structure
  • Loading branch information
olzzon authored and olzzon committed Nov 10, 2020
1 parent d5ac426 commit de5c255
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 32 deletions.
20 changes: 8 additions & 12 deletions client/utils/SocketClientHandlers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
storeSetCompleteFaderState,
storeSetSingleFaderState,
storeVuLevel,
storeVuReductionLevel,
} from '../../server/reducers/faderActions'
import {
Expand All @@ -20,7 +19,6 @@ import {
SOCKET_SET_STORE_FADER,
SOCKET_SET_STORE_CHANNEL,
SOCKET_RETURN_CCG_LIST,
SOCKET_SET_VU_REDUCTION,
SOCKET_SET_MIXER_ONLINE,
SOCKET_RETURN_MIXER_PRESET_LIST,
SOCKET_RETURN_PAGES_LIST,
Expand All @@ -34,8 +32,6 @@ import { VuType } from '../../server/utils/vuServer'
export const vuMeters: number[][] = []

export const socketClientHandlers = () => {
let vuUpdateSpeed = Date.now()
let vuReductionUpdateSpeed = Date.now()
window.socketIoClient
.on('connect', () => {
window.storeRedux.dispatch(storeSetServerOnline(true))
Expand Down Expand Up @@ -100,14 +96,6 @@ export const socketClientHandlers = () => {
storeSetSingleChState(payload.channelIndex, payload.state)
)
})
.on(SOCKET_SET_VU_REDUCTION, (payload: any) => {
if (Date.now() - vuReductionUpdateSpeed > 100) {
vuReductionUpdateSpeed = Date.now()
window.storeRedux.dispatch(
storeVuReductionLevel(payload.faderIndex, payload.level)
)
}
})
.on(SOCKET_RETURN_SNAPSHOT_LIST, (payload: any) => {
window.snapshotFileList = payload
})
Expand All @@ -127,4 +115,12 @@ export const socketClientHandlers = () => {
vuMeters[faderIndex][channelIndex] = level
}
)
.on(
VuType.Reduction,
(faderIndex: number, channelIndex: number, level: number) => {
window.storeRedux.dispatch(
storeVuReductionLevel(faderIndex, level)
)
}
)
}
1 change: 0 additions & 1 deletion server/constants/SOCKET_IO_DISPATCHERS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export const SOCKET_CLEAR_PST = 'clearPst'
// Div:
export const SOCKET_SAVE_SETTINGS = 'saveSettings'
export const SOCKET_RESTART_SERVER = 'restartServer'
export const SOCKET_SET_VU_REDUCTION = 'setVuReduction'
export const SOCKET_GET_SNAPSHOT_LIST = 'getSnapshotList'
export const SOCKET_RETURN_SNAPSHOT_LIST = 'returnSnapshotList'
export const SOCKET_GET_CCG_LIST = 'getCcgList'
Expand Down
21 changes: 2 additions & 19 deletions server/utils/mixerConnections/productSpecific/midas.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import { store, state } from '../../../reducers/store'
import { socketServer } from '../../../expressHandler'

import { storeVuReductionLevel } from '../../../reducers/faderActions'
import { faders, IVuMeters } from '../../../reducers/fadersReducer'
import { state } from '../../../reducers/store'
import { sendVuLevel, VuType } from '../../vuServer'

export const midasMeter = (mixerIndex: number, message: any) => {
Expand All @@ -12,10 +8,6 @@ export const midasMeter = (mixerIndex: number, message: any) => {
let level: number
let reductionLevel: number
let assignedFader: number
let vuMeters: number[] = new Array(Number(state.settings[0].numberOfFaders))
let vuReductionMeters: number[] = new Array(
Number(state.settings[0].numberOfFaders)
)
let numberOfChannels =
state.settings[0].mixers[mixerIndex].numberOfChannelsInType[0]

Expand All @@ -26,16 +18,7 @@ export const midasMeter = (mixerIndex: number, message: any) => {
state.channels[0].chConnection[mixerIndex].channel[i].assignedFader
if (assignedFader < state.settings[0].numberOfFaders) {
sendVuLevel(assignedFader, VuType.Channel, 0, level)
reductionLevel = 1 - reductionLevel
store.dispatch(storeVuReductionLevel(assignedFader, reductionLevel))
sendVuLevel(assignedFader, VuType.Reduction, 0, 1 - reductionLevel)
}
}
state.faders[0].vuMeters.forEach((meter: IVuMeters, index: number) => {
// vuMeters[index] = meter.vuVal
vuReductionMeters[index] = meter.reductionVal
})
// socketServer.emit(SOCKET_SET_ALL_VU, {
// vuMeters: vuMeters,
// vuReductionMeters: vuReductionMeters,
// })
}

0 comments on commit de5c255

Please sign in to comment.