decord/alpha/source/modules/sound_playback/SoundUtils.tsx

121 lines
3.5 KiB
TypeScript
Raw Permalink Normal View History

2026-10-10 08:08:14 +00:00
// Module ID: 10980
// Function ID: 10981
// Name: SoundUtils
2026-10-10 08:08:14 +00:00
// Dependencies: [10981, 4963, 5248, 3, 10983, 10984, 2]
2026-07-29 08:29:29 +00:00
// Exports: createSound, createSoundForPack, playSound
2026-07-20 16:05:17 +00:00
2026-10-10 08:08:14 +00:00
// Module 10980 (SoundUtils)
import LoggerDefault from "Logger" /* 3 */;
2026-10-10 08:08:14 +00:00
import Constants from "Constants" /* 5248 */;
import getSoundsForPackDefault from "getSoundsForPack" /* 10983 */;
import sound_playback_SoundUtils from "sound_playback/SoundUtils" /* 10984 */;
import SoundpackStore from "SoundpackStore" /* 10981 */;
import StreamerModeStore from "StreamerModeStore" /* 4963 */;
2026-10-03 08:58:59 +00:00
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-10-03 08:58:59 +00:00
const SoundOutputChannel = Constants.SoundOutputChannel;
const tmp2 = new LoggerDefault("SoundUtils");
const logger = tmp2;
const result = size.fileFinishedImporting("modules/sound_playback/SoundUtils.tsx");
2026-07-29 08:29:29 +00:00
export const createSoundForPack = function createSoundForPack(call_calling, soundpack) {
let num = arg2;
if (arg2 === undefined) {
2026-07-20 16:05:17 +00:00
num = 1;
}
2026-07-29 08:29:29 +00:00
let DEFAULT = arg3;
if (arg3 === undefined) {
2026-07-20 16:05:17 +00:00
DEFAULT = SoundOutputChannel.DEFAULT;
}
let tmp3 = getSoundsForPackDefault(soundpack)[call_calling];
2026-07-29 08:29:29 +00:00
if (tmp3 == null) {
tmp3 = call_calling;
}
if (num === undefined) {
num = 1;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (DEFAULT === undefined) {
DEFAULT = SoundOutputChannel.DEFAULT;
}
const mobileAudioSound = new sound_playback_SoundUtils.MobileAudioSound(tmp3, call_calling, num, DEFAULT, false);
2026-07-20 16:05:17 +00:00
return mobileAudioSound;
2026-07-29 08:29:29 +00:00
};
export const createSound = function createSound(stage_waiting, vibing_wumpus, arg2) {
2026-07-20 16:05:17 +00:00
let num = arg2;
if (arg2 === undefined) {
num = 1;
}
2026-07-29 08:29:29 +00:00
let DEFAULT = arg3;
if (arg3 === undefined) {
2026-07-20 16:05:17 +00:00
DEFAULT = SoundOutputChannel.DEFAULT;
}
2026-07-29 08:29:29 +00:00
let flag = arg4;
if (arg4 === undefined) {
flag = false;
2026-07-20 16:05:17 +00:00
}
const mobileAudioSound = new sound_playback_SoundUtils.MobileAudioSound(stage_waiting, vibing_wumpus, num, DEFAULT, flag);
2026-07-29 08:29:29 +00:00
return mobileAudioSound;
2026-07-20 16:05:17 +00:00
};
export const playSound = function playSound(arg0, arg1, arg2, arg3, outputChannel) {
let num = arg1;
if (arg1 === undefined) {
num = 1;
}
2026-10-03 08:58:59 +00:00
let closure_0 = arg2;
if (!StreamerModeStore.disableSounds) {
2026-10-03 08:58:59 +00:00
let tmp = arg3;
2026-07-20 16:05:17 +00:00
let soundpack = arg3;
2026-10-03 08:58:59 +00:00
const tmp4 = getSoundsForPackDefault;
2026-07-29 08:29:29 +00:00
if (arg3 == null) {
soundpack = SoundpackStore.getSoundpack();
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
const tmp4Result = tmp4(soundpack);
2026-07-29 08:29:29 +00:00
if (null == tmp4Result) {
2026-07-20 16:05:17 +00:00
const _HermesInternal = HermesInternal;
2026-08-24 06:08:38 +00:00
logger.log("Unable to find sound for pack name: " + arg3);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp13 = tmp4Result[arg0];
if (tmp13 == null) {
tmp13 = arg0;
2026-07-20 16:05:17 +00:00
}
outputChannel = undefined;
2026-07-29 08:29:29 +00:00
if (outputChannel != null) {
2026-07-20 16:05:17 +00:00
outputChannel = outputChannel.outputChannel;
}
2026-07-29 08:29:29 +00:00
if (outputChannel == null) {
outputChannel = SoundOutputChannel.DEFAULT;
}
let flag;
if (outputChannel != null) {
flag = outputChannel.trackNotificationFailure;
}
if (flag == null) {
flag = false;
}
if (num === undefined) {
num = 1;
}
if (outputChannel === undefined) {
2026-07-20 16:05:17 +00:00
outputChannel = SoundOutputChannel.DEFAULT;
}
2026-07-29 08:29:29 +00:00
if (flag === undefined) {
flag = false;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
const self = this;
const self2 = this;
const mobileAudioSound = new sound_playback_SoundUtils.MobileAudioSound(tmp13, arg0, num, outputChannel, flag);
2026-07-20 16:05:17 +00:00
if (null != arg2) {
2026-10-03 08:58:59 +00:00
const playWithListenerResult = mobileAudioSound.playWithListener();
playWithListenerResult.then((result) => {
const tmp = result;
if (tmp) {
closure_0();
2026-07-20 16:05:17 +00:00
}
});
} else {
2026-07-29 08:29:29 +00:00
mobileAudioSound.play();
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return mobileAudioSound;
2026-07-20 16:05:17 +00:00
}
};