Skip to content

Commit

Permalink
fix: limit speed of VU updates on mixers with independent VU and VU r…
Browse files Browse the repository at this point in the history
…eduction protocol
  • Loading branch information
olzzon authored and olzzon committed Oct 13, 2020
1 parent 7582ab1 commit cb59a70
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions client/utils/SocketClientHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {

export const socketClientHandlers = () => {
let vuUpdateSpeed = Date.now()
let vuReductionUpdateSpeed = Date.now()
window.socketIoClient
.on('connect', () => {
window.storeRedux.dispatch(storeSetServerOnline(true))
Expand Down Expand Up @@ -122,18 +123,25 @@ export const socketClientHandlers = () => {
}
})
.on(SOCKET_SET_VU, (payload: any) => {
window.storeRedux.dispatch({
type: SET_VU_LEVEL,
channel: payload.faderIndex,
level: payload.level,
})
if (Date.now() - vuUpdateSpeed > 100) {
vuUpdateSpeed = Date.now()

window.storeRedux.dispatch({
type: SET_VU_LEVEL,
channel: payload.faderIndex,
level: payload.level,
})
}
})
.on(SOCKET_SET_VU_REDUCTION, (payload: any) => {
window.storeRedux.dispatch({
type: SET_VU_REDUCTION_LEVEL,
channel: payload.faderIndex,
level: payload.level,
})
if (Date.now() - vuReductionUpdateSpeed > 100) {
vuReductionUpdateSpeed = Date.now()
window.storeRedux.dispatch({
type: SET_VU_REDUCTION_LEVEL,
channel: payload.faderIndex,
level: payload.level,
})
}
})
.on(SOCKET_RETURN_SNAPSHOT_LIST, (payload: any) => {
window.snapshotFileList = payload
Expand Down

0 comments on commit cb59a70

Please sign in to comment.