bug fix and some code style changes
This commit is contained in:
parent
45795c469a
commit
c280e99425
1 changed files with 18 additions and 19 deletions
|
@ -885,25 +885,7 @@ if ( iNumInChan == 4 )
|
||||||
if ( outOutputData->mBuffers[0].mDataByteSize ==
|
if ( outOutputData->mBuffers[0].mDataByteSize ==
|
||||||
static_cast<UInt32> ( iCoreAudioBufferSizeMono * iNumOutChan * 4 ) )
|
static_cast<UInt32> ( iCoreAudioBufferSizeMono * iNumOutChan * 4 ) )
|
||||||
{
|
{
|
||||||
// Outputs are to individual buffers too, rather than using channels
|
// one buffer with all the channels in interleaved format:
|
||||||
Float32* pLeftOutData = static_cast<Float32*> ( outOutputData->mBuffers[iSelOutputLeftChannel].mData );
|
|
||||||
Float32* pRightOutData = static_cast<Float32*> ( outOutputData->mBuffers[iSelOutputRightChannel].mData );
|
|
||||||
|
|
||||||
// copy output data
|
|
||||||
for ( int i = 0; i < iCoreAudioBufferSizeMono; i++ )
|
|
||||||
{
|
|
||||||
// left
|
|
||||||
pLeftOutData[i] =
|
|
||||||
(Float32) pSound->vecsTmpAudioSndCrdStereo[2 * i] / _MAXSHORT;
|
|
||||||
|
|
||||||
// right
|
|
||||||
pRightOutData[i] =
|
|
||||||
(Float32) pSound->vecsTmpAudioSndCrdStereo[2 * i + 1] / _MAXSHORT;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if ( outOutputData->mBuffers[0].mDataByteSize ==
|
|
||||||
static_cast<UInt32> ( iCoreAudioBufferSizeMono * iNumOutChan * 4 ) ) {
|
|
||||||
// Outputs are 2 channels in one buffer
|
|
||||||
// get a pointer to the input data of the correct type
|
// get a pointer to the input data of the correct type
|
||||||
Float32* pOutData = static_cast<Float32*> ( outOutputData->mBuffers[0].mData );
|
Float32* pOutData = static_cast<Float32*> ( outOutputData->mBuffers[0].mData );
|
||||||
|
|
||||||
|
@ -919,6 +901,23 @@ if ( iNumInChan == 4 )
|
||||||
(Float32) pSound->vecsTmpAudioSndCrdStereo[2 * i + 1] / _MAXSHORT;
|
(Float32) pSound->vecsTmpAudioSndCrdStereo[2 * i + 1] / _MAXSHORT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ( outOutputData->mNumberBuffers == (UInt32) iNumOutChan && // we should have a matching number of buffers to channels
|
||||||
|
outOutputData->mBuffers[0].mDataByteSize == static_cast<UInt32> ( iCoreAudioBufferSizeMono * 4 ) )
|
||||||
|
{
|
||||||
|
// Outputs are to individual buffers too, rather than using channels
|
||||||
|
Float32* pLeftOutData = static_cast<Float32*> ( outOutputData->mBuffers[iSelOutputLeftChannel].mData );
|
||||||
|
Float32* pRightOutData = static_cast<Float32*> ( outOutputData->mBuffers[iSelOutputRightChannel].mData );
|
||||||
|
|
||||||
|
// copy output data
|
||||||
|
for ( int i = 0; i < iCoreAudioBufferSizeMono; i++ )
|
||||||
|
{
|
||||||
|
// left
|
||||||
|
pLeftOutData[i] = (Float32) pSound->vecsTmpAudioSndCrdStereo[2 * i] / _MAXSHORT;
|
||||||
|
|
||||||
|
// right
|
||||||
|
pRightOutData[i] = (Float32) pSound->vecsTmpAudioSndCrdStereo[2 * i + 1] / _MAXSHORT;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return kAudioHardwareNoError;
|
return kAudioHardwareNoError;
|
||||||
|
|
Loading…
Reference in a new issue