diff --git a/stepmania/src/arch/Sound/RageSoundDriver_DSound_Software.cpp b/stepmania/src/arch/Sound/RageSoundDriver_DSound_Software.cpp index cd1cbf350f..3dee63ba5b 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_DSound_Software.cpp +++ b/stepmania/src/arch/Sound/RageSoundDriver_DSound_Software.cpp @@ -63,17 +63,15 @@ bool RageSound_DSound_Software::GetPCM() /* Silence the buffer. */ memset(locked_buf, 0, len); - /* Create a 32-bit buffer to mix sounds. */ - static Sint32 *mixbuf = NULL; static Sint16 *buf = NULL; int bufsize = buffersize_frames * channels; if(!buf) { buf = new Sint16[bufsize]; - mixbuf = new Sint32[bufsize]; } memset(buf, 0, bufsize*sizeof(Uint16)); - memset(mixbuf, 0, bufsize*sizeof(Uint32)); + + SoundMixBuffer mix; for(unsigned i = 0; i < sounds.size(); ++i) { @@ -83,8 +81,7 @@ bool RageSound_DSound_Software::GetPCM() /* Call the callback. */ unsigned got = sounds[i]->snd->GetPCM((char *) buf, len, play_pos); - SOUNDMAN->MixAudio( - (Uint8 *) locked_buf, (Uint8 *) buf, got, SDL_MIX_MAXVOLUME/2); + mix.write((Sint16 *) buf, got); if(got < len) { @@ -94,6 +91,8 @@ bool RageSound_DSound_Software::GetPCM() } } + mix.read((Sint16 *) locked_buf); + str_ds->release_output_buf(locked_buf, len); return true; diff --git a/stepmania/src/arch/Sound/RageSoundDriver_WaveOut.cpp b/stepmania/src/arch/Sound/RageSoundDriver_WaveOut.cpp index b8f5b581b1..34bb311fd7 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_WaveOut.cpp +++ b/stepmania/src/arch/Sound/RageSoundDriver_WaveOut.cpp @@ -91,7 +91,7 @@ bool RageSound_WaveOut::GetPCM() unsigned got = sounds[i]->snd->GetPCM((char *) buf, chunksize, last_cursor_pos); SOUNDMAN->MixAudio( - (Uint8 *) buffers[b].lpData, (Uint8 *) buf, got, SDL_MIX_MAXVOLUME/2); + (Sint16 *) buffers[b].lpData, buf, got, .5); if(got < chunksize) {