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
) => { ) => {
sendBAPSicleChannel({ let new_mode = !getState().mixer.players[player].autoAdvance;
channel: player, if (process.env.REACT_APP_BAPSICLE_INTERFACE) {
command: "AUTOADVANCE", sendBAPSicleChannel({
enabled: !getState().mixer.players[player].autoAdvance, channel: player,
}); command: "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
) => { ) => {
sendBAPSicleChannel({ let new_mode = !getState().mixer.players[player].playOnLoad;
channel: player, if (process.env.REACT_APP_BAPSICLE_INTERFACE) {
command: "PLAYONLOAD", sendBAPSicleChannel({
enabled: !getState().mixer.players[player].playOnLoad, channel: player,
}); command: "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;
} }
sendBAPSicleChannel({ channel: player, command: "REPEAT", mode: playVal }); if (process.env.REACT_APP_BAPSICLE_INTERFACE) {
sendBAPSicleChannel({ channel: player, command: "REPEAT", mode: playVal });
return;
}
dispatch(mixerState.actions.setRepeat({ player, mode: playVal }));
}; };
export const redrawWavesurfers = (): AppThunk => () => { export const redrawWavesurfers = (): AppThunk => () => {