All subclasses to get float data.

This commit is contained in:
Steve Checkoway
2006-12-11 13:54:39 +00:00
parent e7832c9ad4
commit 996385f795
2 changed files with 17 additions and 4 deletions
@@ -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()
{
@@ -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 );