properly abstract the volume so we don't touch prefsman in RSM

fixes crash
This commit is contained in:
Glenn Maynard
2003-01-19 19:55:24 +00:00
parent ee211f3b74
commit bfd2d10a15
9 changed files with 54 additions and 21 deletions
+11 -5
View File
@@ -9,7 +9,6 @@
#include "RageSound.h"
#include "RageLog.h"
#include "RageTimer.h"
#include "PrefsManager.h"
#include "arch/arch.h"
#include "arch/Sound/RageSoundDriver.h"
@@ -17,13 +16,14 @@
RageSoundManager::RageSoundManager(CString drivers)
{
/* needs to be done first */
SOUNDMAN = this;
MixVolume = 1.0f;
driver = MakeRageSoundDriver(drivers);
if(!driver)
RageException::Throw("Couldn't find a sound driver that works");
/* needs to be done before RageSound::RageSound */
SOUNDMAN = this;
music = new RageSound;
}
@@ -271,9 +271,15 @@ void RageSoundManager::PlayMusic(CString file, bool loop, float start_sec, float
music->StartPlaying();
}
void RageSoundManager::SetPrefs(float MixVol)
{
MixVolume = MixVol;
driver->VolumeChanged();
}
SoundMixBuffer::SoundMixBuffer()
{
vol = PREFSMAN->m_fSoundVolume;
vol = SOUNDMAN->GetMixVolume();
}
void SoundMixBuffer::write(const Sint16 *buf, unsigned size)