aboutsummaryrefslogtreecommitdiff
path: root/engines/sludge/sound.h
diff options
context:
space:
mode:
authorSimei Yin2017-07-20 23:18:05 +0200
committerSimei Yin2017-07-21 11:21:45 +0200
commit73a81a5089627599d9adbedf6d2d4dc0122d48c5 (patch)
treec35a32d9c2a7b241cc08af38d1e1c8cff871b144 /engines/sludge/sound.h
parent2b538d43767beefbb1e342e8e25191179225aaf5 (diff)
downloadscummvm-rg350-73a81a5089627599d9adbedf6d2d4dc0122d48c5.tar.gz
scummvm-rg350-73a81a5089627599d9adbedf6d2d4dc0122d48c5.tar.bz2
scummvm-rg350-73a81a5089627599d9adbedf6d2d4dc0122d48c5.zip
SLUDGE: Objectify sound manager
Diffstat (limited to 'engines/sludge/sound.h')
-rw-r--r--engines/sludge/sound.h109
1 files changed, 76 insertions, 33 deletions
diff --git a/engines/sludge/sound.h b/engines/sludge/sound.h
index 8e9038dcbb..cdd76b33cc 100644
--- a/engines/sludge/sound.h
+++ b/engines/sludge/sound.h
@@ -23,10 +23,10 @@
#ifndef SLUDGE_SOUND_H
#define SLUDGE_SOUND_H
-#define HWND void *
-
#include "common/file.h"
+#include "audio/mixer.h"
+
#include "sludge/variable.h"
namespace Sludge {
@@ -39,37 +39,80 @@ struct SoundList{
int cacheIndex;
int vol;
};
-bool deleteSoundFromList(SoundList*&s);
-void playSoundList(SoundList*s);
-void handleSoundLists(); // to produce the same effects as end of stream call back functions
-
-// GENERAL...
-bool initSoundStuff(HWND);
-void killSoundStuff();
-
-// MUSIC...
-bool playMOD(int, int, int);
-void stopMOD(int);
-void setMusicVolume(int a, int v);
-void setDefaultMusicVolume(int v);
-
-// SAMPLES...
-int cacheSound(int f);
-bool startSound(int, bool = false);
-void huntKillSound(int a);
-void huntKillFreeSound(int filenum);
-void setSoundVolume(int a, int v);
-void setDefaultSoundVolume(int v);
-void setSoundLoop(int a, int s, int e);
-bool stillPlayingSound(int ch);
-bool getSoundCacheStack(StackHandler *sH);
-int findInSoundCache(int a);
-
-void debugSounds();
-void loadSounds(Common::SeekableReadStream *stream);
-void saveSounds(Common::WriteStream *stream);
-
-uint getSoundSource(int index);
+
+class SoundManager {
+public:
+ SoundManager();
+ virtual ~SoundManager();
+
+ // Sound list
+ void playSoundList(SoundList*s);
+ void handleSoundLists(); // to produce the same effects as end of stream call back functions
+
+ // GENERAL...
+ bool initSoundStuff();
+ void killSoundStuff();
+
+ // MUSIC...
+ bool playMOD(int, int, int);
+ void stopMOD(int);
+ void setMusicVolume(int a, int v);
+ void setDefaultMusicVolume(int v);
+
+ // SAMPLES...
+ int cacheSound(int f);
+ bool startSound(int, bool = false);
+ void huntKillSound(int a);
+ void huntKillFreeSound(int filenum);
+ void setSoundVolume(int a, int v);
+ void setDefaultSoundVolume(int v);
+ void setSoundLoop(int a, int s, int e);
+ bool stillPlayingSound(int ch);
+ bool getSoundCacheStack(StackHandler *sH);
+ int findInSoundCache(int a);
+
+ // Load & save
+ void loadSounds(Common::SeekableReadStream *stream);
+ void saveSounds(Common::WriteStream *stream);
+
+ uint getSoundSource(int index);
+
+private:
+ const static int MAX_SAMPLES;
+ const static int MAX_MODS;
+
+ struct SoundThing {
+ Audio::SoundHandle handle;
+ int fileLoaded, vol; //Used for sounds only. (sound saving/loading)
+ bool looping; //Used for sounds only. (sound saving/loading)
+ bool inSoundList;
+ };
+ typedef Common::List<SoundList *> SoundListHandles;
+
+ // there's possibility that several sound list played at the same time
+ SoundListHandles _soundListHandles;
+
+ bool _soundOK;
+ bool _silenceIKillYou;
+ bool _isHandlingSoundList;
+
+ SoundThing *_soundCache;
+ #if 0
+ SoundThing *_modCache;
+ #endif
+
+ int _defVol;
+ int _defSoundVol;
+ float _modLoudness;
+
+ int _emptySoundSlot;
+
+ void freeSound(int a);
+ bool forceRemoveSound();
+ bool deleteSoundFromList(SoundList*&s);
+ int findEmptySoundSlot();
+ int makeSoundAudioStream(int f, Audio::AudioStream *&audiostream, bool loopy);
+};
} // End of namespace Sludge