2000-10-10 01:30:58 +02:00
|
|
|
/*
|
|
|
|
position
|
|
|
|
adjust channels ( watery-mario64 style music changes )
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2000-10-05 16:16:09 +02:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
sound.cpp
|
|
|
|
|
|
|
|
Author: PKG
|
|
|
|
Created:
|
|
|
|
Project: Spongebob
|
|
|
|
Purpose:
|
|
|
|
|
|
|
|
Copyright (c) 2000 Climax Development Ltd
|
|
|
|
|
|
|
|
===========================================================================*/
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Includes
|
|
|
|
-------- */
|
|
|
|
|
|
|
|
#include "sound.h"
|
|
|
|
|
|
|
|
#ifndef __SYSTEM_DBG_H__
|
|
|
|
#include "system\dbg.h"
|
|
|
|
#endif
|
|
|
|
|
2000-10-11 18:47:03 +02:00
|
|
|
#ifndef __UTILS_HEADER__
|
|
|
|
#include "utils\utils.h"
|
|
|
|
#endif
|
|
|
|
|
2000-10-10 01:30:58 +02:00
|
|
|
|
2000-10-05 16:16:09 +02:00
|
|
|
/* Std Lib
|
|
|
|
------- */
|
|
|
|
|
|
|
|
/* Data
|
|
|
|
---- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Tyepdefs && Defines
|
|
|
|
------------------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Structure defintions
|
|
|
|
-------------------- */
|
|
|
|
|
2001-01-19 17:25:05 +01:00
|
|
|
typedef struct XMSONGDATA
|
2000-10-05 16:16:09 +02:00
|
|
|
{
|
|
|
|
FileEquate m_vh,m_vb,m_pxm;
|
2001-01-19 17:25:05 +01:00
|
|
|
int m_startPattern;
|
2000-10-05 16:16:09 +02:00
|
|
|
};
|
|
|
|
|
2001-01-19 17:25:05 +01:00
|
|
|
|
|
|
|
typedef struct XMSFXFILEDATA
|
|
|
|
{
|
|
|
|
FileEquate m_vh,m_vb,m_pxm;
|
|
|
|
};
|
2000-10-06 00:40:39 +02:00
|
|
|
typedef struct SFXDETAILS
|
|
|
|
{
|
2000-10-10 00:06:20 +02:00
|
|
|
int m_channelMask;
|
2000-10-10 01:30:58 +02:00
|
|
|
int m_pattern; // ..or instrument number for loopers
|
2000-10-06 00:40:39 +02:00
|
|
|
int m_looping;
|
|
|
|
};
|
|
|
|
|
2000-10-05 16:16:09 +02:00
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function Prototypes
|
|
|
|
------------------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Vars
|
|
|
|
---- */
|
|
|
|
|
2000-10-10 01:30:58 +02:00
|
|
|
// Static stuff for CSoundMediator
|
|
|
|
int CSoundMediator::s_initialised=false;
|
|
|
|
|
|
|
|
int CSoundMediator::s_currentVolume[CSoundMediator::NUM_VOLUMETYPES];
|
|
|
|
int CSoundMediator::s_targetVolume[CSoundMediator::NUM_VOLUMETYPES];
|
|
|
|
int CSoundMediator::s_volumeDirty[CSoundMediator::NUM_VOLUMETYPES];
|
|
|
|
|
|
|
|
xmSampleId CSoundMediator::s_songSampleId=NO_SAMPLE;
|
2001-03-29 03:32:14 +02:00
|
|
|
FileEquate CSoundMediator::s_songVh=(FileEquate)-1;
|
2000-10-10 01:30:58 +02:00
|
|
|
xmModId CSoundMediator::s_songModId=NO_SONG;
|
2001-03-29 03:32:14 +02:00
|
|
|
FileEquate CSoundMediator::s_songPxm=(FileEquate)-1;
|
2000-10-10 01:30:58 +02:00
|
|
|
xmPlayingId CSoundMediator::s_songPlayingId=NOT_PLAYING;
|
2001-01-19 17:25:05 +01:00
|
|
|
int CSoundMediator::s_songStartPattern=0;
|
2000-10-10 01:30:58 +02:00
|
|
|
xmSampleId CSoundMediator::s_sfxSampleId=NO_SAMPLE;
|
|
|
|
xmModId CSoundMediator::s_sfxModId=NO_SONG;
|
|
|
|
|
2001-07-09 17:27:30 +02:00
|
|
|
int CSoundMediator::s_canPlaySfx=true;
|
|
|
|
|
|
|
|
|
2000-10-10 01:30:58 +02:00
|
|
|
static CSpuSound *s_spuSound;
|
|
|
|
static CXMPlaySound *s_xmplaySound;
|
|
|
|
|
|
|
|
|
|
|
|
// Songs
|
2001-01-19 17:25:05 +01:00
|
|
|
static XMSONGDATA s_xmSongData[CSoundMediator::NUM_SONGIDS]=
|
2000-10-05 16:16:09 +02:00
|
|
|
{
|
2001-01-29 18:55:07 +01:00
|
|
|
// m_vh m_vb m_pxm m_startPattern;
|
2001-01-22 16:41:26 +01:00
|
|
|
{ MUSIC_SB_TITLE_VH, MUSIC_SB_TITLE_VB, MUSIC_SB_TITLE_PXM, 0x00 }, // SONG_TITLE
|
|
|
|
{ MUSIC_SB_TITLE_VH, MUSIC_SB_TITLE_VB, MUSIC_SB_TITLE_PXM, 0x0a }, // SONG_OPTIONS
|
2001-01-19 17:25:05 +01:00
|
|
|
{ MUSIC_SB_TITLE_VH, MUSIC_SB_TITLE_VB, MUSIC_SB_TITLE_PXM, 0x13 }, // SONG_MEMORYCARD
|
|
|
|
{ MUSIC_SB_TITLE_VH, MUSIC_SB_TITLE_VB, MUSIC_SB_TITLE_PXM, 0x14 }, // SONG_GAMECOMPLETE
|
|
|
|
{ MUSIC_SB_TITLE_VH, MUSIC_SB_TITLE_VB, MUSIC_SB_TITLE_PXM, 0x23 }, // SONG_GAMEOVER
|
2001-07-02 18:29:53 +02:00
|
|
|
{ MUSIC_SB_TITLE_VH, MUSIC_SB_TITLE_VB, MUSIC_SB_TITLE_PXM, 0x25 }, // SONG_PARTY
|
|
|
|
{ MUSIC_SB_TITLE_VH, MUSIC_SB_TITLE_VB, MUSIC_SB_TITLE_PXM, 0x2c }, // SONG_MEMCARD2
|
|
|
|
{ MUSIC_SB_TITLE_VH, MUSIC_SB_TITLE_VB, MUSIC_SB_TITLE_PXM, 0x2f }, // SONG_MAPSCREEN
|
|
|
|
{ MUSIC_SB_TITLE_VH, MUSIC_SB_TITLE_VB, MUSIC_SB_TITLE_PXM, 0x33 }, // SONG_SHOPSCREEN
|
2001-07-04 16:32:35 +02:00
|
|
|
{ MUSIC_FMA_VH, MUSIC_FMA_VB, MUSIC_FMA_PXM, 0x00 }, // SONG_FMA
|
2001-01-22 16:41:26 +01:00
|
|
|
{ MUSIC_CHAPTER1_VH, MUSIC_CHAPTER1_VB, MUSIC_CHAPTER1_PXM, 0x19 }, // SONG_CHAPTER1_LEVEL1,
|
|
|
|
{ MUSIC_CHAPTER1_VH, MUSIC_CHAPTER1_VB, MUSIC_CHAPTER1_PXM, 0x2d }, // SONG_CHAPTER1_LEVEL2,
|
|
|
|
{ MUSIC_CHAPTER1_VH, MUSIC_CHAPTER1_VB, MUSIC_CHAPTER1_PXM, 0x00 }, // SONG_CHAPTER1_LEVEL3,
|
|
|
|
{ MUSIC_CHAPTER1_VH, MUSIC_CHAPTER1_VB, MUSIC_CHAPTER1_PXM, 0x2c }, // SONG_CHAPTER1_LEVEL4,
|
|
|
|
{ MUSIC_CHAPTER1_VH, MUSIC_CHAPTER1_VB, MUSIC_CHAPTER1_PXM, 0x40 }, // SONG_CHAPTER1_BOSS,
|
2001-01-22 23:49:58 +01:00
|
|
|
{ MUSIC_CHAPTER2_VH, MUSIC_CHAPTER2_VB, MUSIC_CHAPTER2_PXM, 0x00 }, // SONG_CHAPTER2_LEVEL1,
|
|
|
|
{ MUSIC_CHAPTER2_VH, MUSIC_CHAPTER2_VB, MUSIC_CHAPTER2_PXM, 0x16 }, // SONG_CHAPTER2_LEVEL2,
|
|
|
|
{ MUSIC_CHAPTER2_VH, MUSIC_CHAPTER2_VB, MUSIC_CHAPTER2_PXM, 0x00 }, // SONG_CHAPTER2_LEVEL3,
|
2001-06-29 18:10:33 +02:00
|
|
|
{ MUSIC_CHAPTER2_VH, MUSIC_CHAPTER2_VB, MUSIC_CHAPTER2_PXM, 0x2e }, // SONG_CHAPTER2_LEVEL4,
|
|
|
|
{ MUSIC_CHAPTER2_VH, MUSIC_CHAPTER2_VB, MUSIC_CHAPTER2_PXM, 0x3e }, // SONG_CHAPTER2_BOSS,
|
2001-01-22 23:49:58 +01:00
|
|
|
{ MUSIC_CHAPTER3_VH, MUSIC_CHAPTER3_VB, MUSIC_CHAPTER3_PXM, 0x18 }, // SONG_CHAPTER3_LEVEL1,
|
|
|
|
{ MUSIC_CHAPTER3_VH, MUSIC_CHAPTER3_VB, MUSIC_CHAPTER3_PXM, 0x00 }, // SONG_CHAPTER3_LEVEL2,
|
|
|
|
{ MUSIC_CHAPTER3_VH, MUSIC_CHAPTER3_VB, MUSIC_CHAPTER3_PXM, 0x00 }, // SONG_CHAPTER3_LEVEL3,
|
|
|
|
{ MUSIC_CHAPTER3_VH, MUSIC_CHAPTER3_VB, MUSIC_CHAPTER3_PXM, 0x0b }, // SONG_CHAPTER3_LEVEL4,
|
|
|
|
{ MUSIC_CHAPTER3_VH, MUSIC_CHAPTER3_VB, MUSIC_CHAPTER3_PXM, 0x21 }, // SONG_CHAPTER3_BOSS_ASLEEP,
|
|
|
|
{ MUSIC_CHAPTER3_VH, MUSIC_CHAPTER3_VB, MUSIC_CHAPTER3_PXM, 0x22 }, // SONG_CHAPTER3_BOSS_AWAKE,
|
2001-01-29 18:55:07 +01:00
|
|
|
{ MUSIC_CHAPTER4_VH, MUSIC_CHAPTER4_VB, MUSIC_CHAPTER4_PXM, 0x1b }, // SONG_CHAPTER4_LEVEL1,
|
|
|
|
{ MUSIC_CHAPTER4_VH, MUSIC_CHAPTER4_VB, MUSIC_CHAPTER4_PXM, 0x00 }, // SONG_CHAPTER4_LEVEL2,
|
|
|
|
{ MUSIC_CHAPTER4_VH, MUSIC_CHAPTER4_VB, MUSIC_CHAPTER4_PXM, 0x2c }, // SONG_CHAPTER4_LEVEL3,
|
|
|
|
{ MUSIC_CHAPTER4_VH, MUSIC_CHAPTER4_VB, MUSIC_CHAPTER4_PXM, 0x00 }, // SONG_CHAPTER4_LEVEL4,
|
|
|
|
{ MUSIC_CHAPTER4_VH, MUSIC_CHAPTER4_VB, MUSIC_CHAPTER4_PXM, 0x3c }, // SONG_CHAPTER4_BOSS,
|
|
|
|
{ MUSIC_CHAPTER5_VH, MUSIC_CHAPTER5_VB, MUSIC_CHAPTER5_PXM, 0x00 }, // SONG_CHAPTER5_LEVEL1,
|
|
|
|
{ MUSIC_CHAPTER5_VH, MUSIC_CHAPTER5_VB, MUSIC_CHAPTER5_PXM, 0x14 }, // SONG_CHAPTER5_LEVEL2,
|
|
|
|
{ MUSIC_CHAPTER5_VH, MUSIC_CHAPTER5_VB, MUSIC_CHAPTER5_PXM, 0x00 }, // SONG_CHAPTER5_LEVEL3,
|
|
|
|
{ MUSIC_CHAPTER5_VH, MUSIC_CHAPTER5_VB, MUSIC_CHAPTER5_PXM, 0x2a }, // SONG_CHAPTER5_LEVEL4,
|
|
|
|
{ MUSIC_CHAPTER5_VH, MUSIC_CHAPTER5_VB, MUSIC_CHAPTER5_PXM, 0x3e }, // SONG_CHAPTER5_BOSS,
|
2001-01-29 21:08:14 +01:00
|
|
|
{ MUSIC_CHAPTER6_VH, MUSIC_CHAPTER6_VB, MUSIC_CHAPTER6_PXM, 0x00 }, // SONG_CHAPTER6_ROLLERCOASTER
|
|
|
|
{ MUSIC_CHAPTER6_VH, MUSIC_CHAPTER6_VB, MUSIC_CHAPTER6_PXM, 0x00 }, // SONG_CHAPTER6_SNAILRACE
|
|
|
|
{ MUSIC_CHAPTER6_VH, MUSIC_CHAPTER6_VB, MUSIC_CHAPTER6_PXM, 0x0c }, // SONG_CHAPTER6_BIGWHEEL
|
|
|
|
{ MUSIC_CHAPTER6_VH, MUSIC_CHAPTER6_VB, MUSIC_CHAPTER6_PXM, 0x0c }, // SONG_CHAPTER6_TUNNELOFLOVE
|
|
|
|
{ MUSIC_CHAPTER6_VH, MUSIC_CHAPTER6_VB, MUSIC_CHAPTER6_PXM, 0x15 }, // SONG_CHAPTER6_GHOSTTRAIN
|
|
|
|
{ MUSIC_CHAPTER6_VH, MUSIC_CHAPTER6_VB, MUSIC_CHAPTER6_PXM, 0x2b }, // SONG_CHAPTER6_BIGTOP
|
2000-10-05 16:16:09 +02:00
|
|
|
};
|
|
|
|
|
2000-10-10 01:30:58 +02:00
|
|
|
// SFX banks
|
2001-01-19 17:25:05 +01:00
|
|
|
static XMSFXFILEDATA s_xmSfxData[CSoundMediator::NUM_SFXBANKIDS]=
|
2000-10-05 16:16:09 +02:00
|
|
|
{
|
2001-01-29 18:55:07 +01:00
|
|
|
// m_vh m_vb m_pxm
|
2001-01-03 21:43:49 +01:00
|
|
|
{ SFX_INGAME_VH, SFX_INGAME_VB, SFX_INGAME_PXM }, // SFX_INGAME
|
2000-10-05 16:16:09 +02:00
|
|
|
};
|
|
|
|
|
2000-10-10 01:30:58 +02:00
|
|
|
// Individual SFX details
|
2001-01-29 18:55:07 +01:00
|
|
|
static SFXDETAILS s_sfxDetails[CSoundMediator::NUM_SFXIDS]=
|
2000-10-06 00:40:39 +02:00
|
|
|
{
|
2001-01-29 18:55:07 +01:00
|
|
|
// m_channelMask m_pattern m_looping
|
2001-01-30 22:38:06 +01:00
|
|
|
{ 1, 0, 0 }, // SFX_SPONGEBOB_WALK_1
|
|
|
|
{ 1, 1, 0 }, // SFX_SPONGEBOB_WALK_2
|
|
|
|
{ 1, 2, 0 }, // SFX_SPONGEBOB_SQUEAKY_SHOES_1
|
|
|
|
{ 1, 3, 0 }, // SFX_SPONGEBOB_SQUEAKY_SHOES_2
|
|
|
|
{ 1, 4, 0 }, // SFX_SPONGEBOB_JUMP
|
|
|
|
{ 1, 5, 0 }, // SFX_SPONGEBOB_BUTTBOUNCE
|
|
|
|
{ 1, 6, 0 }, // SFX_SPONGEBOB_BLINK
|
|
|
|
{ 3, 7, 0 }, // SFX_BUBBLE_WAND*
|
|
|
|
{ 1, 8, 0 }, // SFX_SPONGEBOB_DEFEATED_JINGLE
|
|
|
|
{ 1, 9, 0 }, // SFX_BALLOON_INFLATE
|
|
|
|
{ 1, 21, 0 }, // SFX_BALLOON_POP
|
|
|
|
{ 1, 10, 0 }, // SFX_GLASSES_ON
|
|
|
|
{ 1, 11, 0 }, // SFX_JELLY_LAUNCHER
|
|
|
|
{ 1, 12, 0 }, // SFX_SPONGEBOB_KARATE_1
|
|
|
|
{ 1, 13, 0 }, // SFX_SPONGEBOB_KARATE_2
|
|
|
|
{ 1, 14, 0 }, // SFX_SPONGEBOB_ATTACK_IMPACT_WITH_ENEMY_1
|
|
|
|
{ 1, 15, 0 }, // SFX_SPONGEBOB_ATTACK_IMPACT_WITH_ENEMY_2
|
|
|
|
{ 1, 16, 0 }, // SFX_SPONGEBOB_LAND_AFTER_FALL
|
|
|
|
{ 1, 17, 0 }, // SFX_SPONGEBOB_NET
|
|
|
|
{ 1, 18, 0 }, // SFX_ANEMONE_ATTACK_LEVEL1
|
|
|
|
{ 1, 19, 0 }, // SFX_ANEMONE_ATTACK_LEVEL2
|
|
|
|
{ 1, 20, 0 }, // SFX_ANEMONE_ATTACK_LEVEL3
|
|
|
|
{ 1, 21, 0 }, // SFX_ANEMONE_DEFEATED_LEVEL1
|
|
|
|
{ 1, 21, 0 }, // SFX_ANEMONE_DEFEATED_LEVEL2
|
|
|
|
{ 1, 22, 0 }, // SFX_ANEMONE_DEFEATED_LEVEL3
|
|
|
|
{ 1, 23, 0 }, // SFX_ANEMONE_MOVE
|
|
|
|
{ 1, 24, 0 }, // SFX_ANGLER_FISH_MOVE
|
|
|
|
{ 1, 25, 0 }, // SFX_BALL_BLOB_MOVE
|
|
|
|
{ 1, 26, 0 }, // SFX_BALL_BLOB_ATTACK
|
|
|
|
{ 1, 27, 0 }, // SFX_BEANIE_MOVE
|
|
|
|
{ 3, 28, 0 }, // SFX_BOOGER_MOVE*
|
|
|
|
{ 1, 29, 0 }, // SFX_CLAM_ATTACK
|
|
|
|
{ 1, 30, 0 }, // SFX_CLAM_DEFEATED
|
|
|
|
{ 1, 31, 0 }, // SFX_CLAM_MOVE
|
|
|
|
{ 3, 32, 0 }, // SFX_EYEBALL_SENTRY_ATTACK*
|
|
|
|
{ 3, 33, 0 }, // SFX_EYEBALL_SENTRY_MOVE*
|
|
|
|
{ 1, 34, 0 }, // SFX_FISH_HOOK_MOVE
|
|
|
|
{ 3, 35, 0 }, // SFX_FLAMING_SKULL_MOVE*
|
|
|
|
{ 1, 36, 0 }, // SFX_FLAMING_SKULL_DEFEATED
|
|
|
|
{ 3, 37, 0 }, // SFX_FLAMING_SKULL_ATTACK*
|
|
|
|
{ 1, 38, 0 }, // SFX_GARY_DE_SNAIL
|
|
|
|
{ 3, 39, 0 }, // SFX_GHOST*
|
|
|
|
{ 1, 40, 0 }, // SFX_FISH_FOLK_MOVE_1
|
|
|
|
{ 1, 41, 0 }, // SFX_FISH_FOLK_MOVE_2
|
|
|
|
{ 1, 42, 0 }, // SFX_CANNING_MACHINE
|
|
|
|
{ 3, 43, 0 }, // SFX_LAVA*
|
|
|
|
{ 1, 44, 0 }, // SFX_ROLLING_ROCK
|
|
|
|
{ 1, 45, 0 }, // SFX_SAW
|
|
|
|
{ 3, 46, 0 }, // SFX_WHIRLPOOL_DRAIN*
|
|
|
|
{ 3, 47, 0 }, // SFX_WHIRLPOOL_WHIRL*
|
|
|
|
{ 1, 48, 0 }, // SFX_HERMIT_CRAB_ATTACK
|
|
|
|
{ 1, 49, 0 }, // SFX_HERMIT_CRAB_MOVE
|
|
|
|
{ 3, 50, 0 }, // SFX_HAZARD__ACID_DROP*
|
|
|
|
{ 3, 51, 0 }, // SFX_HAZARD__ACORN_LAND*
|
|
|
|
{ 3, 52, 0 }, // SFX_HAZARD__BLADE_ATTACK*
|
|
|
|
{ 3, 53, 0 }, // SFX_HAZARD__BLADE_MOVE*
|
|
|
|
{ 1, 54, 0 }, // SFX_HAZARD__ROPE_MOVE
|
|
|
|
{ 3, 55, 0 }, // SFX_HAZARD__ROPE_SNAP*
|
|
|
|
{ 1, 56, 0 }, // SFX_ANY_OBJECT_FALLING
|
|
|
|
{ 3, 57, 0 }, // SFX_HAZARD__FIREBALL_LAND*
|
|
|
|
{ 3, 58, 0 }, // SFX_HAZARD__FIREBALL_LAUNCH*
|
|
|
|
{ 3, 59, 0 }, // SFX_HAZARD__FALLING_ROCK_FALL*
|
|
|
|
{ 3, 60, 0 }, // SFX_HAZARD__FALLING_ROCK_LAND*
|
|
|
|
{ 1, 61, 0 }, // SFX_HAZARD__MINE
|
|
|
|
{ 1, 62, 0 }, // SFX_SPONGEBOB_SPLASH_INTO_WATER
|
|
|
|
{ 1, 63, 0 }, // SFX_SPONGEBOB_DIVING_HELMET
|
|
|
|
{ 1, 64, 0 }, // SFX_HAZARD__STALACTITE_LAND
|
|
|
|
{ 1, 65, 0 }, // SFX_HAZARD__STALACTITE_RATTLE
|
|
|
|
{ 3, 66, 0 }, // SFX_HAZARD__STEAM*
|
|
|
|
{ 3, 67, 0 }, // SFX_HAZARD__SWAMP_GAS*
|
|
|
|
{ 3, 68, 0 }, // SFX_ITEM__CORAL_BLOWER*
|
|
|
|
{ 1, 69, 0 }, // SFX_ITEM__DISGUISE
|
|
|
|
{ 1, 70, 0 }, // SFX_ITEM__JAMJAR_AMMO
|
|
|
|
{ 3, 71, 0 }, // SFX_ITEM__LEVEL_ITEM*
|
|
|
|
{ 1, 72, 0 }, // SFX_ITEM__ANY_OTHER_ITEM
|
|
|
|
{ 3, 73, 0 }, // SFX_ITEM__POWER_UP_ITEM*
|
|
|
|
{ 3, 74, 0 }, // SFX_ITEM__SKILL_ITEM*
|
|
|
|
{ 1, 75, 0 }, // SFX_JELLYFISH_MOVE
|
|
|
|
{ 1, 76, 0 }, // SFX_JELLYFISH_DEFEATED
|
|
|
|
{ 3, 77, 0 }, // SFX_JELLYFISH_ATTACK*
|
|
|
|
{ 1, 78, 0 }, // SFX_NAUTILUS_ATTACK
|
|
|
|
{ 1, 79, 0 }, // SFX_NAUTILUS_MOVE
|
|
|
|
{ 1, 80, 0 }, // SFX_NINJASTARFISH_ATTACK
|
|
|
|
{ 1, 81, 0 }, // SFX_PRICKLY_BUG_ATTACK
|
|
|
|
{ 1, 82, 0 }, // SFX_PRICKLY_BUG_DEFEATED
|
|
|
|
{ 1, 83, 0 }, // SFX_PRICKLY_BUG_MOVE
|
|
|
|
{ 3, 84, 0 }, // SFX_PUFFAFISH_MOVE*
|
|
|
|
{ 3, 85, 0 }, // SFX_SKULL_ATTACK*
|
|
|
|
{ 1, 86, 0 }, // SFX_SPIDERCRAB_ATTACK
|
|
|
|
{ 1, 87, 0 }, // SFX_SPIDERCRAB_MOVE
|
|
|
|
{ 1, 88, 0 }, // SFX_SQUIDDART_ATTACK
|
|
|
|
{ 3, 89, 0 }, // SFX_SQUIDDART_DEFEATED*
|
|
|
|
{ 1, 90, 0 }, // SFX_SQUIDDART_MOVE
|
|
|
|
{ 1, 91, 0 }, // SFX_SEASNAKE_ATTACK
|
|
|
|
{ 1, 92, 0 }, // SFX_SEASNAKE_MOVE
|
|
|
|
{ 1, 93, 0 }, // SFX_TELEPHONE_BOX
|
|
|
|
{ 3, 94, 0 }, // SFX_WORLD_OBJECT__BARRIER*
|
|
|
|
{ 3, 95, 0 }, // SFX_WORLD_OBJECT__BIG_WHEEL*
|
|
|
|
{ 3, 96, 0 }, // SFX_WORLD_OBJECT__GEYSER*
|
|
|
|
{ 3, 97, 0 }, // SFX_WORLD_OBJECT__GHOST_TRAIN_DOORS*
|
|
|
|
{ 1, 98, 0 }, // SFX_WORLD_OBJECT__DISAPPEARING_PLATFORM
|
|
|
|
{ 1, 99, 0 }, // SFX_WORLD_OBJECT__RESPAWNING_PLATFORM
|
|
|
|
{ 1, 100, 0 }, // SFX_WORLD_OBJECT__ROTATING_PLATFORM
|
|
|
|
{ 1, 101, 0 }, // SFX_WORLD_OBJECT__SEESAW
|
|
|
|
{ 1, 102, 0 }, // SFX_WORLD_OBJECT__TRAIN_TRACKS
|
|
|
|
{ 1, 103, 0 }, // SFX_WORLD_OBJECT__CURRENTS
|
|
|
|
{ 1, 104, 0 }, // SFX_ZOMBIE_FISH_FOLK
|
|
|
|
{ 1, 105, 0 }, // SFX_FRONT_END__MOVE_CURSOR
|
|
|
|
{ 1, 106, 0 }, // SFX_FRONT_END__SELECT
|
|
|
|
{ 1, 107, 0 }, // SFX_FRONT_END__ERROR
|
|
|
|
{ 1, 108, 0 }, // SFX_FRONT_END__OK
|
2001-06-15 16:59:40 +02:00
|
|
|
{ 3, 109, 0 }, // SFX_KAPOW_V1*
|
|
|
|
{ 3, 110, 0 }, // SFX_KAPOW_V2*
|
|
|
|
{ 3, 111, 0 }, // SFX_KAPOW_V3*
|
|
|
|
{ 1, 112, 0 }, // SFX_SPLAT
|
|
|
|
{ 3, 113, 0 }, // SFX_SECRET_AREA*
|
|
|
|
{ 1, 114, 0 }, // SFX_LAND_ON_JELLYFISH
|
|
|
|
{ 3, 115, 0 }, // SFX_SPLASH*
|
|
|
|
{ 3, 116, 0 }, // SFX_BARREL_V1*
|
|
|
|
{ 3, 117, 0 }, // SFX_BARREL_V2*
|
|
|
|
{ 1, 118, 0 }, // SFX_ACORN_FALL
|
|
|
|
{ 1, 119, 0 }, // SFX_ACORN_BOUNCE
|
|
|
|
{ 1, 120, 0 }, // SFX_CLAM_SNAP
|
|
|
|
{ 1, 121, 0 }, // SFX_CAR_START
|
|
|
|
{ 1, 122, 0 }, // CAR_SLOW_DOWN
|
2001-07-02 20:06:38 +02:00
|
|
|
{ 1, 123, 0 }, // SFX_SPONGEBOB_OUCH
|
2001-06-15 16:59:40 +02:00
|
|
|
|
2000-10-06 00:40:39 +02:00
|
|
|
};
|
|
|
|
|
2000-10-10 18:49:01 +02:00
|
|
|
// Reverb details
|
|
|
|
static ReverbDetails s_reverbDetails[CSoundMediator::NUM_REVERBTYPES]=
|
|
|
|
{
|
2001-01-29 18:55:07 +01:00
|
|
|
// m_type m_delay m_depth m_feedback
|
|
|
|
{ SPU_REV_MODE_OFF, 0, 0, 0 }, // REV_NONE
|
|
|
|
{ SPU_REV_MODE_ECHO, 75, 0x3000, 100 }, // REV_ECHOTEST
|
2000-10-10 18:49:01 +02:00
|
|
|
};
|
2000-10-06 00:40:39 +02:00
|
|
|
|
2000-10-05 16:16:09 +02:00
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
void CSoundMediator::initialise()
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
ASSERT(!s_initialised);
|
|
|
|
|
|
|
|
s_spuSound=new ("SPUSound") CSpuSound(); s_spuSound->initialise();
|
2000-10-10 00:06:20 +02:00
|
|
|
s_xmplaySound=new ("XMPlaySound") CXMPlaySound(); s_xmplaySound->initialise();
|
2000-10-05 16:16:09 +02:00
|
|
|
CXAStream::Init();
|
|
|
|
|
|
|
|
for(i=0;i<NUM_VOLUMETYPES;i++)
|
|
|
|
{
|
|
|
|
s_currentVolume[i]=MIN_VOLUME;
|
|
|
|
s_targetVolume[i]=INITIAL_VOLUME;
|
|
|
|
s_volumeDirty[i]=true;
|
|
|
|
}
|
2000-10-12 17:18:47 +02:00
|
|
|
|
|
|
|
ASSERT(CXAStream::MIN_VOLUME==0); // Just incase someone decides to change any of these.. things in here will break ( PKG )
|
|
|
|
ASSERT(CXAStream::MAX_VOLUME==32767);
|
2000-10-05 16:16:09 +02:00
|
|
|
|
2000-10-10 18:49:01 +02:00
|
|
|
// Initial reverb settings
|
2001-01-03 21:43:49 +01:00
|
|
|
setReverbType(REV_NONE);//REV_ECHOTEST);
|
2000-10-05 16:16:09 +02:00
|
|
|
|
|
|
|
SOUND_DBGMSG("Sound mediator initialised");
|
|
|
|
s_initialised=true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
void CSoundMediator::shutdown()
|
|
|
|
{
|
|
|
|
ASSERT(0);
|
|
|
|
|
|
|
|
ASSERT(s_initialised);
|
|
|
|
|
|
|
|
s_xmplaySound->shutdown(); delete s_xmplaySound;
|
|
|
|
s_spuSound->shutdown(); delete s_spuSound;
|
|
|
|
|
|
|
|
SOUND_DBGMSG("Sound mediator shutdown");
|
|
|
|
s_initialised=false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
void CSoundMediator::think(int _frames)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int diff,speed;
|
|
|
|
int *current,*target,*dirty;
|
|
|
|
|
|
|
|
ASSERT(s_initialised);
|
|
|
|
|
|
|
|
|
|
|
|
// Fade to target volume
|
2000-12-11 16:35:55 +01:00
|
|
|
ASSERT(_frames!=0);
|
|
|
|
if(_frames==0)_frames=1;
|
|
|
|
speed=_frames*VOLUME_CHANGE_SPEED;
|
2000-10-05 16:16:09 +02:00
|
|
|
current=s_currentVolume;
|
|
|
|
target=s_targetVolume;
|
|
|
|
dirty=s_volumeDirty;
|
|
|
|
for(i=0;i<NUM_VOLUMETYPES;i++)
|
|
|
|
{
|
|
|
|
diff=*target-*current;
|
|
|
|
if(diff<0)
|
|
|
|
{
|
|
|
|
*current-=speed;
|
|
|
|
if(*current<*target)*current=*target;
|
|
|
|
*dirty=true;
|
|
|
|
}
|
|
|
|
else if(diff>0)
|
|
|
|
{
|
|
|
|
*current+=speed;
|
|
|
|
if(*current>*target)*current=*target;
|
|
|
|
*dirty=true;
|
|
|
|
}
|
|
|
|
current++;
|
|
|
|
target++;
|
|
|
|
dirty++;
|
|
|
|
}
|
|
|
|
|
2000-10-11 18:47:03 +02:00
|
|
|
// Update of anything that needs it
|
2000-10-12 17:18:47 +02:00
|
|
|
CXAStream::ControlXA();
|
2000-10-10 00:06:20 +02:00
|
|
|
s_xmplaySound->think();
|
|
|
|
|
2000-10-05 16:16:09 +02:00
|
|
|
// Push through any changes in volume
|
2001-01-03 21:43:49 +01:00
|
|
|
if(s_volumeDirty[VOL_FADE])
|
2000-10-05 16:16:09 +02:00
|
|
|
{
|
2001-01-03 21:43:49 +01:00
|
|
|
s_volumeDirty[VOL_SONG]=true;
|
|
|
|
s_volumeDirty[VOL_SFX]=true;
|
|
|
|
s_volumeDirty[VOL_SPEECH]=true;
|
2001-01-04 18:10:13 +01:00
|
|
|
s_volumeDirty[VOL_FADE]=false;
|
2000-10-05 16:16:09 +02:00
|
|
|
}
|
2001-01-03 21:43:49 +01:00
|
|
|
if(s_volumeDirty[VOL_SONG])
|
2000-10-05 16:16:09 +02:00
|
|
|
{
|
2001-01-03 21:43:49 +01:00
|
|
|
s_xmplaySound->setMasterSongVolume((s_currentVolume[VOL_SONG]*s_currentVolume[VOL_FADE])>>8);
|
|
|
|
s_volumeDirty[VOL_SONG]=false;
|
2000-10-05 16:16:09 +02:00
|
|
|
}
|
2001-01-03 21:43:49 +01:00
|
|
|
if(s_volumeDirty[VOL_SFX])
|
2000-10-12 17:18:47 +02:00
|
|
|
{
|
2001-01-03 21:43:49 +01:00
|
|
|
s_xmplaySound->setMasterSfxVolume((s_currentVolume[VOL_SFX]*s_currentVolume[VOL_FADE])>>8);
|
|
|
|
s_volumeDirty[VOL_SFX]=false;
|
|
|
|
}
|
|
|
|
if(s_volumeDirty[VOL_SPEECH])
|
|
|
|
{
|
|
|
|
int vol=((s_currentVolume[VOL_SPEECH]*s_currentVolume[VOL_FADE])>>8)<<7;
|
2000-10-12 17:18:47 +02:00
|
|
|
CXAStream::setMasterVolume(vol,vol);
|
2001-01-03 21:43:49 +01:00
|
|
|
s_volumeDirty[VOL_SPEECH]=false;
|
2000-10-12 17:18:47 +02:00
|
|
|
}
|
2000-10-05 16:16:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-10-10 18:49:01 +02:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
void CSoundMediator::setReverbType(REVERBTYPE _type)
|
|
|
|
{
|
|
|
|
s_spuSound->setReverbDetails(&s_reverbDetails[_type]);
|
|
|
|
s_spuSound->setReverbActive(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-10-05 16:16:09 +02:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
void CSoundMediator::setSong(SONGID _songId)
|
|
|
|
{
|
2001-01-19 17:25:05 +01:00
|
|
|
XMSONGDATA *song;
|
2000-10-05 16:16:09 +02:00
|
|
|
|
|
|
|
song=&s_xmSongData[_songId];
|
2001-03-29 03:32:14 +02:00
|
|
|
|
|
|
|
if(s_songSampleId!=NO_SAMPLE&&s_songVh!=song->m_vh)
|
|
|
|
{
|
|
|
|
s_xmplaySound->dumpSampleData(s_songSampleId);
|
|
|
|
s_songSampleId=NO_SAMPLE;
|
|
|
|
}
|
|
|
|
if(s_songSampleId==NO_SAMPLE)
|
|
|
|
{
|
|
|
|
s_songSampleId=s_xmplaySound->loadSampleData(song->m_vh,song->m_vb);
|
|
|
|
}
|
|
|
|
s_songVh=song->m_vh;
|
|
|
|
|
|
|
|
if(s_songModId!=NO_SONG&&s_songPxm!=song->m_pxm)
|
|
|
|
{
|
|
|
|
s_xmplaySound->dumpModData(s_songModId);
|
|
|
|
s_songModId=NO_SONG;
|
|
|
|
}
|
|
|
|
if(s_songModId==NO_SONG)
|
|
|
|
{
|
|
|
|
s_songModId=s_xmplaySound->loadModData(song->m_pxm);
|
|
|
|
}
|
|
|
|
s_songPxm=song->m_pxm;
|
|
|
|
|
2001-01-19 17:25:05 +01:00
|
|
|
s_songStartPattern=song->m_startPattern;
|
2000-10-05 16:16:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
void CSoundMediator::playSong()
|
|
|
|
{
|
|
|
|
ASSERT(s_songSampleId!=NO_SAMPLE);
|
2000-10-10 00:06:20 +02:00
|
|
|
ASSERT(s_songModId!=NO_SONG);
|
2000-10-05 16:16:09 +02:00
|
|
|
ASSERT(s_songPlayingId==NOT_PLAYING);
|
|
|
|
|
2001-01-19 17:25:05 +01:00
|
|
|
s_songPlayingId=s_xmplaySound->playSong(s_songSampleId,s_songModId,s_songStartPattern);
|
2000-10-11 18:47:03 +02:00
|
|
|
// s_volumeDirty[SONG]=true; // Force a volume update
|
2000-10-05 16:16:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-03-29 03:32:14 +02:00
|
|
|
void CSoundMediator::stopSong()
|
2000-10-05 16:16:09 +02:00
|
|
|
{
|
|
|
|
ASSERT(s_songSampleId!=NO_SAMPLE);
|
2000-10-10 00:06:20 +02:00
|
|
|
ASSERT(s_songModId!=NO_SONG);
|
2000-10-05 16:16:09 +02:00
|
|
|
|
2000-10-10 00:06:20 +02:00
|
|
|
if(s_songPlayingId!=NOT_PLAYING)
|
|
|
|
{
|
|
|
|
s_xmplaySound->stopPlayingId(s_songPlayingId);
|
|
|
|
s_xmplaySound->unlockPlayingId(s_songPlayingId);
|
|
|
|
}
|
2001-03-29 03:32:14 +02:00
|
|
|
s_songPlayingId=NOT_PLAYING;
|
|
|
|
}
|
|
|
|
|
2000-10-05 16:16:09 +02:00
|
|
|
|
2001-03-29 03:32:14 +02:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
void CSoundMediator::dumpSong()
|
|
|
|
{
|
|
|
|
ASSERT(s_songSampleId!=NO_SAMPLE);
|
|
|
|
ASSERT(s_songModId!=NO_SONG);
|
|
|
|
|
|
|
|
stopSong();
|
|
|
|
s_xmplaySound->dumpSampleData(s_songSampleId);
|
2000-10-05 16:16:09 +02:00
|
|
|
s_songSampleId=NO_SAMPLE;
|
2001-03-29 03:32:14 +02:00
|
|
|
s_xmplaySound->dumpModData(s_songModId);
|
2000-10-10 00:06:20 +02:00
|
|
|
s_songModId=NO_SONG;
|
2001-03-29 03:32:14 +02:00
|
|
|
s_songVh=(FileEquate)-1;
|
|
|
|
s_songPxm=(FileEquate)-1;
|
2000-10-05 16:16:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
void CSoundMediator::setSfxBank(SFXBANKID _bankId)
|
|
|
|
{
|
2001-01-19 17:25:05 +01:00
|
|
|
XMSFXFILEDATA *sfx;
|
2000-10-05 16:16:09 +02:00
|
|
|
|
|
|
|
ASSERT(s_sfxSampleId==NO_SAMPLE);
|
2000-10-10 00:06:20 +02:00
|
|
|
ASSERT(s_sfxModId==NO_SONG);
|
2000-10-05 16:16:09 +02:00
|
|
|
|
2001-01-19 17:25:05 +01:00
|
|
|
sfx=&s_xmSfxData[_bankId];
|
|
|
|
s_sfxModId=s_xmplaySound->loadModData(sfx->m_pxm);
|
|
|
|
s_sfxSampleId=s_xmplaySound->loadSampleData(sfx->m_vh,sfx->m_vb);
|
2000-10-05 16:16:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
2000-10-11 18:47:03 +02:00
|
|
|
Params: Pass _lock as true if you wanna keep hold of one-shot sfx.
|
|
|
|
This'll be necessary if you have a *long* one-shot at the
|
|
|
|
same time as *lots* of other sfx.
|
2000-10-05 16:16:09 +02:00
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-01-29 18:55:07 +01:00
|
|
|
xmPlayingId CSoundMediator::playSfx(SFXID _sfxId,int _lock=false)
|
2000-10-05 16:16:09 +02:00
|
|
|
{
|
2001-07-09 17:27:30 +02:00
|
|
|
if(!s_canPlaySfx)
|
|
|
|
{
|
|
|
|
return NOT_PLAYING;
|
|
|
|
}
|
|
|
|
|
2000-10-10 00:06:20 +02:00
|
|
|
int sfxChannelMask;
|
|
|
|
xmPlayingId playId;
|
|
|
|
SFXDETAILS *sfx;
|
2000-10-05 16:16:09 +02:00
|
|
|
|
2000-10-10 00:06:20 +02:00
|
|
|
ASSERT(s_sfxSampleId!=NO_SAMPLE);
|
|
|
|
ASSERT(s_sfxModId!=NO_SONG);
|
2000-10-05 16:16:09 +02:00
|
|
|
|
2000-10-10 00:06:20 +02:00
|
|
|
// Play!
|
|
|
|
sfx=&s_sfxDetails[_sfxId];
|
|
|
|
if(sfx->m_looping)
|
2000-10-05 16:16:09 +02:00
|
|
|
{
|
2000-10-10 00:06:20 +02:00
|
|
|
playId=s_xmplaySound->playLoopingSfx(s_sfxSampleId,s_sfxModId,sfx->m_pattern,10);
|
2000-10-05 16:16:09 +02:00
|
|
|
}
|
2000-10-10 00:06:20 +02:00
|
|
|
else
|
2000-10-05 16:16:09 +02:00
|
|
|
{
|
2000-10-10 00:06:20 +02:00
|
|
|
playId=s_xmplaySound->playSfx(s_sfxSampleId,s_sfxModId,sfx->m_pattern,sfx->m_channelMask,20);
|
2000-10-11 18:47:03 +02:00
|
|
|
if(!_lock&&playId!=NOT_PLAYING)
|
2000-10-10 01:30:58 +02:00
|
|
|
{
|
|
|
|
s_xmplaySound->unlockPlayingId(playId); // We really don't care about one-shot sfx..
|
|
|
|
playId=NOT_PLAYING;
|
|
|
|
}
|
2000-10-05 16:16:09 +02:00
|
|
|
}
|
2000-10-11 18:47:03 +02:00
|
|
|
// s_volumeDirty[SFX]=true; // Force a volume update
|
2000-10-05 16:16:09 +02:00
|
|
|
|
2000-10-10 00:06:20 +02:00
|
|
|
return playId;
|
|
|
|
}
|
2000-10-05 16:16:09 +02:00
|
|
|
|
|
|
|
|
2000-10-11 18:47:03 +02:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose: Calculate volume and panning for a sound base upon its
|
|
|
|
position in space. Takes a position in space which describes
|
|
|
|
the sound position relative to the camera/microphone.
|
|
|
|
Volume comes from distance from origin and panning comes from
|
|
|
|
the position along the x axis.
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
void CSoundMediator::setposition(xmPlayingId _playingId,VECTOR *pos)
|
|
|
|
{
|
|
|
|
int volume,pan;
|
|
|
|
|
|
|
|
volume=CXMPlaySound::MAX_VOLUME-(CalcLengthV(pos));
|
|
|
|
if(volume<CXMPlaySound::MIN_VOLUME)volume=CXMPlaySound::MIN_VOLUME;
|
|
|
|
|
|
|
|
pan=(pos->vx/2)+CXMPlaySound::PAN_CENTRE;
|
|
|
|
if(pan<CXMPlaySound::PAN_LEFT)pan=CXMPlaySound::PAN_LEFT;
|
|
|
|
else if(pan>CXMPlaySound::PAN_RIGHT)pan=CXMPlaySound::PAN_RIGHT;
|
|
|
|
|
|
|
|
s_xmplaySound->setVolume(_playingId,volume);
|
|
|
|
s_xmplaySound->setPanning(_playingId,pan);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-10-10 00:06:20 +02:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-05-09 00:09:00 +02:00
|
|
|
void CSoundMediator::stopAndUnlockSfx(xmPlayingId _playingId)
|
2000-10-10 00:06:20 +02:00
|
|
|
{
|
2000-10-10 01:30:58 +02:00
|
|
|
s_xmplaySound->stopPlayingId(_playingId);
|
|
|
|
s_xmplaySound->unlockPlayingId(_playingId);
|
2000-10-05 16:16:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-03-29 03:32:14 +02:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose: NB: Will invalidate any locked sfx!
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
void CSoundMediator::stopAllSfx()
|
|
|
|
{
|
|
|
|
s_xmplaySound->stopAndUnlockAllSfx();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-18 17:59:09 +02:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
int CSoundMediator::isSfxStillPlaying(xmPlayingId _playingId)
|
|
|
|
{
|
|
|
|
return s_xmplaySound->isStillPlaying(_playingId);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-10-05 16:16:09 +02:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
void CSoundMediator::playSpeech(SpeechEquate _speech)
|
|
|
|
{
|
2000-10-12 17:18:47 +02:00
|
|
|
stopSpeech();
|
2001-05-05 23:18:12 +02:00
|
|
|
CXAStream::PlaySpeech(_speech,1);
|
2000-10-05 16:16:09 +02:00
|
|
|
// s_volumeDirty[SPEECH]=true; // Force a volume update
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-10-12 17:18:47 +02:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
void CSoundMediator::stopSpeech()
|
|
|
|
{
|
|
|
|
if(CXAStream::IsPlaying())
|
|
|
|
CXAStream::Stop();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-10-05 16:16:09 +02:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
void CSoundMediator::setVolume(VOLUMETYPE _type,int _val)
|
|
|
|
{
|
|
|
|
ASSERT(_val>=MIN_VOLUME&&_val<=MAX_VOLUME);
|
|
|
|
|
|
|
|
s_targetVolume[_type]=_val;
|
|
|
|
s_volumeDirty[_type]=true; // Otherwise we could miss volume changes under rare conditions
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
int CSoundMediator::getVolume(VOLUMETYPE _type)
|
|
|
|
{
|
|
|
|
return s_targetVolume[_type];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-10-11 18:47:03 +02:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
void CSoundMediator::stopAllSound()
|
|
|
|
{
|
|
|
|
s_xmplaySound->stopAndUnlockAllSound();
|
2000-10-12 17:18:47 +02:00
|
|
|
CXAStream::Stop();
|
2001-03-29 18:12:32 +02:00
|
|
|
s_songPlayingId=NOT_PLAYING;
|
2000-10-11 18:47:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-10-05 16:16:09 +02:00
|
|
|
/*===========================================================================
|
|
|
|
end */
|