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
|
|
|
|
{
|
|
|
|
HYPERMMX,
|
|
|
|
DROPPOP,
|
2000-10-06 00:40:39 +02:00
|
|
|
MUSIC,
|
2000-10-05 16:16:09 +02:00
|
|
|
NUM_SONGIDS,
|
|
|
|
};
|
|
|
|
typedef enum SFXBANKID
|
|
|
|
{
|
|
|
|
INGAME,
|
|
|
|
NUM_SFXBANKIDS,
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef enum VOLUMETYPE
|
|
|
|
{
|
|
|
|
SONG,
|
|
|
|
SFX,
|
|
|
|
SPEECH,
|
|
|
|
|
|
|
|
SONGFADE,
|
|
|
|
|
|
|
|
NUM_VOLUMETYPES,
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
MIN_VOLUME=0,
|
|
|
|
MAX_VOLUME=255,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
|
|
|
|
|
|
// Song interface
|
2000-10-10 00:06:20 +02:00
|
|
|
static void setSong(SONGID _songId);
|
|
|
|
static void playSong();
|
|
|
|
static void dumpSong();
|
|
|
|
static void setSongToFadedOut() {setVolume(SONGFADE,0);}
|
|
|
|
static void setSongToFadedIn() {setVolume(SONGFADE,255);}
|
2000-10-05 16:16:09 +02:00
|
|
|
|
|
|
|
// SFX interface
|
2000-10-10 00:06:20 +02:00
|
|
|
static void setSfxBank(SFXBANKID _bankId);
|
|
|
|
static xmPlayingId playSfx(int _sfxId);
|
|
|
|
// static void setposition(int _playId,vector pos );
|
2000-10-10 01:30:58 +02:00
|
|
|
static void stopSfx(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-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);
|
|
|
|
// static void stopAllSound();
|
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;
|
|
|
|
static xmModId s_songModId;
|
|
|
|
static xmPlayingId s_songPlayingId;
|
|
|
|
static xmSampleId s_sfxSampleId;
|
|
|
|
static xmModId s_sfxModId;
|
2000-10-05 16:16:09 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Globals
|
|
|
|
------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Functions
|
|
|
|
--------- */
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
#endif /* __SOUND_SOUND_H__ */
|
|
|
|
|
|
|
|
/*===========================================================================
|
|
|
|
end */
|