go back to original version with recent Mac audio interface changes

This commit is contained in:
Volker Fischer 2020-04-14 19:30:15 +02:00
parent 33f6cb300c
commit 802e688443
2 changed files with 11 additions and 29 deletions

View File

@ -254,14 +254,12 @@ void CSound::GetAudioDeviceInfos ( const AudioDeviceID DeviceID,
}
}
bool CSound::CountChannels ( AudioDeviceID devID,
bool isInput,
int& iNumChannels )
int CSound::CountChannels ( AudioDeviceID devID,
bool isInput )
{
OSStatus err;
bool bIsError = true;
UInt32 propSize;
iNumChannels = 0;
int result = 0;
AudioObjectPropertyScope theScope = isInput ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput;
@ -282,14 +280,12 @@ bool CSound::CountChannels ( AudioDeviceID devID,
// The correct value mNumberChannels for an AudioBuffer can be derived from the mChannelsPerFrame
// and the interleaved flag. For non interleaved formats, mNumberChannels is always 1.
// For interleaved formats, mNumberChannels is equal to mChannelsPerFrame.
iNumChannels += buflist->mBuffers[i].mNumberChannels;
result += buflist->mBuffers[i].mNumberChannels;
}
bIsError = false;
}
free ( buflist );
return bIsError;
return result;
}
QString CSound::LoadAndInitializeDriver ( int iDriverIdx )
@ -453,9 +449,6 @@ QString CSound::CheckDeviceCapabilities ( const int iDriverIdx )
"not compatible with this software." );
}
// store the input number of channels for this stream
const int iNumInChanPerFrame = CurDevStreamFormat.mChannelsPerFrame;
// check the output
AudioObjectGetPropertyData ( outputStreamID,
&stPropertyAddress,
@ -474,19 +467,9 @@ QString CSound::CheckDeviceCapabilities ( const int iDriverIdx )
"not compatible with this software." );
}
// store the output number of channels for this stream
const int iNumOutChanPerFrame = CurDevStreamFormat.mChannelsPerFrame;
// store the input and out number of channels for this device (note that in
// case the CountChannels failed, we use the number of channels per frame instead)
if ( CountChannels ( audioInputDevice[iDriverIdx], true, iNumInChan ) )
{
iNumInChan = iNumInChanPerFrame;
}
if ( CountChannels ( audioOutputDevice[iDriverIdx], false, iNumOutChan ) )
{
iNumOutChan = iNumOutChanPerFrame;
}
// store the input and out number of channels for this device
iNumInChan = CountChannels ( audioInputDevice[iDriverIdx], true );
iNumOutChan = CountChannels ( audioOutputDevice[iDriverIdx], false );
// clip the number of input/output channels to our allowed maximum
if ( iNumInChan > MAX_NUM_IN_OUT_CHANNELS )
@ -728,7 +711,7 @@ int CSound::Init ( const int iNewPrefMonoBufferSize )
}
// store buffer size
iCoreAudioBufferSizeMono = iActualMonoBufferSize;
iCoreAudioBufferSizeMono = iActualMonoBufferSize;
// init base class
CSoundBase::Init ( iCoreAudioBufferSizeMono );

View File

@ -78,9 +78,8 @@ protected:
virtual QString LoadAndInitializeDriver ( int iIdx );
QString CheckDeviceCapabilities ( const int iDriverIdx );
bool CountChannels ( AudioDeviceID devID,
bool isInput,
int& iNumChannels );
OSStatus CountChannels ( AudioDeviceID devID,
bool isInput );
UInt32 SetBufferSize ( AudioDeviceID& audioDeviceID,
const bool bIsInput,