bug/compile fixes

This commit is contained in:
Volker Fischer 2020-05-03 14:18:22 +02:00
parent 1e5f168c5a
commit af5a85ceb1
2 changed files with 12 additions and 24 deletions

View file

@ -257,7 +257,6 @@ void CSound::GetAudioDeviceInfos ( const AudioDeviceID DeviceID,
} }
int CSound::CountChannels ( AudioDeviceID devID, int CSound::CountChannels ( AudioDeviceID devID,
const int iNumChanPerFrame,
bool isInput ) bool isInput )
{ {
OSStatus err; OSStatus err;
@ -472,9 +471,6 @@ QString CSound::CheckDeviceCapabilities ( const int iDriverIdx )
"not compatible with this software." ); "not compatible with this software." );
} }
// store the input number of channels per frame for this stream
const int iNumInChanPerFrame = CurDevStreamFormat.mChannelsPerFrame;
// check the output // check the output
AudioObjectGetPropertyData ( outputStreamID, AudioObjectGetPropertyData ( outputStreamID,
&stPropertyAddress, &stPropertyAddress,
@ -493,12 +489,9 @@ QString CSound::CheckDeviceCapabilities ( const int iDriverIdx )
"not compatible with this software." ); "not compatible with this software." );
} }
// store the output number of channels per frame for this stream
const int iNumOutChanPerFrame = CurDevStreamFormat.mChannelsPerFrame;
// store the input and out number of channels for this device // store the input and out number of channels for this device
iNumInChan = CountChannels ( audioInputDevice[iDriverIdx], iNumInChanPerFrame, true ); iNumInChan = CountChannels ( audioInputDevice[iDriverIdx], true );
iNumOutChan = CountChannels ( audioOutputDevice[iDriverIdx], iNumOutChanPerFrame, false ); iNumOutChan = CountChannels ( audioOutputDevice[iDriverIdx], false );
// clip the number of input/output channels to our allowed maximum // clip the number of input/output channels to our allowed maximum
if ( iNumInChan > MAX_NUM_IN_OUT_CHANNELS ) if ( iNumInChan > MAX_NUM_IN_OUT_CHANNELS )
@ -941,8 +934,6 @@ OSStatus CSound::callbackIO ( AudioDeviceID inDevice,
QMutexLocker locker ( &pSound->Mutex ); QMutexLocker locker ( &pSound->Mutex );
const int iCoreAudioBufferSizeMono = pSound->iCoreAudioBufferSizeMono; const int iCoreAudioBufferSizeMono = pSound->iCoreAudioBufferSizeMono;
const int iNumInChan = pSound->iNumInChan;
const int iNumOutChan = pSound->iNumOutChan;
const int iSelInBufferLeft = pSound->iSelInBufferLeft; const int iSelInBufferLeft = pSound->iSelInBufferLeft;
const int iSelInBufferRight = pSound->iSelInBufferRight; const int iSelInBufferRight = pSound->iSelInBufferRight;
const int iSelInInterlChLeft = pSound->iSelInInterlChLeft; const int iSelInInterlChLeft = pSound->iSelInInterlChLeft;
@ -962,15 +953,13 @@ OSStatus CSound::callbackIO ( AudioDeviceID inDevice,
{ {
// check sizes (note that float32 has four bytes) // check sizes (note that float32 has four bytes)
if ( ( iSelInBufferLeft >= 0 ) && if ( ( iSelInBufferLeft >= 0 ) &&
( iSelInBufferLeft < inInputData->mNumberBuffers ) && ( iSelInBufferLeft < static_cast<int> ( inInputData->mNumberBuffers ) ) &&
( iSelInBufferRight >= 0 ) && ( iSelInBufferRight >= 0 ) &&
( iSelInBufferRight < inInputData->mNumberBuffers ) && ( iSelInBufferRight < static_cast<int> ( inInputData->mNumberBuffers ) ) &&
( iSelAddInBufferLeft < inInputData->mNumberBuffers ) && ( iSelAddInBufferLeft < static_cast<int> ( inInputData->mNumberBuffers ) ) &&
( iSelAddInBufferRight < inInputData->mNumberBuffers ) && ( iSelAddInBufferRight < static_cast<int> ( inInputData->mNumberBuffers ) ) &&
( inInputData->mBuffers[iSelInBufferLeft].mDataByteSize == static_cast<UInt32> ( vecNumInBufChan[iSelInBufferLeft] * iCoreAudioBufferSizeMono * 4 ) && ( inInputData->mBuffers[iSelInBufferLeft].mDataByteSize == static_cast<UInt32> ( vecNumInBufChan[iSelInBufferLeft] * iCoreAudioBufferSizeMono * 4 ) ) &&
( inInputData->mBuffers[iSelInBufferRight].mDataByteSize == static_cast<UInt32> ( vecNumInBufChan[iSelInBufferRight] * iCoreAudioBufferSizeMono * 4 ) && ( inInputData->mBuffers[iSelInBufferRight].mDataByteSize == static_cast<UInt32> ( vecNumInBufChan[iSelInBufferRight] * iCoreAudioBufferSizeMono * 4 ) ) )
( inInputData->mBuffers[iSelAddInBufferLeft].mDataByteSize == static_cast<UInt32> ( vecNumInBufChan[iSelAddInBufferLeft] * iCoreAudioBufferSizeMono * 4 ) &&
( inInputData->mBuffers[iSelAddInBufferRight].mDataByteSize == static_cast<UInt32> ( vecNumInBufChan[iSelAddInBufferRight] * iCoreAudioBufferSizeMono * 4 ) )
{ {
Float32* pLeftData = static_cast<Float32*> ( inInputData->mBuffers[iSelInBufferLeft].mData ); Float32* pLeftData = static_cast<Float32*> ( inInputData->mBuffers[iSelInBufferLeft].mData );
Float32* pRightData = static_cast<Float32*> ( inInputData->mBuffers[iSelInBufferRight].mData ); Float32* pRightData = static_cast<Float32*> ( inInputData->mBuffers[iSelInBufferRight].mData );
@ -1024,11 +1013,11 @@ OSStatus CSound::callbackIO ( AudioDeviceID inDevice,
{ {
// check sizes (note that float32 has four bytes) // check sizes (note that float32 has four bytes)
if ( ( iSelOutBufferLeft >= 0 ) && if ( ( iSelOutBufferLeft >= 0 ) &&
( iSelOutBufferLeft < outOutputData->mNumberBuffers ) && ( iSelOutBufferLeft < static_cast<int> ( outOutputData->mNumberBuffers ) ) &&
( iSelOutBufferRight >= 0 ) && ( iSelOutBufferRight >= 0 ) &&
( iSelOutBufferRight < outOutputData->mNumberBuffers ) && ( iSelOutBufferRight < static_cast<int> ( outOutputData->mNumberBuffers ) ) &&
( outOutputData->mBuffers[iSelOutBufferLeft].mDataByteSize == static_cast<UInt32> ( vecNumOutBufChan[iSelOutBufferLeft] * iCoreAudioBufferSizeMono * 4 ) && ( outOutputData->mBuffers[iSelOutBufferLeft].mDataByteSize == static_cast<UInt32> ( vecNumOutBufChan[iSelOutBufferLeft] * iCoreAudioBufferSizeMono * 4 ) ) &&
( outOutputData->mBuffers[iSelOutBufferRight].mDataByteSize == static_cast<UInt32> ( vecNumOutBufChan[iSelOutBufferRight] * iCoreAudioBufferSizeMono * 4 ) ) ( outOutputData->mBuffers[iSelOutBufferRight].mDataByteSize == static_cast<UInt32> ( vecNumOutBufChan[iSelOutBufferRight] * iCoreAudioBufferSizeMono * 4 ) ) )
{ {
Float32* pLeftData = static_cast<Float32*> ( outOutputData->mBuffers[iSelOutBufferLeft].mData ); Float32* pLeftData = static_cast<Float32*> ( outOutputData->mBuffers[iSelOutBufferLeft].mData );
Float32* pRightData = static_cast<Float32*> ( outOutputData->mBuffers[iSelOutBufferRight].mData ); Float32* pRightData = static_cast<Float32*> ( outOutputData->mBuffers[iSelOutBufferRight].mData );

View file

@ -97,7 +97,6 @@ protected:
void UpdateChSelection(); void UpdateChSelection();
int CountChannels ( AudioDeviceID devID, int CountChannels ( AudioDeviceID devID,
const int iNumChanPerFrame,
bool isInput ); bool isInput );
UInt32 SetBufferSize ( AudioDeviceID& audioDeviceID, UInt32 SetBufferSize ( AudioDeviceID& audioDeviceID,