diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-04-16 14:18:33 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-04-16 14:18:33 +0000 |
commit | f34960bc4a774764062a7bff70596779006c9413 (patch) | |
tree | eff906ad2f016a47689e3d19902057c13e00d7e5 /src/sound.cpp | |
parent | 62de779017018a6e8f89fed9e0c930fc4904f5d2 (diff) | |
download | mana-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.cpp | 45 |
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..."); } |