Fix Auto Advanced/PlayLoad/Repeat buttons.

This commit is contained in:
Matthew Stratford 2021-06-03 23:40:03 +01:00
parent f753cc3a7b
commit a6144b2eab

View file

@ -866,22 +866,32 @@ export const toggleAutoAdvance = (player: number): AppThunk => (
dispatch, dispatch,
getState getState
) => { ) => {
let new_mode = !getState().mixer.players[player].autoAdvance;
if (process.env.REACT_APP_BAPSICLE_INTERFACE) {
sendBAPSicleChannel({ sendBAPSicleChannel({
channel: player, channel: player,
command: "AUTOADVANCE", command: "AUTOADVANCE",
enabled: !getState().mixer.players[player].autoAdvance, enabled: new_mode,
}); });
return;
}
dispatch(mixerState.actions.setAutoAdvance({ player, enabled: new_mode }));
}; };
export const togglePlayOnLoad = (player: number): AppThunk => ( export const togglePlayOnLoad = (player: number): AppThunk => (
dispatch, dispatch,
getState getState
) => { ) => {
let new_mode = !getState().mixer.players[player].playOnLoad;
if (process.env.REACT_APP_BAPSICLE_INTERFACE) {
sendBAPSicleChannel({ sendBAPSicleChannel({
channel: player, channel: player,
command: "PLAYONLOAD", command: "PLAYONLOAD",
enabled: !getState().mixer.players[player].playOnLoad, enabled: new_mode,
}); });
return;
}
dispatch(mixerState.actions.setPlayOnLoad({ player, enabled: new_mode }));
}; };
export const toggleRepeat = (player: number): AppThunk => ( export const toggleRepeat = (player: number): AppThunk => (
@ -900,7 +910,11 @@ export const toggleRepeat = (player: number): AppThunk => (
playVal = "none"; playVal = "none";
break; break;
} }
if (process.env.REACT_APP_BAPSICLE_INTERFACE) {
sendBAPSicleChannel({ channel: player, command: "REPEAT", mode: playVal }); sendBAPSicleChannel({ channel: player, command: "REPEAT", mode: playVal });
return;
}
dispatch(mixerState.actions.setRepeat({ player, mode: playVal }));
}; };
export const redrawWavesurfers = (): AppThunk => () => { export const redrawWavesurfers = (): AppThunk => () => {