pass errors

fix iMaxFrameRequested with negative frames
This commit is contained in:
Glenn Maynard
2006-12-27 02:00:15 +00:00
parent 102ccf3ed1
commit 24ecf88620
2 changed files with 3 additions and 4 deletions
@@ -86,6 +86,7 @@ int RageSoundReader_Split::GetSampleRate() const { return m_pImpl->m_pSource->Ge
unsigned RageSoundReader_Split::GetNumChannels() const { return m_iNumOutputChannels; } unsigned RageSoundReader_Split::GetNumChannels() const { return m_iNumOutputChannels; }
int RageSoundReader_Split::GetNextSourceFrame() const { return m_iPositionFrame; } int RageSoundReader_Split::GetNextSourceFrame() const { return m_iPositionFrame; }
float RageSoundReader_Split::GetStreamToSourceRatio() const { return 1.0f; } float RageSoundReader_Split::GetStreamToSourceRatio() const { return 1.0f; }
RString RageSoundReader_Split::GetError() const { return m_pImpl->m_pSource->GetError(); }
RageSoundReader_Split::RageSoundReader_Split( RageSoundSplitterImpl *pImpl ) RageSoundReader_Split::RageSoundReader_Split( RageSoundSplitterImpl *pImpl )
{ {
@@ -136,10 +137,7 @@ int RageSoundReader_Split::Read( char *pBuf, int iFrames )
m_iRequestFrames = iFrames; m_iRequestFrames = iFrames;
int iRet = m_pImpl->ReadBuffer(); int iRet = m_pImpl->ReadBuffer();
if( iRet < 0 ) if( iRet < 0 )
{
this->SetError( m_pImpl->m_pSource->GetError() );
return iRet; return iRet;
}
int iBytesAvailable = m_pImpl->m_sBuffer.size(); int iBytesAvailable = m_pImpl->m_sBuffer.size();
const char *pSrc = m_pImpl->m_sBuffer.data(); const char *pSrc = m_pImpl->m_sBuffer.data();
@@ -181,7 +179,7 @@ int RageSoundSplitterImpl::ReadBuffer()
{ {
/* Discard any bytes that are no longer requested by any sound. */ /* Discard any bytes that are no longer requested by any sound. */
int iMinFrameRequested = INT_MAX; int iMinFrameRequested = INT_MAX;
int iMaxFrameRequested = 0; int iMaxFrameRequested = INT_MIN;
FOREACHS( RageSoundReader_Split *, m_apSounds, snd ) FOREACHS( RageSoundReader_Split *, m_apSounds, snd )
{ {
iMinFrameRequested = min( iMinFrameRequested, (*snd)->m_iPositionFrame ); iMinFrameRequested = min( iMinFrameRequested, (*snd)->m_iPositionFrame );
@@ -23,6 +23,7 @@ public:
virtual bool SetProperty( const RString &sProperty, float fValue ); virtual bool SetProperty( const RString &sProperty, float fValue );
virtual int GetNextSourceFrame() const; virtual int GetNextSourceFrame() const;
virtual float GetStreamToSourceRatio() const; virtual float GetStreamToSourceRatio() const;
virtual RString GetError() const;
void AddSourceChannelToSound( int iFromChannel, int iToChannel ); void AddSourceChannelToSound( int iFromChannel, int iToChannel );