"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.stopAllSoundEffects = exports.getMusicForStage = void 0;
const cachedEnumValues_1 = require("../arrays/cachedEnumValues");
const cachedClasses_1 = require("../core/cachedClasses");
const stageToMusic_1 = require("../objects/stageToMusic");
const enums_1 = require("./enums");
/**
 * Helper function to get the corresponding music value for a stage and stage type combination.
 *
 * @param stage Optional. The stage to get the music for. If not specified, the current stage will
 *              be used.
 * @param stageType Optional. The stage type to get the music for. If not specified, the current
 *                  stage type will be used.
 */
function getMusicForStage(stage, stageType) {
    const level = cachedClasses_1.game.GetLevel();
    if (stage === undefined) {
        stage = level.GetStage();
    }
    if (stageType === undefined) {
        stageType = level.GetStageType();
    }
    const stageTypeToMusic = stageToMusic_1.STAGE_TO_MUSIC[stage];
    return stageTypeToMusic[stageType];
}
exports.getMusicForStage = getMusicForStage;
/**
 * Helper function to manually stop every vanilla sound effect. If you also want to stop custom
 * sound effects in addition to vanilla ones, then pass the `SoundEffectCustom` enum for your mod.
 *
 * @param soundEffectCustom Optional. The enum that represents all of the custom sound effects for
 *                          your mod.
 */
function stopAllSoundEffects(soundEffectCustom) {
    for (const soundEffect of cachedEnumValues_1.SOUND_EFFECT_VALUES) {
        cachedClasses_1.sfxManager.Stop(soundEffect);
    }
    if (soundEffectCustom !== undefined) {
        for (const soundEffect of (0, enums_1.getEnumValues)(soundEffectCustom)) {
            cachedClasses_1.sfxManager.Stop(soundEffect);
        }
    }
}
exports.stopAllSoundEffects = stopAllSoundEffects;
