added function to query core audio buffer size range
This commit is contained in:
parent
c1390f8c18
commit
4b2f4dcd37
2 changed files with 46 additions and 1 deletions
|
|
@ -124,6 +124,19 @@ AudioDeviceID PaMacCore_GetStreamOutputDevice( PaStream* s );
|
|||
*/
|
||||
const char *PaMacCore_GetChannelName( int device, int channelIndex, bool input );
|
||||
|
||||
|
||||
/** Retrieve the range of legal native buffer sizes for the specificed device, in sample frames.
|
||||
|
||||
@param device The global index of the PortAudio device about which the query is being made.
|
||||
@param minBufferSizeFrames A pointer to the location which will receive the minimum buffer size value.
|
||||
@param maxBufferSizeFrames A pointer to the location which will receive the maximum buffer size value.
|
||||
|
||||
@see kAudioDevicePropertyBufferFrameSizeRange in the CoreAudio SDK.
|
||||
*/
|
||||
PaError PaMacCore_GetBufferSizeRange( PaDeviceIndex device,
|
||||
long *minBufferSizeFrames, long *maxBufferSizeFrames );
|
||||
|
||||
|
||||
/**
|
||||
* Flags
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -205,7 +205,39 @@ const char *PaMacCore_GetChannelName( int device, int channelIndex, bool input )
|
|||
}
|
||||
|
||||
|
||||
PaError PaMacCore_GetBufferSizeRange( PaDeviceIndex device,
|
||||
long *minBufferSizeFrames, long *maxBufferSizeFrames )
|
||||
{
|
||||
PaError result;
|
||||
PaUtilHostApiRepresentation *hostApi;
|
||||
|
||||
result = PaUtil_GetHostApiRepresentation( &hostApi, paCoreAudio );
|
||||
|
||||
if( result == paNoError )
|
||||
{
|
||||
PaDeviceIndex hostApiDeviceIndex;
|
||||
result = PaUtil_DeviceIndexToHostApiDeviceIndex( &hostApiDeviceIndex, device, hostApi );
|
||||
if( result == paNoError )
|
||||
{
|
||||
PaMacAUHAL *macCoreHostApi = (PaMacAUHAL*)hostApi;
|
||||
AudioDeviceID macCoreDeviceId = macCoreHostApi->devIds[hostApiDeviceIndex];
|
||||
AudioValueRange audioRange;
|
||||
UInt32 propSize = sizeof( audioRange );
|
||||
|
||||
// return the size range for the output scope unless we only have inputs
|
||||
Boolean isInput = 0;
|
||||
if( macCoreHostApi->inheritedHostApiRep.deviceInfos[hostApiDeviceIndex]->maxOutputChannels == 0 )
|
||||
isInput = 1;
|
||||
|
||||
result = WARNING(AudioDeviceGetProperty( macCoreDeviceId, 0, isInput, kAudioDevicePropertyBufferFrameSizeRange, &propSize, &audioRange ) );
|
||||
|
||||
*minBufferSizeFrames = audioRange.mMinimum;
|
||||
*maxBufferSizeFrames = audioRange.mMaximum;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
AudioDeviceID PaMacCore_GetStreamInputDevice( PaStream* s )
|
||||
|
|
|
|||
Loading…
Reference in a new issue