float
This commit is contained in:
@@ -153,7 +153,7 @@ public:
|
|||||||
int GetLength() const { return 0; }
|
int GetLength() const { return 0; }
|
||||||
int GetLength_Fast() const { return 0; }
|
int GetLength_Fast() const { return 0; }
|
||||||
int SetPosition( int iFrame ) { return 1; }
|
int SetPosition( int iFrame ) { return 1; }
|
||||||
int Read( int16_t *pBuf, int iFrames ) { return RageSoundReader::END_OF_FILE; }
|
int Read( float *pBuf, int iFrames ) { return RageSoundReader::END_OF_FILE; }
|
||||||
RageSoundReader *Copy() const { return new RageSoundReader_Silence; }
|
RageSoundReader *Copy() const { return new RageSoundReader_Silence; }
|
||||||
int GetSampleRate() const { return 44100; }
|
int GetSampleRate() const { return 44100; }
|
||||||
unsigned GetNumChannels() const { return 1; }
|
unsigned GetNumChannels() const { return 1; }
|
||||||
@@ -270,7 +270,7 @@ void RageSound::LoadSoundReader( RageSoundReader *pSound )
|
|||||||
* conditions are masked and will be seen on the next call. Otherwise, the requested
|
* conditions are masked and will be seen on the next call. Otherwise, the requested
|
||||||
* number of frames will always be returned.
|
* number of frames will always be returned.
|
||||||
*/
|
*/
|
||||||
int RageSound::GetDataToPlay( int16_t *pBuffer, int iFrames, int64_t &iStreamFrame, int &iFramesStored )
|
int RageSound::GetDataToPlay( float *pBuffer, int iFrames, int64_t &iStreamFrame, int &iFramesStored )
|
||||||
{
|
{
|
||||||
/* We only update m_iStreamFrame; only take a shared lock, so we don't block the main thread. */
|
/* We only update m_iStreamFrame; only take a shared lock, so we don't block the main thread. */
|
||||||
// LockMut(m_Mutex);
|
// LockMut(m_Mutex);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class RageSoundBase
|
|||||||
public:
|
public:
|
||||||
virtual ~RageSoundBase() { }
|
virtual ~RageSoundBase() { }
|
||||||
virtual void SoundIsFinishedPlaying() = 0;
|
virtual void SoundIsFinishedPlaying() = 0;
|
||||||
virtual int GetDataToPlay( int16_t *buffer, int size, int64_t &iStreamFrame, int &got_bytes ) = 0;
|
virtual int GetDataToPlay( float *buffer, int size, int64_t &iStreamFrame, int &got_bytes ) = 0;
|
||||||
virtual void CommitPlayingPosition( int64_t iFrameno, int64_t iPosition, int iBytesRead ) = 0;
|
virtual void CommitPlayingPosition( int64_t iFrameno, int64_t iPosition, int iBytesRead ) = 0;
|
||||||
virtual int GetSampleRate() const = 0;
|
virtual int GetSampleRate() const = 0;
|
||||||
virtual RageTimer GetStartTime() const { return RageZeroTimer; }
|
virtual RageTimer GetStartTime() const { return RageZeroTimer; }
|
||||||
@@ -193,7 +193,7 @@ public:
|
|||||||
* signals the stream to stop; once it's flushed, SoundStopped will be called.
|
* signals the stream to stop; once it's flushed, SoundStopped will be called.
|
||||||
* Until then, SOUNDMAN->GetPosition can still be called; the sound is still
|
* Until then, SOUNDMAN->GetPosition can still be called; the sound is still
|
||||||
* playing. */
|
* playing. */
|
||||||
int GetDataToPlay( int16_t *pBuffer, int iSize, int64_t &iStreamFrame, int &iBytesRead );
|
int GetDataToPlay( float *pBuffer, int iSize, int64_t &iStreamFrame, int &iBytesRead );
|
||||||
void CommitPlayingPosition( int64_t iHardwareFrame, int64_t iStreamFrame, int iGotFrames );
|
void CommitPlayingPosition( int64_t iHardwareFrame, int64_t iStreamFrame, int iGotFrames );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -145,8 +145,8 @@ private:
|
|||||||
*/
|
*/
|
||||||
struct sound_block
|
struct sound_block
|
||||||
{
|
{
|
||||||
int16_t m_Buffer[samples_per_block];
|
float m_Buffer[samples_per_block];
|
||||||
int16_t *m_BufferNext; // beginning of the unread data
|
float *m_BufferNext; // beginning of the unread data
|
||||||
int m_FramesInBuffer; // total number of frames at m_BufferNext
|
int m_FramesInBuffer; // total number of frames at m_BufferNext
|
||||||
int64_t m_iPosition; // stream frame of m_BufferNext
|
int64_t m_iPosition; // stream frame of m_BufferNext
|
||||||
sound_block() { m_FramesInBuffer = m_iPosition = 0; m_BufferNext = m_Buffer; }
|
sound_block() { m_FramesInBuffer = m_iPosition = 0; m_BufferNext = m_Buffer; }
|
||||||
|
|||||||
@@ -127,7 +127,6 @@ RageSoundMixBuffer &RageSoundDriver::MixIntoBuffer( int iFrames, int64_t iFrameN
|
|||||||
|
|
||||||
/* Note that, until we call advance_read_pointer, we can safely write to p[0]. */
|
/* Note that, until we call advance_read_pointer, we can safely write to p[0]. */
|
||||||
const int frames_to_read = min( iFramesLeft, p[0]->m_FramesInBuffer );
|
const int frames_to_read = min( iFramesLeft, p[0]->m_FramesInBuffer );
|
||||||
mix.SetVolume( s.m_fVolume );
|
|
||||||
mix.SetWriteOffset( iGotFrames*channels );
|
mix.SetWriteOffset( iGotFrames*channels );
|
||||||
mix.write( p[0]->m_BufferNext, frames_to_read * channels );
|
mix.write( p[0]->m_BufferNext, frames_to_read * channels );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user