33 lines
1.2 KiB
TypeScript
33 lines
1.2 KiB
TypeScript
// Metro module 15899 (f15900).
|
|
import { useContext, useCallback } from "react";
|
|
import SoundboardStore from "./SoundboardStore";
|
|
import { SoundOutputChannel } from "../sound_playback/Constants";
|
|
import { SoundboardSettings } from "../user_settings/UserSettings";
|
|
import SoundPlayerContext from "../soundplayer/SoundPlayerContext";
|
|
import { useStateFromStores } from "../../_bundle/Module589";
|
|
import { playSound } from "./SoundboardUtils";
|
|
export default function useSoundboardSoundPlayer(a0, a1) {
|
|
let c22586_0 = a0;
|
|
if (arguments[2] === void 0) {
|
|
SoundboardSettings.getSetting()?.volume == null;
|
|
}
|
|
if (arguments[3] === void 0) {
|
|
SoundOutputChannel.DEFAULT;
|
|
}
|
|
const audioRef = useContext(SoundPlayerContext).audioRef;
|
|
const stateFromStores = useStateFromStores([SoundboardStore], () => SoundboardStore.isPlayingSound(c22586_0.soundId), [a0]);
|
|
return {
|
|
playSoundboardSound: useCallback((a0) => {
|
|
if (audioRef.current != null) {
|
|
audioRef.current.pause();
|
|
}
|
|
if (a1 != null) {
|
|
playSound(c22586_0, a1, a0);
|
|
}
|
|
}, [a0, audioRef, a1]),
|
|
isPlayingSound: stateFromStores,
|
|
previewSound: () => Promise.resolve(),
|
|
isPreviewingSound: false
|
|
};
|
|
};
|