Add a clear PFL button

This commit is contained in:
Matthew Stratford 2021-01-15 23:15:03 +00:00
parent cc5f24580d
commit 796f1ffcb8
No known key found for this signature in database
GPG key ID: 9E53C8B3F0B57395
2 changed files with 20 additions and 2 deletions

View file

@ -781,8 +781,16 @@ export const setChannelPFL = (
dispatch(setVolume(player, "off", false));
dispatch(play(player));
}
dispatch(mixerState.actions.setPlayerPFL({ player, enabled }));
audioEngine.setPFL(player, enabled);
// If the player number is -1, do all channels.
if (player === -1) {
for (let i = 0; i < audioEngine.players.length; i++) {
dispatch(mixerState.actions.setPlayerPFL({ player: i, enabled: false }));
audioEngine.setPFL(i, false);
}
} else {
dispatch(mixerState.actions.setPlayerPFL({ player, enabled }));
audioEngine.setPFL(player, enabled);
}
};
export const openMicrophone = (

View file

@ -11,6 +11,7 @@ import {
FaSpinner,
FaExclamationTriangle,
FaCog,
FaHeadphonesAlt,
} from "react-icons/fa";
import { RootState } from "../rootReducer";
@ -26,6 +27,7 @@ import { VUMeter } from "../optionsMenu/helpers/VUMeter";
import { getShowplan, setItemPlayed } from "../showplanner/state";
import * as OptionsMenuState from "../optionsMenu/state";
import { setChannelPFL } from "../mixer/state";
function nicifyConnectionState(state: ConnectionStateEnum): string {
switch (state) {
@ -288,6 +290,14 @@ export function NavBarMain() {
>
<FaCog size={17} /> Options
</li>
{settings.proMode && (
<li
className="btn btn-danger rounded-0 pt-2 pb-1 nav-item nav-link"
onClick={() => dispatch(setChannelPFL(-1, false))}
>
<FaHeadphonesAlt size={17} /> Clear PFL
</li>
)}
<li className="nav-item px-2 nav-vu">
<VUMeter