summaryrefslogtreecommitdiff
path: root/src/sound/sound.h
diff options
context:
space:
mode:
authorAlexander Baldeck <alexander@archlinux.org>2004-12-29 12:29:58 +0000
committerAlexander Baldeck <alexander@archlinux.org>2004-12-29 12:29:58 +0000
commit8fe800f7afa25e052c387b8a1a7ad6d46f38d916 (patch)
treeca0f0bf3ef5f556caa3b82f77b9691680182c799 /src/sound/sound.h
parentff208227c9dcda7a8279acc8ee43fa28ea284478 (diff)
downloadmana-client-8fe800f7afa25e052c387b8a1a7ad6d46f38d916.tar.gz
mana-client-8fe800f7afa25e052c387b8a1a7ad6d46f38d916.tar.bz2
mana-client-8fe800f7afa25e052c387b8a1a7ad6d46f38d916.tar.xz
mana-client-8fe800f7afa25e052c387b8a1a7ad6d46f38d916.zip
- 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
Diffstat (limited to 'src/sound/sound.h')
-rw-r--r--src/sound/sound.h76
1 files changed, 26 insertions, 50 deletions
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 <allegro.h>
-#include <jgmod.h>
-#include <list>
+#include <SDL.h>
+#include <SDL_mixer.h>
+#include <map>
#include <string>
#include <fstream>
-/** mod file */
-#define TMWSOUND_MOD 1
-/** midi file */
-#define TMWSOUND_MID 2
-/** sample file */
-#define TMWSOUND_SFX 3
+#ifdef __DEBUG
+ #include <iostream>
+#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<POOL_ITEM> soundpool;
- std::list<POOL_ITEM>::iterator sounditem;
- TMWSOUND_SID items;
+ std::map<int, Mix_Chunk*> soundpool;
+ SOUND_SID items;
bool isMaxVol(int);
};