Commit 67ad25ad authored by Gerhard Stein's avatar Gerhard Stein

Volume fixes

parent fa90d831
......@@ -217,8 +217,8 @@ bool CSettings::loadDrvCfg()
Configuration.ReadInteger("Audio", "musicvol", &music_vol, SDL_MIX_MAXVOLUME);
Configuration.ReadInteger("Audio", "soundvol", &sound_vol, SDL_MIX_MAXVOLUME);
gSound.setMusicVolume(Uint8(music_vol));
gSound.setSoundVolume(Uint8(sound_vol));
gSound.setMusicVolume(Uint8(music_vol), false);
gSound.setSoundVolume(Uint8(sound_vol), false);
}
return true;
}
......
......@@ -255,15 +255,25 @@ void Audio::stopSound(const GameSound snd)
}
}
void Audio::setSoundVolume(const Uint8 volume)
void Audio::setSoundVolume(const Uint8 volume,
const bool updateMixer)
{
m_SoundVolume = volume;
Mix_Volume(-1, volume);
if(updateMixer)
{
Mix_Volume(-1, volume);
}
}
void Audio::setMusicVolume(const Uint8 volume)
void Audio::setMusicVolume(const Uint8 volume,
const bool updateMixer)
{
m_MusicVolume = volume;
Mix_VolumeMusic(volume);
if(updateMixer)
{
Mix_VolumeMusic(volume);
}
}
......
......@@ -83,8 +83,24 @@ public:
void stopSound(const GameSound snd);
void destroy();
void setSoundVolume(const Uint8 volume);
void setMusicVolume(const Uint8 volume);
/**
* @brief setSoundVolume Set Sound effects volume
* @param volume
* @param updateMixer if true the SDL Mixer gets the volume updated directly
* This should not be done when the Audio Device has not been yet initialized
*/
void setSoundVolume(const Uint8 volume,
const bool updateMixer = true);
/**
* @brief setMusicVolume
* @param volume
* @param updateMixer if true the SDL Mixer gets the volume updated directly
* This should not be done when the Audio Device has not been yet initialized
*/
void setMusicVolume(const Uint8 volume,
const bool updateMixer = true);
Uint8 getSoundVolume() { return m_SoundVolume; }
Uint8 getMusicVolume() { return m_MusicVolume; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment