From 9cb17abd2ab1e4e28a0eb75dc6f1682708baa961 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 6 Jun 2004 04:25:36 +0000 Subject: [PATCH] try to keep API boundaries passing frames, instead of bytes --- stepmania/src/arch/Sound/CAHelpers.cpp | 3 ++- stepmania/src/arch/Sound/RageSoundDriver_CA.cpp | 5 ++--- stepmania/src/arch/Sound/RageSoundDriver_CA.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/stepmania/src/arch/Sound/CAHelpers.cpp b/stepmania/src/arch/Sound/CAHelpers.cpp index 8322e9f313..61041f583d 100644 --- a/stepmania/src/arch/Sound/CAHelpers.cpp +++ b/stepmania/src/arch/Sound/CAHelpers.cpp @@ -40,7 +40,8 @@ OSStatus AudioConverter::FormatConverterInputProc(UInt32& ioNumberDataPackets, } buf.mData = mBuffer; - mDriver->FillConverter( buf.mData, buf.mDataByteSize ); + const int frames = buf.mDataByteSize / kBytesPerPacket; + mDriver->FillConverter( buf.mData, frames ); return noErr; } diff --git a/stepmania/src/arch/Sound/RageSoundDriver_CA.cpp b/stepmania/src/arch/Sound/RageSoundDriver_CA.cpp index c741c1dc80..c8aab195a4 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_CA.cpp +++ b/stepmania/src/arch/Sound/RageSoundDriver_CA.cpp @@ -239,10 +239,9 @@ int64_t RageSound_CA::GetPosition(const RageSoundBase *sound) const 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) ); } OSStatus RageSound_CA::GetData(AudioDeviceID inDevice, diff --git a/stepmania/src/arch/Sound/RageSoundDriver_CA.h b/stepmania/src/arch/Sound/RageSoundDriver_CA.h index 7cf002de9d..2b460e332c 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_CA.h +++ b/stepmania/src/arch/Sound/RageSoundDriver_CA.h @@ -35,7 +35,7 @@ private: void *inData); public: - void FillConverter(void *data, UInt32 dataByteSize); + void FillConverter( void *data, UInt32 frames ); RageSound_CA(); ~RageSound_CA(); float GetPlayLatency() const { return mLatency; }