diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-09-15 01:29:38 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-09-15 01:29:38 +0300 |
commit | ae01890fb7661acfb94bd9a51b5269c6ada2c66b (patch) | |
tree | fa925a19b22f9dc41fdbb6a738d28d1098dc30ff /src/soundmanager.cpp | |
parent | 69f995bb5124c19746ff026f4e64c7398611e9f0 (diff) | |
download | manaverse-ae01890fb7661acfb94bd9a51b5269c6ada2c66b.tar.gz manaverse-ae01890fb7661acfb94bd9a51b5269c6ada2c66b.tar.bz2 manaverse-ae01890fb7661acfb94bd9a51b5269c6ada2c66b.tar.xz manaverse-ae01890fb7661acfb94bd9a51b5269c6ada2c66b.zip |
Add option for change number of max parallel sounds.
Diffstat (limited to 'src/soundmanager.cpp')
-rw-r--r-- | src/soundmanager.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/soundmanager.cpp b/src/soundmanager.cpp index 37a6321a7..a4ee3acee 100644 --- a/src/soundmanager.cpp +++ b/src/soundmanager.cpp @@ -117,6 +117,8 @@ void SoundManager::optionChanged(const std::string &value) mFadeoutMusic = (config.getIntValue("fadeoutmusic") != 0); else if (value == "uselonglivesounds") mCacheSounds = (config.getIntValue("uselonglivesounds") != 0); + else if (value == "parallelAudioChannels") + setChannels(config.getIntValue("parallelAudioChannels")); } void SoundManager::init() @@ -142,6 +144,7 @@ void SoundManager::init() config.addListener("musicVolume", this); config.addListener("fadeoutmusic", this); config.addListener("uselonglivesounds", this); + config.addListener("parallelAudioChannels", this); if (SDL_InitSubSystem(SDL_INIT_AUDIO) == -1) { @@ -176,7 +179,7 @@ void SoundManager::init() logger->log("Fallback to stereo audio"); } - Mix_AllocateChannels(16); + Mix_AllocateChannels(config.getIntValue("parallelAudioChannels")); Mix_VolumeMusic(mMusicVolume); Mix_Volume(-1, mSfxVolume); @@ -570,3 +573,9 @@ void SoundManager::volumeRestore() const Mix_Volume(-1, mSfxVolume); } } + +void SoundManager::setChannels(const int channels) const +{ + if (mInstalled) + Mix_AllocateChannels(channels); +} |