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