73 lines
1.9 KiB
TypeScript
73 lines
1.9 KiB
TypeScript
// Metro module 10271 (f10272).
|
|
import SoundpackStore from "../soundpacks/SoundpackStore";
|
|
import StreamerModeStore from "../../stores/StreamerModeStore";
|
|
import { SoundOutputChannel } from "./Constants";
|
|
import Logger from "../debug/Logger";
|
|
import getSoundsForPack from "../soundpacks/getSoundsForPack";
|
|
import { MobileAudioSound } from "./native/SoundUtils";
|
|
let c6856_6 = new Logger("SoundUtils");
|
|
export function createSoundForPack(a0, a1, r8 = 1, r7 = SoundOutputChannel.DEFAULT) {
|
|
let r20 = getSoundsForPack(a1)[a0];
|
|
if (r20 == null) {
|
|
r20 = a0;
|
|
}
|
|
if (r8 === void 0) {
|
|
r8 = 1;
|
|
}
|
|
if (r7 === void 0) {
|
|
r7 = SoundOutputChannel.DEFAULT;
|
|
}
|
|
return new MobileAudioSound(r20, a0, r8, r7, false);
|
|
}
|
|
export function createSound(a0, a1, r9 = 1, r8 = SoundOutputChannel.DEFAULT, r7 = false) {
|
|
return new MobileAudioSound(a0, a1, r9, r8, r7);
|
|
}
|
|
export function playSound(a0, r12 = 1, r6) {
|
|
let c17823_0 = r6;
|
|
if (StreamerModeStore.disableSounds) {
|
|
return void 0;
|
|
}
|
|
const r14 = arguments[3];
|
|
let r24 = r14;
|
|
if (r24 == null) {
|
|
r24 = SoundpackStore.getSoundpack();
|
|
}
|
|
const soundsForPack = getSoundsForPack(r24);
|
|
if (soundsForPack == null) {
|
|
c6856_6.log(`Unable to find sound for pack name: ${r14}`);
|
|
}
|
|
let r34 = soundsForPack[a0];
|
|
if (r34 == null) {
|
|
r34 = a0;
|
|
}
|
|
const r35 = arguments[4];
|
|
let r36 = r35?.outputChannel;
|
|
if (r36 == null) {
|
|
r36 = SoundOutputChannel.DEFAULT;
|
|
}
|
|
let r39 = r35?.trackNotificationFailure;
|
|
if (r39 == null) {
|
|
r39 = false;
|
|
}
|
|
if (r12 === void 0) {
|
|
r12 = 1;
|
|
}
|
|
if (r36 === void 0) {
|
|
r36 = SoundOutputChannel.DEFAULT;
|
|
}
|
|
if (r39 === void 0) {
|
|
r39 = false;
|
|
}
|
|
const mobileAudioSound = new MobileAudioSound(r34, a0, r12, r36, r39);
|
|
if (r6 != null) {
|
|
mobileAudioSound.playWithListener().then((result) => {
|
|
if (result) {
|
|
c17823_0();
|
|
}
|
|
});
|
|
} else {
|
|
mobileAudioSound.play();
|
|
}
|
|
return mobileAudioSound;
|
|
}
|