-fixed music volume did not apply when changing it with the

sound menu in global options
This commit is contained in:
fix94.1 2012-08-25 22:53:23 +00:00
parent a3bf8fff5a
commit 21078c74fb
3 changed files with 9 additions and 2 deletions

View File

@ -101,14 +101,14 @@ int CMenu::_configSnd(void)
int musicVol = min(m_cfg.getInt("GENERAL", "sound_volume_music", 255) + step, 255); int musicVol = min(m_cfg.getInt("GENERAL", "sound_volume_music", 255) + step, 255);
m_cfg.setInt("GENERAL", "sound_volume_music", musicVol); m_cfg.setInt("GENERAL", "sound_volume_music", musicVol);
_showConfigSnd(); _showConfigSnd();
m_music.SetVolume(musicVol); m_music.SetMaxVolume(musicVol);
} }
else if (m_btnMgr.selected(m_configSndBtnMusicVolM)) else if (m_btnMgr.selected(m_configSndBtnMusicVolM))
{ {
int musicVol = max(m_cfg.getInt("GENERAL", "sound_volume_music", 255) - step, 0); int musicVol = max(m_cfg.getInt("GENERAL", "sound_volume_music", 255) - step, 0);
m_cfg.setInt("GENERAL", "sound_volume_music", musicVol); m_cfg.setInt("GENERAL", "sound_volume_music", musicVol);
_showConfigSnd(); _showConfigSnd();
m_music.SetVolume(musicVol); m_music.SetMaxVolume(musicVol);
} }
else if (m_btnMgr.selected(m_configSndBtnCFVolP)) else if (m_btnMgr.selected(m_configSndBtnCFVolP))
{ {

View File

@ -50,6 +50,12 @@ void MusicPlayer::ScanDirectories(const char *directory)
closedir(pdir); closedir(pdir);
} }
void MusicPlayer::SetMaxVolume(u8 volume)
{
m_music_volume = volume;
SetVolume(volume);
}
void MusicPlayer::SetVolume(u8 volume) void MusicPlayer::SetVolume(u8 volume)
{ {
m_music_current_volume = volume; m_music_current_volume = volume;

View File

@ -15,6 +15,7 @@ public:
void Tick(bool attenuate); void Tick(bool attenuate);
void SetVolume(u8 volume); void SetVolume(u8 volume);
void SetMaxVolume(u8 volume);
u8 GetVolume() { return m_music_current_volume; }; u8 GetVolume() { return m_music_current_volume; };
u8 GetMaxVolume() { return m_music_volume; }; u8 GetMaxVolume() { return m_music_volume; };