2000-10-05 16:16:09 +02:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
sound.h
|
|
|
|
|
|
|
|
Author: PKG
|
|
|
|
Created:
|
|
|
|
Project: Spongebob
|
|
|
|
Purpose:
|
|
|
|
|
|
|
|
Copyright (c) 2000 Climax Development Ltd
|
|
|
|
|
|
|
|
===========================================================================*/
|
|
|
|
|
|
|
|
#ifndef __SOUND_SOUND_H__
|
|
|
|
#define __SOUND_SOUND_H__
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Includes
|
|
|
|
-------- */
|
|
|
|
|
|
|
|
#ifndef __SOUND_XMPLAY_H__
|
|
|
|
#include "sound\xmplay.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __SOUND_SPU_H__
|
|
|
|
#include "sound\spu.h"
|
|
|
|
#endif
|
|
|
|
#ifndef __SOUND_XMPLAY_H__
|
|
|
|
#include "sound\xmplay.h"
|
|
|
|
#endif
|
|
|
|
#ifndef __CDXAHeader__
|
|
|
|
#include "sound\cdxa.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/* Std Lib
|
|
|
|
------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Tyepdefs && Defines
|
|
|
|
------------------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Structure defintions
|
|
|
|
-------------------- */
|
|
|
|
|
|
|
|
class CSoundMediator
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
typedef enum SONGID
|
|
|
|
{
|
2001-07-02 18:29:53 +02:00
|
|
|
SONG_TITLE, SONG_OPTIONS, SONG_MEMORYCARD, SONG_GAMECOMPLETE, SONG_GAMEOVER, SONG_PARTY, SONG_MEMCARD2, SONG_MAPSCREEN, SONG_SHOPSCREEN,
|
2001-07-04 16:32:35 +02:00
|
|
|
SONG_FMA,
|
2001-01-29 18:55:07 +01:00
|
|
|
SONG_CHAPTER1_LEVEL1, SONG_CHAPTER1_LEVEL2, SONG_CHAPTER1_LEVEL3, SONG_CHAPTER1_LEVEL4, SONG_CHAPTER1_BOSS,
|
|
|
|
SONG_CHAPTER2_LEVEL1, SONG_CHAPTER2_LEVEL2, SONG_CHAPTER2_LEVEL3, SONG_CHAPTER2_LEVEL4, SONG_CHAPTER2_BOSS,
|
|
|
|
SONG_CHAPTER3_LEVEL1, SONG_CHAPTER3_LEVEL2, SONG_CHAPTER3_LEVEL3, SONG_CHAPTER3_LEVEL4, SONG_CHAPTER3_BOSS_ALSEEP, SONG_CHAPTER3_BOSS_AWAKE,
|
|
|
|
SONG_CHAPTER4_LEVEL1, SONG_CHAPTER4_LEVEL2, SONG_CHAPTER4_LEVEL3, SONG_CHAPTER4_LEVEL4, SONG_CHAPTER4_BOSS,
|
|
|
|
SONG_CHAPTER5_LEVEL1, SONG_CHAPTER5_LEVEL2, SONG_CHAPTER5_LEVEL3, SONG_CHAPTER5_LEVEL4, SONG_CHAPTER5_BOSS,
|
2001-01-29 21:08:14 +01:00
|
|
|
SONG_CHAPTER6_ROLLERCOASTER, SONG_CHAPTER6_SNAILRACE, SONG_CHAPTER6_BIGWHEEL, SONG_CHAPTER6_TUNNELOFLOVE, SONG_CHAPTER6_GHOSTTRAIN, SONG_CHAPTER6_BIGTOP,
|
2000-10-05 16:16:09 +02:00
|
|
|
NUM_SONGIDS,
|
|
|
|
};
|
2001-01-29 18:55:07 +01:00
|
|
|
|
2000-10-05 16:16:09 +02:00
|
|
|
typedef enum SFXBANKID
|
|
|
|
{
|
2001-01-03 21:43:49 +01:00
|
|
|
SFX_INGAME,
|
2000-10-05 16:16:09 +02:00
|
|
|
NUM_SFXBANKIDS,
|
|
|
|
};
|
2001-01-29 18:55:07 +01:00
|
|
|
typedef enum SFXID
|
|
|
|
{
|
2001-01-30 22:38:06 +01:00
|
|
|
SFX_SPONGEBOB_WALK_1, SFX_SPONGEBOB_WALK_2,
|
|
|
|
SFX_SPONGEBOB_SQUEAKY_SHOES_1, SFX_SPONG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FOLK_MOVE_1, SFX_FISH_FOLK_MOVE_2,
|
|
|
|
SFX_CANNING_MACHINE,
|
|
|
|
SFX_LAVA,
|
|
|
|
SFX_ROLLING_ROCK,
|
|
|
|
SFX_SAW,
|
|
|
|
SFX_WHIRLPOOL_DRAIN, SFX_WHIRLPOOL_WHIRL,
|
|
|
|
SFX_HERMIT_CRAB_ATTACK, SFX_HERMIT_CRAB_MOVE,
|
|
|
|
SFX_HAZARD__ACID_DROP,
|
|
|
|
SFX_HAZARD__ACORN_LAND,
|
|
|
|
SFX_HAZARD__BLADE_ATTACK, SFX_HAZARD__BLADE_MOVE,
|
|
|
|
SFX_HAZARD__ROPE_MOVE, SFX_HAZARD__ROPE_SNAP,
|
|
|
|
SFX_ANY_OBJECT_FALLING,
|
|
|
|
SFX_HAZARD__FIREBALL_LAND, SFX_HAZARD__FIREBALL_LAUNCH,
|
|
|
|
SFX_HAZARD__FALLING_ROCK_FALL, SFX_HAZARD__FALLING_ROCK_LAND,
|
|
|
|
SFX_HAZARD__MINE,
|
|
|
|
SFX_SPONGEBOB_SPLASH_INTO_WATER,
|
|
|
|
SFX_SPONGEBOB_DIVING_HELMET,
|
|
|
|
SFX_HAZARD__STALACTITE_LAND, SFX_HAZARD__STALACTITE_RATTLE,
|
|
|
|
SFX_HAZARD__STEAM,
|
|
|
|
SFX_HAZARD__SWAMP_GAS,
|
|
|
|
SFX_ITEM__CORAL_BLOWER,
|
|
|
|
SFX_ITEM__DISGUISE,
|
|
|
|
SFX_ITEM__JAMJAR_AMMO,
|
|
|
|
SFX_ITEM__LEVEL_ITEM, SFX_ITEM__ANY_OTHER_ITEM, SFX_ITEM__POWER_UP_ITEM, SFX_ITEM__SKILL_ITEM,
|
|
|
|
SFX_JELLYFISH_MOVE, SFX_JELLYFISH_DEFEATED, SFX_JELLYFISH_ATTACK,
|
|
|
|
SFX_NAUTILUS_ATTACK, SFX_NAUTILUS_MOVE,
|
|
|
|
SFX_NINJASTARFISH_ATTACK,
|
|
|
|
SFX_PRICKLY_BUG_ATTACK, SFX_PRICKLY_BUG_DEFEATED, SFX_PRICKLY_BUG_MOVE,
|
|
|
|
SFX_PUFFAFISH_MOVE,
|
|
|
|
SFX_SKULL_ATTACK,
|
|
|
|
SFX_SPIDERCRAB_ATTACK, SFX_SPIDERCRAB_MOVE,
|
|
|
|
SFX_SQUIDDART_ATTACK, SFX_SQUIDDART_DEFEATED, SFX_SQUIDDART_MOVE,
|
|
|
|
SFX_SEASNAKE_ATTACK, SFX_SEASNAKE_MOVE,
|
|
|
|
SFX_TELEPHONE_BOX,
|
|
|
|
SFX_WORLD_OBJECT__BARRIER,
|
|
|
|
SFX_WORLD_OBJECT__BIG_WHEEL,
|
|
|
|
SFX_WORLD_OBJECT__GEYSER,
|
|
|
|
SFX_WORLD_OBJECT__GHOST_TRAIN_DOORS,
|
|
|
|
SFX_WORLD_OBJECT__DISAPPEARING_PLATFORM,
|
|
|
|
SFX_WORLD_OBJECT__RESPAWNING_PLATFORM,
|
|
|
|
SFX_WORLD_OBJECT__ROTATING_PLATFORM,
|
|
|
|
SFX_WORLD_OBJECT__SEESAW,
|
|
|
|
SFX_WORLD_OBJECT__TRAIN_TRACKS,
|
|
|
|
SFX_WORLD_OBJECT__CURRENTS,
|
|
|
|
SFX_ZOMBIE_FISH_FOLK,
|
|
|
|
SFX_FRONT_END__MOVE_CURSOR, SFX_FRONT_END__SELECT, SFX_FRONT_END__ERROR, SFX_FRONT_END__OK,
|
2001-06-15 16:59:40 +02:00
|
|
|
SFX_KAPOW_V1, SFX_KAPOW_V2, SFX_KAPOW_V3,
|
|
|
|
SFX_SPLAT,
|
|
|
|
SFX_SECRET_AREA,
|
|
|
|
SFX_LAND_ON_JELLYFISH,
|
|
|
|
SFX_SPLASH,
|
|
|
|
SFX_BARREL_V1, SFX_BARREL_V2,
|
|
|
|
SFX_ACORN_FALL, SFX_ACORN_BOUNCE,
|
|
|
|
SFX_CLAM_SNAP,
|
2001-07-04 21:38:05 +02:00
|
|
|
SFX_CAR_START, SFX_CAR_SLOW_DOWN,
|
2001-07-02 20:06:38 +02:00
|
|
|
SFX_SPONGEBOB_OUCH,
|
2001-01-30 22:38:06 +01:00
|
|
|
|
|
|
|
NUM_SFXIDS
|
2001-01-29 18:55:07 +01:00
|
|
|
};
|
2000-10-05 16:16:09 +02:00
|
|
|
|
|
|
|
typedef enum VOLUMETYPE
|
|
|
|
{
|
2001-01-03 21:43:49 +01:00
|
|
|
VOL_SONG,
|
|
|
|
VOL_SFX,
|
|
|
|
VOL_SPEECH,
|
|
|
|
|
|
|
|
VOL_FADE,
|
2000-10-05 16:16:09 +02:00
|
|
|
|
|
|
|
NUM_VOLUMETYPES,
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
MIN_VOLUME=0,
|
|
|
|
MAX_VOLUME=255,
|
|
|
|
};
|
|
|
|
|
2000-10-10 18:49:01 +02:00
|
|
|
typedef enum REVERBTYPE
|
|
|
|
{
|
2001-01-03 21:43:49 +01:00
|
|
|
REV_NONE,
|
|
|
|
REV_ECHOTEST,
|
2000-10-10 18:49:01 +02:00
|
|
|
|
|
|
|
NUM_REVERBTYPES,
|
|
|
|
};
|
2000-10-05 16:16:09 +02:00
|
|
|
|
|
|
|
// General
|
2000-10-10 00:06:20 +02:00
|
|
|
static void initialise();
|
|
|
|
static void shutdown();
|
|
|
|
static void think(int _frames);
|
2000-10-05 16:16:09 +02:00
|
|
|
|
|
|
|
|
2000-10-10 18:49:01 +02:00
|
|
|
// Reverb
|
|
|
|
static void setReverbType(REVERBTYPE _type);
|
|
|
|
|
2000-10-05 16:16:09 +02:00
|
|
|
// Song interface
|
2000-10-10 00:06:20 +02:00
|
|
|
static void setSong(SONGID _songId);
|
|
|
|
static void playSong();
|
2001-03-29 03:32:14 +02:00
|
|
|
static void stopSong();
|
2000-10-10 00:06:20 +02:00
|
|
|
static void dumpSong();
|
2000-10-05 16:16:09 +02:00
|
|
|
|
|
|
|
// SFX interface
|
2000-10-10 00:06:20 +02:00
|
|
|
static void setSfxBank(SFXBANKID _bankId);
|
2001-01-29 18:55:07 +01:00
|
|
|
static xmPlayingId playSfx(SFXID _sfxId,int _lock=false);
|
2000-10-11 18:47:03 +02:00
|
|
|
static void setposition(xmPlayingId _playingId,VECTOR *pos);
|
2001-05-09 00:09:00 +02:00
|
|
|
static void stopAndUnlockSfx(xmPlayingId _playingId);
|
2001-03-29 03:32:14 +02:00
|
|
|
static void stopAllSfx();
|
2001-06-18 17:59:09 +02:00
|
|
|
static int isSfxStillPlaying(xmPlayingId _playingId);
|
2000-10-05 16:16:09 +02:00
|
|
|
|
|
|
|
// Speech interface
|
2000-10-10 00:06:20 +02:00
|
|
|
static void playSpeech(SpeechEquate _speech);
|
2000-10-12 17:18:47 +02:00
|
|
|
static void stopSpeech();
|
2000-10-05 16:16:09 +02:00
|
|
|
|
|
|
|
// Control
|
2000-10-10 00:06:20 +02:00
|
|
|
static void setVolume(VOLUMETYPE _type,int _val);
|
|
|
|
static int getVolume(VOLUMETYPE _type);
|
2000-10-11 18:47:03 +02:00
|
|
|
static void stopAllSound();
|
2001-07-09 17:27:30 +02:00
|
|
|
static void setCanPlaySfx(int _flag) {s_canPlaySfx=_flag;}
|
2000-10-05 16:16:09 +02:00
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
VOLUME_CHANGE_SPEED=2,
|
|
|
|
INITIAL_VOLUME=192,
|
|
|
|
};
|
2000-10-10 00:06:20 +02:00
|
|
|
|
2000-10-05 16:16:09 +02:00
|
|
|
CSoundMediator() {;}
|
|
|
|
|
2000-10-10 00:06:20 +02:00
|
|
|
static int s_initialised;
|
|
|
|
|
|
|
|
static int s_currentVolume[NUM_VOLUMETYPES];
|
|
|
|
static int s_targetVolume[NUM_VOLUMETYPES];
|
|
|
|
static int s_volumeDirty[NUM_VOLUMETYPES];
|
2000-10-05 16:16:09 +02:00
|
|
|
|
2000-10-10 00:06:20 +02:00
|
|
|
static xmSampleId s_songSampleId;
|
2001-03-29 03:32:14 +02:00
|
|
|
static FileEquate s_songVh;
|
2000-10-10 00:06:20 +02:00
|
|
|
static xmModId s_songModId;
|
2001-03-29 03:32:14 +02:00
|
|
|
static FileEquate s_songPxm;
|
2000-10-10 00:06:20 +02:00
|
|
|
static xmPlayingId s_songPlayingId;
|
2001-01-19 17:25:05 +01:00
|
|
|
static int s_songStartPattern;
|
|
|
|
|
2000-10-10 00:06:20 +02:00
|
|
|
static xmSampleId s_sfxSampleId;
|
|
|
|
static xmModId s_sfxModId;
|
2000-10-05 16:16:09 +02:00
|
|
|
|
2001-07-09 17:27:30 +02:00
|
|
|
static int s_canPlaySfx;
|
|
|
|
|
2000-10-05 16:16:09 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Globals
|
|
|
|
------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Functions
|
|
|
|
--------- */
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
#endif /* __SOUND_SOUND_H__ */
|
|
|
|
|
|
|
|
/*===========================================================================
|
|
|
|
end */
|