This commit is contained in:
Glenn Maynard
2007-01-27 07:18:52 +00:00
parent 1bd5513698
commit 1bf9de3543
4 changed files with 6 additions and 7 deletions
+2 -2
View File
@@ -153,7 +153,7 @@ public:
int GetLength() const { return 0; }
int GetLength_Fast() const { return 0; }
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; }
int GetSampleRate() const { return 44100; }
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
* 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. */
// LockMut(m_Mutex);
+2 -2
View File
@@ -16,7 +16,7 @@ class RageSoundBase
public:
virtual ~RageSoundBase() { }
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 int GetSampleRate() const = 0;
virtual RageTimer GetStartTime() const { return RageZeroTimer; }
@@ -193,7 +193,7 @@ public:
* 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
* 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 );
};
+2 -2
View File
@@ -145,8 +145,8 @@ private:
*/
struct sound_block
{
int16_t m_Buffer[samples_per_block];
int16_t *m_BufferNext; // beginning of the unread data
float m_Buffer[samples_per_block];
float *m_BufferNext; // beginning of the unread data
int m_FramesInBuffer; // total number of frames at m_BufferNext
int64_t m_iPosition; // stream frame of m_BufferNext
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]. */
const int frames_to_read = min( iFramesLeft, p[0]->m_FramesInBuffer );
mix.SetVolume( s.m_fVolume );
mix.SetWriteOffset( iGotFrames*channels );
mix.write( p[0]->m_BufferNext, frames_to_read * channels );