diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-03-24 02:09:36 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-03-24 02:09:36 +0300 |
commit | 890349c3d1ad29ff668a3ef7fd7c535ed9a876ef (patch) | |
tree | 343a3e21c2ded430d912b9b124d6239933ff3d25 /src/soundmanager.cpp | |
parent | 39b61e709ca41804af30410f4a82a99f34900a29 (diff) | |
download | manaplus-890349c3d1ad29ff668a3ef7fd7c535ed9a876ef.tar.gz manaplus-890349c3d1ad29ff668a3ef7fd7c535ed9a876ef.tar.bz2 manaplus-890349c3d1ad29ff668a3ef7fd7c535ed9a876ef.tar.xz manaplus-890349c3d1ad29ff668a3ef7fd7c535ed9a876ef.zip |
improve soundmanager class.
Diffstat (limited to 'src/soundmanager.cpp')
-rw-r--r-- | src/soundmanager.cpp | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/src/soundmanager.cpp b/src/soundmanager.cpp index 62471f07d..6eca843cd 100644 --- a/src/soundmanager.cpp +++ b/src/soundmanager.cpp @@ -163,7 +163,6 @@ void SoundManager::init() void SoundManager::info() const { SDL_version compiledVersion; - const SDL_version *linkedVersion; char driver[40] = "Unknown"; const char *format = "Unknown"; int rate = 0; @@ -171,19 +170,30 @@ void SoundManager::info() const int channels = 0; MIX_VERSION(&compiledVersion); - linkedVersion = Mix_Linked_Version(); + const SDL_version *const linkedVersion = Mix_Linked_Version(); SDL_AudioDriverName(driver, 40); Mix_QuerySpec(&rate, &audioFormat, &channels); switch (audioFormat) { - case AUDIO_U8: format = "U8"; break; - case AUDIO_S8: format = "S8"; break; - case AUDIO_U16LSB: format = "U16LSB"; break; - case AUDIO_S16LSB: format = "S16LSB"; break; - case AUDIO_U16MSB: format = "U16MSB"; break; - case AUDIO_S16MSB: format = "S16MSB"; break; + case AUDIO_U8: + format = "U8"; + break; + case AUDIO_S8: + format = "S8"; break; + case AUDIO_U16LSB: + format = "U16LSB"; + break; + case AUDIO_S16LSB: + format = "S16LSB"; + break; + case AUDIO_U16MSB: + format = "U16MSB"; + break; + case AUDIO_S16MSB: + format = "S16MSB"; + break; default: break; } @@ -337,7 +347,7 @@ void SoundManager::playSfx(const std::string &path, else tmpPath = paths.getValue("sfx", "sfx/").append(path); ResourceManager *const resman = ResourceManager::getInstance(); - SoundEffect *const sample = resman->getSoundEffect(tmpPath); + const SoundEffect *const sample = resman->getSoundEffect(tmpPath); if (sample) { logger->log("SoundManager::playSfx() Playing: %s", path.c_str()); @@ -377,7 +387,7 @@ void SoundManager::playGuiSfx(const std::string &path) else tmpPath = paths.getValue("sfx", "sfx/").append(path); ResourceManager *const resman = ResourceManager::getInstance(); - SoundEffect *const sample = resman->getSoundEffect(tmpPath); + const SoundEffect *const sample = resman->getSoundEffect(tmpPath); if (sample) { logger->log("SoundManager::playGuiSfx() Playing: %s", path.c_str()); @@ -430,7 +440,7 @@ void SoundManager::volumeOff() const } } -void SoundManager::volumeRestore() +void SoundManager::volumeRestore() const { if (mInstalled) { |