From 8fe800f7afa25e052c387b8a1a7ad6d46f38d916 Mon Sep 17 00:00:00 2001 From: Alexander Baldeck Date: Wed, 29 Dec 2004 12:29:58 +0000 Subject: - ported sound engine to SDL_Mixer - name change from TmwSound to Sound as required by HACKING.txt - slight modification of other files using it due to interface changes - minor speedups in Configuration - makefile.static modfified to link against SDL --- src/sound/sound.h | 76 +++++++++++++++++++------------------------------------ 1 file changed, 26 insertions(+), 50 deletions(-) (limited to 'src/sound/sound.h') diff --git a/src/sound/sound.h b/src/sound/sound.h index 8df4eb08..a1055b02 100644 --- a/src/sound/sound.h +++ b/src/sound/sound.h @@ -26,82 +26,58 @@ #ifdef WIN32 #pragma warning(disable:4312) #endif -#include -#include -#include +#include +#include +#include #include #include -/** mod file */ -#define TMWSOUND_MOD 1 -/** midi file */ -#define TMWSOUND_MID 2 -/** sample file */ -#define TMWSOUND_SFX 3 +#ifdef __DEBUG + #include +#endif -typedef unsigned short TMWSOUND_SID ; +typedef short SOUND_SID ; /** * Sound engine * * \ingroup CORE */ -class TmwSound { +class Sound { public: - void Init(int, int); - void Close(); - - void StartMIDI(char *, int); - void StartMOD(char *, int); - void StopBGM(); + void init(int, int); + void close(); - void StartWAV(char *, int); - void SetVol(int, int, int); - void SetAdjVol(int, int, int); + void startBgm(char *, int); + void stopBgm(); + + void setVolume(int); + void adjustVolume(int); - TMWSOUND_SID LoadItem(char *, char); - void UnloadItem(TMWSOUND_SID); - void PlayItem(TMWSOUND_SID, int); + SOUND_SID loadItem(char *); + void startItem(SOUND_SID, int); + + void clearCache(); - TmwSound() {isOk=-1;} + Sound() {isOk=-1;} /** if allegro is shut down or object is deleted any BGM is stopped and SFX run out */ - ~TmwSound() {StopBGM(); Close();}; + ~Sound() {stopBgm(); close();}; private: /** initial value is -1 which means error or noninitialzed. you can only play sounds and bgm if this is 0. that should be the case after calling Init() successfully */ int isOk; - MIDI * mid; - JGMOD * mod; - SAMPLE * sfx; - int pan; - int pitch; - - int ret; - int vol_digi; - int vol_midi; - int vol_mod; - - /** structure can hold a sound item's attributes and data (sample-only) */ - typedef struct POOL_ITEM { - /** incremental id of pool item */ - TMWSOUND_SID id; - /** type of item */ - char type; - /** (file-)name of sfx only kept for human reasons ^_^ */ - std::string fname; - /** generic data */ - void * data; - }; + int vol_music; + Mix_Music *bgm; + /** list of preloaded sound data / items */ - std::list soundpool; - std::list::iterator sounditem; - TMWSOUND_SID items; + std::map soundpool; + SOUND_SID items; bool isMaxVol(int); }; -- cgit v1.2.3-70-g09d2