use m_fSoundVolume

This commit is contained in:
Glenn Maynard
2003-01-11 04:04:15 +00:00
parent 835c8c3b06
commit 875108d691
4 changed files with 8 additions and 9 deletions
+2 -3
View File
@@ -9,6 +9,7 @@
#include "RageSound.h"
#include "RageLog.h"
#include "RageTimer.h"
#include "PrefsManager.h"
#include "arch/arch.h"
#include "arch/Sound/RageSoundDriver.h"
@@ -267,13 +268,11 @@ void RageSoundManager::PlayMusic(CString file, bool loop, float start_sec, float
SoundMixBuffer::SoundMixBuffer()
{
vol = .5;
vol = PREFSMAN->m_fSoundVolume;
}
void SoundMixBuffer::write(const Sint16 *buf, unsigned size)
{
size /= 2;
if(mixbuf.size() < size)
{
basic_string<Sint32> empty(size-mixbuf.size(), 0);
@@ -12,6 +12,7 @@
#include "../../RageUtil.h"
#include "../../RageSound.h"
#include "../../RageLog.h"
#include "../../PrefsManager.h"
#include "../../tls.h"
#include "SDL.h"
@@ -162,7 +163,7 @@ RageSound_DSound::RageSound_DSound()
newbuf = new DSoundBuf(ds,
DSoundBuf::HW_HARDWARE,
channels, samplerate, 16, buffersize,
0.50f);
PREFSMAN->m_fSoundVolume);
} catch(const RageException &e) {
/* If we didn't get at least 8, fail. */
if(i >= 8) break; /* OK */
@@ -81,7 +81,7 @@ bool RageSound_DSound_Software::GetData()
/* Call the callback. */
unsigned got = sounds[i]->snd->GetPCM((char *) buf, len, play_pos);
mix.write((Sint16 *) buf, got);
mix.write((Sint16 *) buf, got/2);
if(got < len)
{
@@ -76,11 +76,10 @@ bool RageSound_WaveOut::GetData()
static Sint16 *buf = NULL;
int bufsize = chunksize_frames * channels;
if(!buf)
{
buf = new Sint16[bufsize];
}
memset(buf, 0, bufsize*sizeof(Uint16));
memset(buffers[b].lpData, 0, bufsize*sizeof(Uint16));
SoundMixBuffer mix;
for(unsigned i = 0; i < sounds.size(); ++i)
{
@@ -90,8 +89,7 @@ bool RageSound_WaveOut::GetData()
/* Call the callback. */
unsigned got = sounds[i]->snd->GetPCM((char *) buf, chunksize, last_cursor_pos);
SOUNDMAN->MixAudio(
(Sint16 *) buffers[b].lpData, buf, got, .5);
mix.write((Sint16 *) buf, got/2);
if(got < chunksize)
{
@@ -101,6 +99,7 @@ bool RageSound_WaveOut::GetData()
}
}
mix.read((Sint16 *) buffers[b].lpData);
MMRESULT ret = waveOutWrite(wo, &buffers[b], sizeof(buffers[b]));
if(ret != MMSYSERR_NOERROR)
RageException::Throw(wo_ssprintf(ret, "waveOutWrite failed"));