summaryrefslogtreecommitdiff
path: root/src/sound.cpp
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2005-04-16 14:18:33 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2005-04-16 14:18:33 +0000
commitf34960bc4a774764062a7bff70596779006c9413 (patch)
treeeff906ad2f016a47689e3d19902057c13e00d7e5 /src/sound.cpp
parent62de779017018a6e8f89fed9e0c930fc4904f5d2 (diff)
downloadmana-f34960bc4a774764062a7bff70596779006c9413.tar.gz
mana-f34960bc4a774764062a7bff70596779006c9413.tar.bz2
mana-f34960bc4a774764062a7bff70596779006c9413.tar.xz
mana-f34960bc4a774764062a7bff70596779006c9413.zip
- Readding stripping to executable (Dev-cpp project options)
- New slider skin - Some updates to win32 compile guide - Cleaned sound engine - Improved setup window (need testing)
Diffstat (limited to 'src/sound.cpp')
-rw-r--r--src/sound.cpp45
1 files changed, 2 insertions, 43 deletions
diff --git a/src/sound.cpp b/src/sound.cpp
index f76b6910..9b16a063 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -27,7 +27,8 @@
Sound::Sound():
installed(false),
- items(-1)
+ sfxVolume(100),
+ musicVolume(60)
{
}
@@ -187,35 +188,6 @@ void Sound::fadeOutMusic(int ms)
}
}
-SOUND_ID Sound::loadSfx(const char *path)
-{
- /* If sound system is not installed it can't load
- * samples because doesn't know how to convert them */
- if (!installed) return 0;
-
- logger.log("Sound::loadSfx() pre-caching \"%s\"", path);
-
- ResourceManager *resman = ResourceManager::getInstance();
- SoundEffect *sample = resman->getSoundEffect(path);
- if (sample) {
- soundPool[++items] = sample;
- logger.log("Sound::loadSfx() SOUND_ID = %d", items);
- return items;
- }
-
- return 0;
-}
-
-void Sound::playSfx(SOUND_ID id)
-{
- if (!installed) return;
-
- if (soundPool[id]) {
- logger.log("Sound::playSfx() Playing SOUND_ID = %d", id);
- soundPool[id]->play(0, sfxVolume);
- }
-}
-
void Sound::playSfx(const char *path)
{
if (!installed) return;
@@ -228,22 +200,9 @@ void Sound::playSfx(const char *path)
}
}
-void Sound::clearCache()
-{
- for (SOUND_ID i = 0; i <= items; i++) {
- soundPool[i]->unload();
- delete soundPool[i];
- soundPool[i] = NULL;
- }
-
- soundPool.clear();
- logger.log("Sound::clearCache() Wiped all items off the cache");
-}
-
void Sound::close()
{
installed = false;
- clearCache();
Mix_CloseAudio();
logger.log("Sound::close() Shutting down sound...");
}