diff --git a/stepmania/src/arch/Sound/RageSoundDriver_Generic_Software.cpp b/stepmania/src/arch/Sound/RageSoundDriver_Generic_Software.cpp index 9fae2f6fe8..a6e16231f5 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_Generic_Software.cpp +++ b/stepmania/src/arch/Sound/RageSoundDriver_Generic_Software.cpp @@ -51,7 +51,7 @@ int RageSound_Generic_Software::DecodeThread_start( void *p ) static int g_iTotalAhead = 0; static int g_iTotalAheadCount = 0; -void RageSound_Generic_Software::Mix( int16_t *pBuf, int iFrames, int64_t iFrameNumber, int64_t iCurrentFrame ) +RageSoundMixBuffer &RageSound_Generic_Software::MixIntoBuffer( int iFrames, int64_t iFrameNumber, int64_t iCurrentFrame ) { ASSERT_M( m_DecodeThread.IsCreated(), "RageSound_Generic_Software::StartDecodeThread() was never called" ); @@ -152,10 +152,20 @@ void RageSound_Generic_Software::Mix( int16_t *pBuf, int iFrames, int64_t iFrame ++underruns; } - memset( pBuf, 0, iFrames*bytes_per_frame ); - mix.read( pBuf ); + return mix; } +void RageSound_Generic_Software::Mix( int16_t *pBuf, int iFrames, int64_t iFrameNumber, int64_t iCurrentFrame ) +{ + memset( pBuf, 0, iFrames*bytes_per_frame ); + MixIntoBuffer( iFrames, iFrameNumber, iCurrentFrame ).read( pBuf ); +} + +void RageSound_Generic_Software::Mix( float *pBuf, int iFrames, int64_t iFrameNumber, int64_t iCurrentFrame ) +{ + memset( pBuf, 0, iFrames*bytes_per_frame*2 ); + MixIntoBuffer( iFrames, iFrameNumber, iCurrentFrame ).read( pBuf ); +} void RageSound_Generic_Software::DecodeThread() { diff --git a/stepmania/src/arch/Sound/RageSoundDriver_Generic_Software.h b/stepmania/src/arch/Sound/RageSoundDriver_Generic_Software.h index d5f0950c88..96a1b07954 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_Generic_Software.h +++ b/stepmania/src/arch/Sound/RageSoundDriver_Generic_Software.h @@ -6,6 +6,7 @@ #include "RageTimer.h" #include "RageUtil_CircularBuffer.h" +class RageSoundMixBuffer; static const int samples_per_block = 512; class RageSound_Generic_Software: public RageSoundDriver { @@ -47,7 +48,8 @@ protected: * This function only mixes data; it will not lock any mutexes or do any file access, and * is safe to call from a realtime thread. */ - void Mix( int16_t *pBuf, int iFrame, int64_t iFrameNumber, int64_t iCurrentFrame ); + void Mix( int16_t *pBuf, int iFrames, int64_t iFrameNumber, int64_t iCurrentFrame ); + void Mix( float *pBuf, int iFrames, int64_t iFrameNumber, int64_t iCurrentFrame ); /* This mutex is used for serializing with the decoder thread. Locking this mutex * can take a while. */ @@ -144,6 +146,7 @@ private: static int DecodeThread_start( void *p ); void DecodeThread(); + RageSoundMixBuffer &MixIntoBuffer( int iFrames, int64_t iFrameNumber, int64_t iCurrentFrame ); RageThread m_DecodeThread; int GetDataForSound( Sound &s );