Source: SoundManager.js

SoundManager.js

//-----------------------------------------------------------------------------
// SoundManager
//
// The static class that plays sound effects defined in the database.
/**
 * The static class that manages static sound effects in the game
 *
 * @namespace
 */
function SoundManager() {
    throw new Error("This is a static class");
}

/**
 * Preloads the cursor, ok, cancel, and buzzer sounds
 *
 * @static
 */
SoundManager.preloadImportantSounds = function() {
    this.loadSystemSound(0);
    this.loadSystemSound(1);
    this.loadSystemSound(2);
    this.loadSystemSound(3);
};

/**
 * Loads the system sound in the $dataSystem.sounds array at given index
 *
 * @static
 * @param {number} n - The index of the sound to load
 */
SoundManager.loadSystemSound = function(n) {
    if ($dataSystem) {
        AudioManager.loadStaticSe($dataSystem.sounds[n]);
    }
};

/**
 * Plays the system sound in the $dataSystem.sounds array at given index
 *
 * @static
 * @param {number} n - The index of the sound to play
 */
SoundManager.playSystemSound = function(n) {
    if ($dataSystem) {
        AudioManager.playStaticSe($dataSystem.sounds[n]);
    }
};

/**
 * Plays the 1st system sound from $dataSystem
 *
 * @static
 */
SoundManager.playCursor = function() {
    this.playSystemSound(0);
};

/**
 * Plays the 2nd system sound from $dataSystem
 *
 * @static
 */
SoundManager.playOk = function() {
    this.playSystemSound(1);
};

/**
 * Plays the 3rd system sound from $dataSystem
 *
 * @static
 */
SoundManager.playCancel = function() {
    this.playSystemSound(2);
};

/**
 * Plays the 4th system sound from $dataSystem
 *
 * @static
 */
SoundManager.playBuzzer = function() {
    this.playSystemSound(3);
};

/**
 * Plays the 5th system sound from $dataSystem
 *
 * @static
 */
SoundManager.playEquip = function() {
    this.playSystemSound(4);
};

/**
 * Plays the 6th system sound from $dataSystem
 *
 * @static
 */
SoundManager.playSave = function() {
    this.playSystemSound(5);
};

/**
 * Plays the 7th system sound from $dataSystem
 *
 * @static
 */
SoundManager.playLoad = function() {
    this.playSystemSound(6);
};

/**
 * Plays the 8th system sound from $dataSystem
 *
 * @static
 */
SoundManager.playBattleStart = function() {
    this.playSystemSound(7);
};

/**
 * Plays the 9th system sound from $dataSystem
 *
 * @static
 */
SoundManager.playEscape = function() {
    this.playSystemSound(8);
};

/**
 * Plays the 10th system sound from $dataSystem
 *
 * @static
 */
SoundManager.playEnemyAttack = function() {
    this.playSystemSound(9);
};

/**
 * Plays the 11th system sound from $dataSystem
 *
 * @static
 */
SoundManager.playEnemyDamage = function() {
    this.playSystemSound(10);
};

/**
 * Plays the 12th system sound from $dataSystem
 *
 * @static
 */
SoundManager.playEnemyCollapse = function() {
    this.playSystemSound(11);
};

/**
 * Plays the 13th system sound from $dataSystem
 *
 * @static
 */
SoundManager.playBossCollapse1 = function() {
    this.playSystemSound(12);
};

/**
 * Plays the 14th system sound from $dataSystem
 *
 * @static
 */
SoundManager.playBossCollapse2 = function() {
    this.playSystemSound(13);
};

/**
 * Plays the 15th system sound from $dataSystem
 *
 * @static
 */
SoundManager.playActorDamage = function() {
    this.playSystemSound(14);
};

/**
 * Plays the 16th system sound from $dataSystem
 *
 * @static
 */
SoundManager.playActorCollapse = function() {
    this.playSystemSound(15);
};

/**
 * Plays the 17th system sound from $dataSystem
 *
 * @static
 */
SoundManager.playRecovery = function() {
    this.playSystemSound(16);
};

/**
 * Plays the 18th system sound from $dataSystem
 *
 * @static
 */
SoundManager.playMiss = function() {
    this.playSystemSound(17);
};

/**
 * Plays the 19th system sound from $dataSystem
 *
 * @static
 */
SoundManager.playEvasion = function() {
    this.playSystemSound(18);
};

/**
 * Plays the 20th system sound from $dataSystem
 *
 * @static
 */
SoundManager.playMagicEvasion = function() {
    this.playSystemSound(19);
};

/**
 * Plays the 21st system sound from $dataSystem
 *
 * @static
 */
SoundManager.playReflection = function() {
    this.playSystemSound(20);
};

/**
 * Plays the 22nd system sound from $dataSystem
 *
 * @static
 */
SoundManager.playShop = function() {
    this.playSystemSound(21);
};

/**
 * Plays the 23rd system sound from $dataSystem
 *
 * @static
 */
SoundManager.playUseItem = function() {
    this.playSystemSound(22);
};

/**
 * Plays the 24th system sound from $dataSystem
 *
 * @static
 */
SoundManager.playUseSkill = function() {
    this.playSystemSound(23);
};