try to keep API boundaries passing frames, instead of bytes

This commit is contained in:
Glenn Maynard
2004-06-06 04:25:36 +00:00
parent ee344530aa
commit 9cb17abd2a
3 changed files with 5 additions and 5 deletions
+2 -1
View File
@@ -40,7 +40,8 @@ OSStatus AudioConverter::FormatConverterInputProc(UInt32& ioNumberDataPackets,
} }
buf.mData = mBuffer; buf.mData = mBuffer;
mDriver->FillConverter( buf.mData, buf.mDataByteSize ); const int frames = buf.mDataByteSize / kBytesPerPacket;
mDriver->FillConverter( buf.mData, frames );
return noErr; return noErr;
} }
@@ -239,9 +239,8 @@ int64_t RageSound_CA::GetPosition(const RageSoundBase *sound) const
return int64_t(time.mSampleTime); return int64_t(time.mSampleTime);
} }
void RageSound_CA::FillConverter(void *data, UInt32 dataByteSize) void RageSound_CA::FillConverter( void *data, UInt32 frames )
{ {
int frames = dataByteSize / gConverter->GetInputFormat().mBytesPerPacket;
this->Mix( (int16_t *)data, frames, mDecodePos, int64_t(mNow->mSampleTime) ); this->Mix( (int16_t *)data, frames, mDecodePos, int64_t(mNow->mSampleTime) );
} }
@@ -35,7 +35,7 @@ private:
void *inData); void *inData);
public: public:
void FillConverter(void *data, UInt32 dataByteSize); void FillConverter( void *data, UInt32 frames );
RageSound_CA(); RageSound_CA();
~RageSound_CA(); ~RageSound_CA();
float GetPlayLatency() const { return mLatency; } float GetPlayLatency() const { return mLatency; }