summaryrefslogtreecommitdiff
path: root/src/soundmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/soundmanager.cpp')
-rw-r--r--src/soundmanager.cpp11
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);
+}