remove support for OS X 10.4, rename functions pa_ -> PaMacCore_
This commit is contained in:
parent
f4ca438599
commit
1d3a239fd0
3 changed files with 105 additions and 328 deletions
|
|
@ -138,7 +138,7 @@ const char *PaMacCore_GetChannelName( int device, int channelIndex, bool input )
|
|||
|
||||
/* First try with CFString */
|
||||
UInt32 size = sizeof(nameRef);
|
||||
error = pa_AudioDeviceGetProperty( hostApiDevice,
|
||||
error = PaMacCore_AudioDeviceGetProperty( hostApiDevice,
|
||||
channelIndex + 1,
|
||||
input,
|
||||
kAudioDevicePropertyChannelNameCFString,
|
||||
|
|
@ -148,7 +148,7 @@ const char *PaMacCore_GetChannelName( int device, int channelIndex, bool input )
|
|||
{
|
||||
/* try the C String */
|
||||
size = 0;
|
||||
error = pa_AudioDeviceGetPropertySize( hostApiDevice,
|
||||
error = PaMacCore_AudioDeviceGetPropertySize( hostApiDevice,
|
||||
channelIndex + 1,
|
||||
input,
|
||||
kAudioDevicePropertyChannelName,
|
||||
|
|
@ -158,7 +158,7 @@ const char *PaMacCore_GetChannelName( int device, int channelIndex, bool input )
|
|||
if( !ensureChannelNameSize( size ) )
|
||||
return NULL;
|
||||
|
||||
error = pa_AudioDeviceGetProperty( hostApiDevice,
|
||||
error = PaMacCore_AudioDeviceGetProperty( hostApiDevice,
|
||||
channelIndex + 1,
|
||||
input,
|
||||
kAudioDevicePropertyChannelName,
|
||||
|
|
@ -223,7 +223,7 @@ PaError PaMacCore_GetBufferSizeRange( PaDeviceIndex device,
|
|||
if( macCoreHostApi->inheritedHostApiRep.deviceInfos[hostApiDeviceIndex]->maxOutputChannels == 0 )
|
||||
isInput = 1;
|
||||
|
||||
result = WARNING(pa_AudioDeviceGetProperty( macCoreDeviceId, 0, isInput, kAudioDevicePropertyBufferFrameSizeRange, &propSize, &audioRange ) );
|
||||
result = WARNING(PaMacCore_AudioDeviceGetProperty( macCoreDeviceId, 0, isInput, kAudioDevicePropertyBufferFrameSizeRange, &propSize, &audioRange ) );
|
||||
|
||||
*minBufferSizeFrames = audioRange.mMinimum;
|
||||
*maxBufferSizeFrames = audioRange.mMaximum;
|
||||
|
|
@ -352,7 +352,7 @@ static PaError gatherDeviceInfo(PaMacAUHAL *auhalHostApi)
|
|||
auhalHostApi->devIds = NULL;
|
||||
|
||||
/* -- figure out how many devices there are -- */
|
||||
pa_AudioHardwareGetPropertySize( kAudioHardwarePropertyDevices,
|
||||
PaMacCore_AudioHardwareGetPropertySize( kAudioHardwarePropertyDevices,
|
||||
&propsize);
|
||||
auhalHostApi->devCount = propsize / sizeof( AudioDeviceID );
|
||||
|
||||
|
|
@ -364,7 +364,7 @@ static PaError gatherDeviceInfo(PaMacAUHAL *auhalHostApi)
|
|||
propsize );
|
||||
if( !auhalHostApi->devIds )
|
||||
return paInsufficientMemory;
|
||||
pa_AudioHardwareGetProperty( kAudioHardwarePropertyDevices,
|
||||
PaMacCore_AudioHardwareGetProperty( kAudioHardwarePropertyDevices,
|
||||
&propsize,
|
||||
auhalHostApi->devIds );
|
||||
#ifdef MAC_CORE_VERBOSE_DEBUG
|
||||
|
|
@ -383,7 +383,7 @@ static PaError gatherDeviceInfo(PaMacAUHAL *auhalHostApi)
|
|||
/* I am not sure how these calls to AudioHardwareGetProperty()
|
||||
could fail, but in case they do, we use the first available
|
||||
device as the default. */
|
||||
if( 0 != pa_AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice,
|
||||
if( 0 != PaMacCore_AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice,
|
||||
&size,
|
||||
&auhalHostApi->defaultIn) ) {
|
||||
int i;
|
||||
|
|
@ -400,7 +400,7 @@ static PaError gatherDeviceInfo(PaMacAUHAL *auhalHostApi)
|
|||
}
|
||||
}
|
||||
}
|
||||
if( 0 != pa_AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice,
|
||||
if( 0 != PaMacCore_AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice,
|
||||
&size,
|
||||
&auhalHostApi->defaultOut) ) {
|
||||
int i;
|
||||
|
|
@ -435,7 +435,7 @@ static PaError ClipToDeviceBufferSize( AudioDeviceID macCoreDeviceId,
|
|||
UInt32 resultSize = desiredSize;
|
||||
AudioValueRange audioRange;
|
||||
UInt32 propSize = sizeof( audioRange );
|
||||
PaError err = WARNING(pa_AudioDeviceGetProperty( macCoreDeviceId, 0, isInput, kAudioDevicePropertyBufferFrameSizeRange, &propSize, &audioRange ) );
|
||||
PaError err = WARNING(PaMacCore_AudioDeviceGetProperty( macCoreDeviceId, 0, isInput, kAudioDevicePropertyBufferFrameSizeRange, &propSize, &audioRange ) );
|
||||
resultSize = MAX( resultSize, audioRange.mMinimum );
|
||||
resultSize = MIN( resultSize, audioRange.mMaximum );
|
||||
*allowedSize = resultSize;
|
||||
|
|
@ -485,7 +485,7 @@ static void DumpDeviceProperties( AudioDeviceID macCoreDeviceId,
|
|||
printf("Stream #%d = %d---------------------- \n", i, streamIDs[i] );
|
||||
|
||||
propSize = sizeof(UInt32);
|
||||
err = WARNING(p_AudioStreamGetProperty(streamIDs[i], 0, kAudioStreamPropertyLatency, &propSize, &streamLatency));
|
||||
err = WARNING(PaMacCore_AudioStreamGetProperty(streamIDs[i], 0, kAudioStreamPropertyLatency, &propSize, &streamLatency));
|
||||
printf(" kAudioStreamPropertyLatency: err = %d, propSize = %d, value = %d\n", err, propSize, streamLatency );
|
||||
}
|
||||
}
|
||||
|
|
@ -515,20 +515,20 @@ static PaError CalculateFixedDeviceLatency( AudioDeviceID macCoreDeviceId, int i
|
|||
// To get stream latency we have to get a streamID from the device.
|
||||
// We are only going to look at the first stream so only fetch one stream.
|
||||
propSize = sizeof(streamIDs);
|
||||
err = WARNING(pa_AudioDeviceGetProperty(macCoreDeviceId, 0, isInput, kAudioDevicePropertyStreams, &propSize, &streamIDs[0]));
|
||||
err = WARNING(PaMacCore_AudioDeviceGetProperty(macCoreDeviceId, 0, isInput, kAudioDevicePropertyStreams, &propSize, &streamIDs[0]));
|
||||
if( err != paNoError ) goto error;
|
||||
if( propSize == sizeof(AudioStreamID) )
|
||||
{
|
||||
propSize = sizeof(UInt32);
|
||||
err = WARNING(pa_AudioStreamGetProperty(streamIDs[0], 0, kAudioStreamPropertyLatency, &propSize, &streamLatency));
|
||||
err = WARNING(PaMacCore_AudioStreamGetProperty(streamIDs[0], 0, kAudioStreamPropertyLatency, &propSize, &streamLatency));
|
||||
}
|
||||
|
||||
propSize = sizeof(UInt32);
|
||||
err = WARNING(pa_AudioDeviceGetProperty(macCoreDeviceId, 0, isInput, kAudioDevicePropertySafetyOffset, &propSize, &safetyOffset));
|
||||
err = WARNING(PaMacCore_AudioDeviceGetProperty(macCoreDeviceId, 0, isInput, kAudioDevicePropertySafetyOffset, &propSize, &safetyOffset));
|
||||
if( err != paNoError ) goto error;
|
||||
|
||||
propSize = sizeof(UInt32);
|
||||
err = WARNING(pa_AudioDeviceGetProperty(macCoreDeviceId, 0, isInput, kAudioDevicePropertyLatency, &propSize, &deviceLatency));
|
||||
err = WARNING(PaMacCore_AudioDeviceGetProperty(macCoreDeviceId, 0, isInput, kAudioDevicePropertyLatency, &propSize, &deviceLatency));
|
||||
if( err != paNoError ) goto error;
|
||||
|
||||
*fixedLatencyPtr = deviceLatency + streamLatency + safetyOffset;
|
||||
|
|
@ -558,7 +558,7 @@ static PaError CalculateDefaultDeviceLatencies( AudioDeviceID macCoreDeviceId,
|
|||
|
||||
// For high latency use the default device buffer size.
|
||||
propSize = sizeof(UInt32);
|
||||
err = WARNING(pa_AudioDeviceGetProperty(macCoreDeviceId, 0, isInput, kAudioDevicePropertyBufferFrameSize, &propSize, &bufferFrames));
|
||||
err = WARNING(PaMacCore_AudioDeviceGetProperty(macCoreDeviceId, 0, isInput, kAudioDevicePropertyBufferFrameSize, &propSize, &bufferFrames));
|
||||
if( err != paNoError ) goto error;
|
||||
|
||||
*lowLatencyFramesPtr = fixedLatency + clippedMinBufferSize;
|
||||
|
|
@ -587,14 +587,14 @@ static PaError GetChannelInfo( PaMacAUHAL *auhalHostApi,
|
|||
/* Get the number of channels from the stream configuration.
|
||||
Fail if we can't get this. */
|
||||
|
||||
err = ERR(pa_AudioDeviceGetPropertySize(macCoreDeviceId, 0, isInput, kAudioDevicePropertyStreamConfiguration, &propSize));
|
||||
err = ERR(PaMacCore_AudioDeviceGetPropertySize(macCoreDeviceId, 0, isInput, kAudioDevicePropertyStreamConfiguration, &propSize));
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
buflist = PaUtil_AllocateMemory(propSize);
|
||||
if( !buflist )
|
||||
return paInsufficientMemory;
|
||||
err = ERR(pa_AudioDeviceGetProperty(macCoreDeviceId, 0, isInput, kAudioDevicePropertyStreamConfiguration, &propSize, buflist));
|
||||
err = ERR(PaMacCore_AudioDeviceGetProperty(macCoreDeviceId, 0, isInput, kAudioDevicePropertyStreamConfiguration, &propSize, buflist));
|
||||
if (err)
|
||||
goto error;
|
||||
|
||||
|
|
@ -662,18 +662,18 @@ static PaError InitializeDeviceInfo( PaMacAUHAL *auhalHostApi,
|
|||
|
||||
/* Get the device name using CFString */
|
||||
propSize = sizeof(nameRef);
|
||||
err = ERR(pa_AudioDeviceGetProperty(macCoreDeviceId, 0, 0, kAudioDevicePropertyDeviceNameCFString, &propSize, &nameRef));
|
||||
err = ERR(PaMacCore_AudioDeviceGetProperty(macCoreDeviceId, 0, 0, kAudioDevicePropertyDeviceNameCFString, &propSize, &nameRef));
|
||||
if (err)
|
||||
{
|
||||
/* Get the device name using c string. Fail if we can't get it. */
|
||||
err = ERR(pa_AudioDeviceGetPropertySize(macCoreDeviceId, 0, 0, kAudioDevicePropertyDeviceName, &propSize));
|
||||
err = ERR(PaMacCore_AudioDeviceGetPropertySize(macCoreDeviceId, 0, 0, kAudioDevicePropertyDeviceName, &propSize));
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
name = PaUtil_GroupAllocateMemory(auhalHostApi->allocations,propSize+1);
|
||||
if ( !name )
|
||||
return paInsufficientMemory;
|
||||
err = ERR(pa_AudioDeviceGetProperty(macCoreDeviceId, 0, 0, kAudioDevicePropertyDeviceName, &propSize, name));
|
||||
err = ERR(PaMacCore_AudioDeviceGetProperty(macCoreDeviceId, 0, 0, kAudioDevicePropertyDeviceName, &propSize, name));
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
|
@ -694,7 +694,7 @@ static PaError InitializeDeviceInfo( PaMacAUHAL *auhalHostApi,
|
|||
|
||||
/* Try to get the default sample rate. Don't fail if we can't get this. */
|
||||
propSize = sizeof(Float64);
|
||||
err = ERR(pa_AudioDeviceGetProperty(macCoreDeviceId, 0, 0, kAudioDevicePropertyNominalSampleRate, &propSize, &sampleRate));
|
||||
err = ERR(PaMacCore_AudioDeviceGetProperty(macCoreDeviceId, 0, 0, kAudioDevicePropertyNominalSampleRate, &propSize, &sampleRate));
|
||||
if (err)
|
||||
deviceInfo->defaultSampleRate = 0.0;
|
||||
else
|
||||
|
|
@ -1043,7 +1043,7 @@ static OSStatus UpdateSampleRateFromDeviceProperty( PaMacCoreStream *stream, Aud
|
|||
|
||||
Float64 sampleRate = 0.0;
|
||||
UInt32 propSize = sizeof(Float64);
|
||||
OSStatus osErr = pa_AudioDeviceGetProperty( deviceID, 0, isInput, sampleRatePropertyID, &propSize, &sampleRate);
|
||||
OSStatus osErr = PaMacCore_AudioDeviceGetProperty( deviceID, 0, isInput, sampleRatePropertyID, &propSize, &sampleRate);
|
||||
if( (osErr == noErr) && (sampleRate > 1000.0) ) /* avoid divide by zero if there's an error */
|
||||
{
|
||||
deviceProperties->sampleRate = sampleRate;
|
||||
|
|
@ -1052,45 +1052,28 @@ static OSStatus UpdateSampleRateFromDeviceProperty( PaMacCoreStream *stream, Aud
|
|||
return osErr;
|
||||
}
|
||||
|
||||
#if PA_NEW_HAL
|
||||
static OSStatus AudioDevicePropertyActualSampleRateListenerProc(AudioObjectID inDevice, UInt32 inNumberAddresses, const AudioObjectPropertyAddress * inAddresses, void * inClientData)
|
||||
{
|
||||
PaMacCoreStream * stream = (PaMacCoreStream *) inClientData;
|
||||
PaMacCoreStream *stream = (PaMacCoreStream*)inClientData;
|
||||
bool isInput = inAddresses->mScope == kAudioDevicePropertyScopeInput;
|
||||
|
||||
// Make sure the callback is operating on a stream that is still valid!
|
||||
assert(stream->streamRepresentation.magic == PA_STREAM_MAGIC);
|
||||
|
||||
OSStatus osErr = UpdateSampleRateFromDeviceProperty(stream, inDevice, isInput, kAudioDevicePropertyActualSampleRate);
|
||||
if (osErr == noErr)
|
||||
{
|
||||
UpdateTimeStampOffsets(stream);
|
||||
}
|
||||
return osErr;
|
||||
}
|
||||
#else
|
||||
static OSStatus AudioDevicePropertyActualSampleRateListenerProc( AudioDeviceID inDevice, UInt32 inChannel, Boolean isInput, AudioDevicePropertyID inPropertyID, void *inClientData )
|
||||
{
|
||||
PaMacCoreStream *stream = (PaMacCoreStream*)inClientData;
|
||||
|
||||
// Make sure the callback is operating on a stream that is still valid!
|
||||
assert( stream->streamRepresentation.magic == PA_STREAM_MAGIC );
|
||||
|
||||
OSStatus osErr = UpdateSampleRateFromDeviceProperty( stream, inDevice, isInput, kAudioDevicePropertyActualSampleRate );
|
||||
OSStatus osErr = UpdateSampleRateFromDeviceProperty( stream, inDevice, isInput, kAudioDevicePropertyActualSampleRate );
|
||||
if( osErr == noErr )
|
||||
{
|
||||
UpdateTimeStampOffsets( stream );
|
||||
}
|
||||
return osErr;
|
||||
}
|
||||
#endif /* PA_NEW_HAL */
|
||||
|
||||
/* ================================================================================= */
|
||||
static OSStatus QueryUInt32DeviceProperty( AudioDeviceID deviceID, Boolean isInput, AudioDevicePropertyID propertyID, UInt32 *outValue )
|
||||
{
|
||||
UInt32 propertyValue = 0;
|
||||
UInt32 propertySize = sizeof(UInt32);
|
||||
OSStatus osErr = pa_AudioDeviceGetProperty( deviceID, 0, isInput, propertyID, &propertySize, &propertyValue);
|
||||
OSStatus osErr = PaMacCore_AudioDeviceGetProperty( deviceID, 0, isInput, propertyID, &propertySize, &propertyValue);
|
||||
if( osErr == noErr )
|
||||
{
|
||||
*outValue = propertyValue;
|
||||
|
|
@ -1098,49 +1081,13 @@ static OSStatus QueryUInt32DeviceProperty( AudioDeviceID deviceID, Boolean isInp
|
|||
return osErr;
|
||||
}
|
||||
|
||||
#if PA_NEW_HAL
|
||||
static OSStatus AudioDevicePropertyGenericListenerProc(AudioObjectID inDevice, UInt32 inNumberAddresses, const AudioObjectPropertyAddress * inAddresses, void * inClientData)
|
||||
{
|
||||
OSStatus osErr = noErr;
|
||||
PaMacCoreStream * stream = (PaMacCoreStream *) inClientData;
|
||||
PaMacCoreStream *stream = (PaMacCoreStream*)inClientData;
|
||||
bool isInput = inAddresses->mScope == kAudioDevicePropertyScopeInput;
|
||||
AudioDevicePropertyID inPropertyID = inAddresses->mSelector;
|
||||
|
||||
// Make sure the callback is operating on a stream that is still valid!
|
||||
assert(stream->streamRepresentation.magic == PA_STREAM_MAGIC);
|
||||
|
||||
PaMacCoreDeviceProperties * deviceProperties = isInput ? &stream->inputProperties : &stream->outputProperties;
|
||||
UInt32 * valuePtr = NULL;
|
||||
switch (inPropertyID)
|
||||
{
|
||||
case kAudioDevicePropertySafetyOffset:
|
||||
valuePtr = &deviceProperties->safetyOffset;
|
||||
break;
|
||||
|
||||
case kAudioDevicePropertyLatency:
|
||||
valuePtr = &deviceProperties->deviceLatency;
|
||||
break;
|
||||
|
||||
case kAudioDevicePropertyBufferFrameSize:
|
||||
valuePtr = &deviceProperties->bufferFrameSize;
|
||||
break;
|
||||
}
|
||||
if (valuePtr != NULL)
|
||||
{
|
||||
osErr = QueryUInt32DeviceProperty(inDevice, isInput, inPropertyID, valuePtr);
|
||||
if (osErr == noErr)
|
||||
{
|
||||
UpdateTimeStampOffsets(stream);
|
||||
}
|
||||
}
|
||||
return osErr;
|
||||
}
|
||||
#else
|
||||
static OSStatus AudioDevicePropertyGenericListenerProc( AudioDeviceID inDevice, UInt32 inChannel, Boolean isInput, AudioDevicePropertyID inPropertyID, void *inClientData )
|
||||
{
|
||||
OSStatus osErr = noErr;
|
||||
PaMacCoreStream *stream = (PaMacCoreStream*)inClientData;
|
||||
|
||||
// Make sure the callback is operating on a stream that is still valid!
|
||||
assert( stream->streamRepresentation.magic == PA_STREAM_MAGIC );
|
||||
|
||||
|
|
@ -1170,7 +1117,6 @@ static OSStatus AudioDevicePropertyGenericListenerProc( AudioDeviceID inDevice,
|
|||
}
|
||||
return osErr;
|
||||
}
|
||||
#endif /* PA_NEW_HAL */
|
||||
|
||||
/* ================================================================================= */
|
||||
/*
|
||||
|
|
@ -1187,14 +1133,14 @@ static OSStatus SetupDevicePropertyListeners( PaMacCoreStream *stream, AudioDevi
|
|||
if( (osErr = QueryUInt32DeviceProperty( deviceID, isInput,
|
||||
kAudioDevicePropertySafetyOffset, &deviceProperties->safetyOffset )) != noErr ) return osErr;
|
||||
|
||||
pa_AudioDeviceAddPropertyListener( deviceID, 0, isInput, kAudioDevicePropertyActualSampleRate,
|
||||
PaMacCore_AudioDeviceAddPropertyListener( deviceID, 0, isInput, kAudioDevicePropertyActualSampleRate,
|
||||
AudioDevicePropertyActualSampleRateListenerProc, stream );
|
||||
|
||||
pa_AudioDeviceAddPropertyListener( deviceID, 0, isInput, kAudioStreamPropertyLatency,
|
||||
PaMacCore_AudioDeviceAddPropertyListener( deviceID, 0, isInput, kAudioStreamPropertyLatency,
|
||||
AudioDevicePropertyGenericListenerProc, stream );
|
||||
pa_AudioDeviceAddPropertyListener( deviceID, 0, isInput, kAudioDevicePropertyBufferFrameSize,
|
||||
PaMacCore_AudioDeviceAddPropertyListener( deviceID, 0, isInput, kAudioDevicePropertyBufferFrameSize,
|
||||
AudioDevicePropertyGenericListenerProc, stream );
|
||||
pa_AudioDeviceAddPropertyListener( deviceID, 0, isInput, kAudioDevicePropertySafetyOffset,
|
||||
PaMacCore_AudioDeviceAddPropertyListener( deviceID, 0, isInput, kAudioDevicePropertySafetyOffset,
|
||||
AudioDevicePropertyGenericListenerProc, stream );
|
||||
|
||||
return osErr;
|
||||
|
|
@ -1202,14 +1148,14 @@ static OSStatus SetupDevicePropertyListeners( PaMacCoreStream *stream, AudioDevi
|
|||
|
||||
static void CleanupDevicePropertyListeners( PaMacCoreStream *stream, AudioDeviceID deviceID, Boolean isInput )
|
||||
{
|
||||
pa_AudioDeviceRemovePropertyListener( deviceID, 0, isInput, kAudioDevicePropertyActualSampleRate,
|
||||
PaMacCore_AudioDeviceRemovePropertyListener( deviceID, 0, isInput, kAudioDevicePropertyActualSampleRate,
|
||||
AudioDevicePropertyActualSampleRateListenerProc, stream );
|
||||
|
||||
pa_AudioDeviceRemovePropertyListener( deviceID, 0, isInput, kAudioDevicePropertyLatency,
|
||||
PaMacCore_AudioDeviceRemovePropertyListener( deviceID, 0, isInput, kAudioDevicePropertyLatency,
|
||||
AudioDevicePropertyGenericListenerProc, stream );
|
||||
pa_AudioDeviceRemovePropertyListener( deviceID, 0, isInput, kAudioDevicePropertyBufferFrameSize,
|
||||
PaMacCore_AudioDeviceRemovePropertyListener( deviceID, 0, isInput, kAudioDevicePropertyBufferFrameSize,
|
||||
AudioDevicePropertyGenericListenerProc, stream );
|
||||
pa_AudioDeviceRemovePropertyListener( deviceID, 0, isInput, kAudioDevicePropertySafetyOffset,
|
||||
PaMacCore_AudioDeviceRemovePropertyListener( deviceID, 0, isInput, kAudioDevicePropertySafetyOffset,
|
||||
AudioDevicePropertyGenericListenerProc, stream );
|
||||
}
|
||||
|
||||
|
|
@ -1384,7 +1330,7 @@ static PaError OpenAndSetupOneAudioUnit(
|
|||
sizeof(AudioDeviceID) ) );
|
||||
}
|
||||
/* -- add listener for dropouts -- */
|
||||
result = pa_AudioDeviceAddPropertyListener( *audioDevice,
|
||||
result = PaMacCore_AudioDeviceAddPropertyListener( *audioDevice,
|
||||
0,
|
||||
outStreamParams ? false : true,
|
||||
kAudioDeviceProcessorOverload,
|
||||
|
|
@ -2183,7 +2129,6 @@ PaTime GetStreamTime( PaStream *s )
|
|||
|
||||
#define RING_BUFFER_EMPTY (1000)
|
||||
|
||||
#if PA_NEW_HAL
|
||||
static OSStatus ringBufferIOProc(
|
||||
AudioConverterRef inAudioConverter,
|
||||
UInt32* ioNumberDataPackets,
|
||||
|
|
@ -2200,34 +2145,6 @@ static OSStatus ringBufferIOProc(
|
|||
|
||||
VVDBUG(("ringBufferIOProc()\n"));
|
||||
|
||||
if( PaUtil_GetRingBufferReadAvailable( rb ) == 0 ) {
|
||||
*outData = NULL;
|
||||
*ioDataSize = 0;
|
||||
return RING_BUFFER_EMPTY;
|
||||
}
|
||||
assert(sizeof(UInt32) == sizeof(ring_buffer_size_t));
|
||||
assert( ( (*ioDataSize) / rb->elementSizeBytes ) * rb->elementSizeBytes == (*ioDataSize) ) ;
|
||||
(*ioDataSize) /= rb->elementSizeBytes ;
|
||||
PaUtil_GetRingBufferReadRegions( rb, *ioDataSize,
|
||||
outData, (ring_buffer_size_t *)ioDataSize,
|
||||
&dummyData, &dummySize );
|
||||
assert( *ioDataSize );
|
||||
PaUtil_AdvanceRingBufferReadIndex( rb, *ioDataSize );
|
||||
(*ioDataSize) *= rb->elementSizeBytes ;
|
||||
return noErr;
|
||||
}
|
||||
#else
|
||||
static OSStatus ringBufferIOProc( AudioConverterRef inAudioConverter,
|
||||
UInt32*ioDataSize,
|
||||
void** outData,
|
||||
void*inUserData )
|
||||
{
|
||||
void *dummyData;
|
||||
ring_buffer_size_t dummySize;
|
||||
PaUtilRingBuffer *rb = (PaUtilRingBuffer *) inUserData;
|
||||
|
||||
VVDBUG(("ringBufferIOProc()\n"));
|
||||
|
||||
if( PaUtil_GetRingBufferReadAvailable( rb ) == 0 ) {
|
||||
*outData = NULL;
|
||||
*ioDataSize = 0;
|
||||
|
|
@ -2245,7 +2162,6 @@ static OSStatus ringBufferIOProc( AudioConverterRef inAudioConverter,
|
|||
|
||||
return noErr;
|
||||
}
|
||||
#endif /* PA_NEW_HAL */
|
||||
|
||||
/*
|
||||
* Called by the AudioUnit API to process audio from the sound card.
|
||||
|
|
@ -2467,7 +2383,6 @@ static OSStatus AudioIOProc( void *inRefCon,
|
|||
UInt32 size;
|
||||
float data[ inChan * frames ];
|
||||
size = sizeof( data );
|
||||
#if PA_NEW_HAL
|
||||
AudioBufferList bufferList;
|
||||
bufferList.mNumberBuffers = 1;
|
||||
bufferList.mBuffers[0].mNumberChannels = inChan;
|
||||
|
|
@ -2480,14 +2395,6 @@ static OSStatus AudioIOProc( void *inRefCon,
|
|||
&size,
|
||||
&bufferList,
|
||||
NULL);
|
||||
#else
|
||||
err = AudioConverterFillBuffer(
|
||||
stream->inputSRConverter,
|
||||
ringBufferIOProc,
|
||||
&stream->inputRingBuffer,
|
||||
&size,
|
||||
(void *)&data );
|
||||
#endif /* PA_NEW_HAL */
|
||||
if( err == RING_BUFFER_EMPTY )
|
||||
{ /* the ring buffer callback underflowed */
|
||||
err = 0;
|
||||
|
|
@ -2667,27 +2574,18 @@ static OSStatus AudioIOProc( void *inRefCon,
|
|||
long f;
|
||||
|
||||
size = sizeof( data );
|
||||
#if PA_NEW_HAL
|
||||
AudioBufferList bufferList;
|
||||
bufferList.mNumberBuffers = 1;
|
||||
bufferList.mBuffers[0].mNumberChannels = chan;
|
||||
bufferList.mBuffers[0].mDataByteSize = size;
|
||||
bufferList.mBuffers[0].mData = data;
|
||||
err = AudioConverterFillComplexBuffer(
|
||||
stream->inputSRConverter,
|
||||
ringBufferIOProc,
|
||||
&stream->inputRingBuffer,
|
||||
&size,
|
||||
&bufferList,
|
||||
NULL);
|
||||
#else
|
||||
err = AudioConverterFillBuffer(
|
||||
stream->inputSRConverter,
|
||||
ringBufferIOProc,
|
||||
&stream->inputRingBuffer,
|
||||
&size,
|
||||
(void *)data );
|
||||
#endif /* PA_NEW_HAL */
|
||||
AudioBufferList bufferList;
|
||||
bufferList.mNumberBuffers = 1;
|
||||
bufferList.mBuffers[0].mNumberChannels = chan;
|
||||
bufferList.mBuffers[0].mDataByteSize = size;
|
||||
bufferList.mBuffers[0].mData = data;
|
||||
err = AudioConverterFillComplexBuffer(
|
||||
stream->inputSRConverter,
|
||||
ringBufferIOProc,
|
||||
&stream->inputRingBuffer,
|
||||
&size,
|
||||
&bufferList,
|
||||
NULL);
|
||||
if( err != RING_BUFFER_EMPTY )
|
||||
ERR( err );
|
||||
if( err != noErr && err != RING_BUFFER_EMPTY )
|
||||
|
|
@ -2695,7 +2593,6 @@ static OSStatus AudioIOProc( void *inRefCon,
|
|||
goto stop_stream;
|
||||
}
|
||||
|
||||
|
||||
f = size / ( chan * sizeof(float) );
|
||||
PaUtil_SetInputFrameCount( &(stream->bufferProcessor), f );
|
||||
if( f )
|
||||
|
|
@ -2766,7 +2663,7 @@ static PaError CloseStream( PaStream* s )
|
|||
if( stream->outputUnit ) {
|
||||
int count = removeFromXRunListenerList( stream );
|
||||
if( count == 0 )
|
||||
pa_AudioDeviceRemovePropertyListener( stream->outputDevice,
|
||||
PaMacCore_AudioDeviceRemovePropertyListener( stream->outputDevice,
|
||||
0,
|
||||
false,
|
||||
kAudioDeviceProcessorOverload,
|
||||
|
|
@ -2775,7 +2672,7 @@ static PaError CloseStream( PaStream* s )
|
|||
if( stream->inputUnit && stream->outputUnit != stream->inputUnit ) {
|
||||
int count = removeFromXRunListenerList( stream );
|
||||
if( count == 0 )
|
||||
pa_AudioDeviceRemovePropertyListener( stream->inputDevice,
|
||||
PaMacCore_AudioDeviceRemovePropertyListener( stream->inputDevice,
|
||||
0,
|
||||
true,
|
||||
kAudioDeviceProcessorOverload,
|
||||
|
|
|
|||
|
|
@ -63,32 +63,24 @@
|
|||
#include <pthread.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
OSStatus pa_AudioHardwareGetProperty(
|
||||
OSStatus PaMacCore_AudioHardwareGetProperty(
|
||||
AudioHardwarePropertyID inPropertyID,
|
||||
UInt32* ioPropertyDataSize,
|
||||
void* outPropertyData)
|
||||
{
|
||||
#if PA_NEW_HAL
|
||||
AudioObjectPropertyAddress address = { inPropertyID, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
|
||||
return AudioObjectGetPropertyData(kAudioObjectSystemObject, &address, 0, NULL, ioPropertyDataSize, outPropertyData);
|
||||
#else
|
||||
return AudioHardwareGetProperty(inPropertyID, ioPropertyDataSize, outPropertyData);
|
||||
#endif /* PA_NEW_HAL */
|
||||
}
|
||||
|
||||
OSStatus pa_AudioHardwareGetPropertySize(
|
||||
OSStatus PaMacCore_AudioHardwareGetPropertySize(
|
||||
AudioHardwarePropertyID inPropertyID,
|
||||
UInt32* outSize)
|
||||
{
|
||||
#if PA_NEW_HAL
|
||||
AudioObjectPropertyAddress address = { inPropertyID, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
|
||||
return AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &address, 0, NULL, outSize);
|
||||
#else
|
||||
return AudioHardwareGetPropertyInfo(inPropertyID, outSize, NULL);
|
||||
#endif /* PA_NEW_HAL */
|
||||
}
|
||||
|
||||
OSStatus pa_AudioDeviceGetProperty(
|
||||
OSStatus PaMacCore_AudioDeviceGetProperty(
|
||||
AudioDeviceID inDevice,
|
||||
UInt32 inChannel,
|
||||
Boolean isInput,
|
||||
|
|
@ -96,16 +88,12 @@ OSStatus pa_AudioDeviceGetProperty(
|
|||
UInt32* ioPropertyDataSize,
|
||||
void* outPropertyData)
|
||||
{
|
||||
#if PA_NEW_HAL
|
||||
AudioObjectPropertyScope scope = isInput ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput;
|
||||
AudioObjectPropertyAddress address = { inPropertyID, scope, inChannel };
|
||||
return AudioObjectGetPropertyData(inDevice, &address, 0, NULL, ioPropertyDataSize, outPropertyData);
|
||||
#else
|
||||
return AudioDeviceGetProperty(inDevice, inChannel, isInput, inPropertyID, ioPropertyDataSize, outPropertyData);
|
||||
#endif /* PA_NEW_HAL */
|
||||
}
|
||||
|
||||
OSStatus pa_AudioDeviceSetProperty(
|
||||
OSStatus PaMacCore_AudioDeviceSetProperty(
|
||||
AudioDeviceID inDevice,
|
||||
const AudioTimeStamp* inWhen,
|
||||
UInt32 inChannel,
|
||||
|
|
@ -114,78 +102,58 @@ OSStatus pa_AudioDeviceSetProperty(
|
|||
UInt32 inPropertyDataSize,
|
||||
const void* inPropertyData)
|
||||
{
|
||||
#if PA_NEW_HAL
|
||||
AudioObjectPropertyScope scope = isInput ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput;
|
||||
AudioObjectPropertyAddress address = { inPropertyID, scope, inChannel };
|
||||
return AudioObjectSetPropertyData(inDevice, &address, 0, NULL, inPropertyDataSize, inPropertyData);
|
||||
#else
|
||||
return AudioDeviceSetProperty(inDevice, inWhen, inChannel, isInput, inPropertyID, inPropertyDataSize, inPropertyData);
|
||||
#endif /* PA_NEW_HAL */
|
||||
}
|
||||
|
||||
OSStatus pa_AudioDeviceGetPropertySize(
|
||||
OSStatus PaMacCore_AudioDeviceGetPropertySize(
|
||||
AudioDeviceID inDevice,
|
||||
UInt32 inChannel,
|
||||
Boolean isInput,
|
||||
AudioDevicePropertyID inPropertyID,
|
||||
UInt32* outSize)
|
||||
{
|
||||
#if PA_NEW_HAL
|
||||
AudioObjectPropertyScope scope = isInput ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput;
|
||||
AudioObjectPropertyAddress address = { inPropertyID, scope, inChannel };
|
||||
return AudioObjectGetPropertyDataSize(inDevice, &address, 0, NULL, outSize);
|
||||
#else
|
||||
return AudioDeviceGetPropertyInfo(inDevice, inChannel, isInput, inPropertyID, outSize, NULL);
|
||||
#endif /* PA_NEW_HAL */
|
||||
}
|
||||
|
||||
OSStatus pa_AudioDeviceAddPropertyListener(
|
||||
AudioDeviceID inDevice,
|
||||
UInt32 inChannel,
|
||||
Boolean isInput,
|
||||
AudioDevicePropertyID inPropertyID,
|
||||
pa_AudioDevicePropertyListenerProc inProc,
|
||||
void* inClientData)
|
||||
OSStatus PaMacCore_AudioDeviceAddPropertyListener(
|
||||
AudioDeviceID inDevice,
|
||||
UInt32 inChannel,
|
||||
Boolean isInput,
|
||||
AudioDevicePropertyID inPropertyID,
|
||||
AudioObjectPropertyListenerProc inProc,
|
||||
void* inClientData)
|
||||
{
|
||||
#if PA_NEW_HAL
|
||||
AudioObjectPropertyScope scope = isInput ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput;
|
||||
AudioObjectPropertyAddress address = { inPropertyID, scope, inChannel };
|
||||
return AudioObjectAddPropertyListener(inDevice, &address, inProc, inClientData);
|
||||
#else
|
||||
return AudioDeviceAddPropertyListener(inDevice, inChannel, isInput, inPropertyID, inProc, inClientData);
|
||||
#endif /* PA_NEW_HAL */
|
||||
}
|
||||
|
||||
OSStatus pa_AudioDeviceRemovePropertyListener(
|
||||
AudioDeviceID inDevice,
|
||||
UInt32 inChannel,
|
||||
Boolean isInput,
|
||||
AudioDevicePropertyID inPropertyID,
|
||||
pa_AudioDevicePropertyListenerProc inProc,
|
||||
void* inClientData)
|
||||
OSStatus PaMacCore_AudioDeviceRemovePropertyListener(
|
||||
AudioDeviceID inDevice,
|
||||
UInt32 inChannel,
|
||||
Boolean isInput,
|
||||
AudioDevicePropertyID inPropertyID,
|
||||
AudioObjectPropertyListenerProc inProc,
|
||||
void* inClientData)
|
||||
{
|
||||
#if PA_NEW_HAL
|
||||
AudioObjectPropertyScope scope = isInput ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput;
|
||||
AudioObjectPropertyAddress address = { inPropertyID, scope, inChannel };
|
||||
return AudioObjectRemovePropertyListener(inDevice, &address, inProc, inClientData);
|
||||
#else
|
||||
return AudioDeviceRemovePropertyListener(inDevice, inChannel, isInput, inPropertyID, inProc);
|
||||
#endif /* PA_NEW_HAL */
|
||||
}
|
||||
|
||||
OSStatus pa_AudioStreamGetProperty(
|
||||
OSStatus PaMacCore_AudioStreamGetProperty(
|
||||
AudioStreamID inStream,
|
||||
UInt32 inChannel,
|
||||
AudioDevicePropertyID inPropertyID,
|
||||
UInt32* ioPropertyDataSize,
|
||||
void* outPropertyData)
|
||||
{
|
||||
#if PA_NEW_HAL
|
||||
AudioObjectPropertyAddress address = { inPropertyID, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
|
||||
return AudioObjectGetPropertyData(inStream, &address, 0, NULL, ioPropertyDataSize, outPropertyData);
|
||||
#else
|
||||
return AudioStreamGetProperty(inStream, inChannel, inPropertyID, ioPropertyDataSize, outPropertyData);
|
||||
#endif /* PA_NEW_HAL */
|
||||
}
|
||||
|
||||
PaError PaMacCore_SetUnixError( int err, int line )
|
||||
|
|
@ -274,14 +242,6 @@ PaError PaMacCore_SetError(OSStatus error, int line, int isError)
|
|||
case kAudioUnitErr_TooManyFramesToProcess:
|
||||
errorText = "Audio Unit: Too Many Frames";
|
||||
result = paInternalError; break;
|
||||
#if ! PA_NEW_HAL
|
||||
case kAudioUnitErr_IllegalInstrument:
|
||||
errorText = "Audio Unit: Illegal Instrument";
|
||||
result = paInternalError; break;
|
||||
case kAudioUnitErr_InstrumentTypeNotFound:
|
||||
errorText = "Audio Unit: Instrument Type Not Found";
|
||||
result = paInternalError; break;
|
||||
#endif
|
||||
case kAudioUnitErr_InvalidFile:
|
||||
errorText = "Audio Unit: Invalid File";
|
||||
result = paInternalError; break;
|
||||
|
|
@ -434,7 +394,6 @@ long computeRingBufferSize( const PaStreamParameters *inputParameters,
|
|||
* since it represents a theoretically better implementation.
|
||||
*/
|
||||
|
||||
#if PA_NEW_HAL
|
||||
OSStatus propertyProc(
|
||||
AudioObjectID inObjectID,
|
||||
UInt32 inNumberAddresses,
|
||||
|
|
@ -444,18 +403,6 @@ OSStatus propertyProc(
|
|||
// this is where we would set the condition variable
|
||||
return noErr;
|
||||
}
|
||||
#else
|
||||
OSStatus propertyProc(
|
||||
AudioDeviceID inDevice,
|
||||
UInt32 inChannel,
|
||||
Boolean isInput,
|
||||
AudioDevicePropertyID inPropertyID,
|
||||
void* inClientData )
|
||||
{
|
||||
// this is where we would set the condition variable
|
||||
return noErr;
|
||||
}
|
||||
#endif /* PA_NEW_HAL */
|
||||
|
||||
/* sets the value of the given property and waits for the change to
|
||||
be acknowledged, and returns the final value, which is not guaranteed
|
||||
|
|
@ -479,7 +426,7 @@ PaError AudioDeviceSetPropertyNowAndWaitForChange(
|
|||
UInt32 outPropertyDataSize = inPropertyDataSize;
|
||||
|
||||
/* First, see if it already has that value. If so, return. */
|
||||
macErr = pa_AudioDeviceGetProperty( inDevice, inChannel,
|
||||
macErr = PaMacCore_AudioDeviceGetProperty( inDevice, inChannel,
|
||||
isInput, inPropertyID,
|
||||
&outPropertyDataSize, outPropertyData );
|
||||
if( macErr ) {
|
||||
|
|
@ -496,7 +443,7 @@ PaError AudioDeviceSetPropertyNowAndWaitForChange(
|
|||
|
||||
/* If we were using a cond variable, we'd do something useful here,
|
||||
but for now, this is just to make 10.6 happy. */
|
||||
macErr = pa_AudioDeviceAddPropertyListener( inDevice, inChannel, isInput,
|
||||
macErr = PaMacCore_AudioDeviceAddPropertyListener( inDevice, inChannel, isInput,
|
||||
inPropertyID, propertyProc,
|
||||
NULL );
|
||||
if( macErr )
|
||||
|
|
@ -504,7 +451,7 @@ PaError AudioDeviceSetPropertyNowAndWaitForChange(
|
|||
goto failMac;
|
||||
|
||||
/* set property */
|
||||
macErr = pa_AudioDeviceSetProperty( inDevice, NULL, inChannel,
|
||||
macErr = PaMacCore_AudioDeviceSetProperty( inDevice, NULL, inChannel,
|
||||
isInput, inPropertyID,
|
||||
inPropertyDataSize, inPropertyData );
|
||||
if( macErr )
|
||||
|
|
@ -519,7 +466,7 @@ PaError AudioDeviceSetPropertyNowAndWaitForChange(
|
|||
memcpy( &tv2, &tv1, sizeof( struct timeval ) );
|
||||
while( tv2.tv_sec - tv1.tv_sec < 30 ) {
|
||||
/* now read the property back out */
|
||||
macErr = pa_AudioDeviceGetProperty( inDevice, inChannel,
|
||||
macErr = PaMacCore_AudioDeviceGetProperty( inDevice, inChannel,
|
||||
isInput, inPropertyID,
|
||||
&outPropertyDataSize, outPropertyData );
|
||||
if( macErr ) {
|
||||
|
|
@ -528,7 +475,7 @@ PaError AudioDeviceSetPropertyNowAndWaitForChange(
|
|||
}
|
||||
/* and compare... */
|
||||
if( 0==memcmp( outPropertyData, inPropertyData, outPropertyDataSize ) ) {
|
||||
pa_AudioDeviceRemovePropertyListener( inDevice, inChannel, isInput, inPropertyID, propertyProc, NULL);
|
||||
PaMacCore_AudioDeviceRemovePropertyListener( inDevice, inChannel, isInput, inPropertyID, propertyProc, NULL);
|
||||
return paNoError;
|
||||
}
|
||||
/* No match yet, so let's sleep and try again. */
|
||||
|
|
@ -537,11 +484,11 @@ PaError AudioDeviceSetPropertyNowAndWaitForChange(
|
|||
}
|
||||
DBUG( ("Timeout waiting for device setting.\n" ) );
|
||||
|
||||
pa_AudioDeviceRemovePropertyListener( inDevice, inChannel, isInput, inPropertyID, propertyProc, NULL );
|
||||
PaMacCore_AudioDeviceRemovePropertyListener( inDevice, inChannel, isInput, inPropertyID, propertyProc, NULL );
|
||||
return paNoError;
|
||||
|
||||
failMac:
|
||||
pa_AudioDeviceRemovePropertyListener( inDevice, inChannel, isInput, inPropertyID, propertyProc, NULL );
|
||||
PaMacCore_AudioDeviceRemovePropertyListener( inDevice, inChannel, isInput, inPropertyID, propertyProc, NULL );
|
||||
return ERR( macErr );
|
||||
}
|
||||
|
||||
|
|
@ -587,7 +534,7 @@ PaError setBestSampleRateForDevice( const AudioDeviceID device,
|
|||
return paInvalidSampleRate;
|
||||
|
||||
/* -- generate a list of available sample rates -- */
|
||||
err = pa_AudioDeviceGetPropertySize( device, 0, isInput,
|
||||
err = PaMacCore_AudioDeviceGetPropertySize( device, 0, isInput,
|
||||
kAudioDevicePropertyAvailableNominalSampleRates,
|
||||
&propsize );
|
||||
if( err )
|
||||
|
|
@ -595,7 +542,7 @@ PaError setBestSampleRateForDevice( const AudioDeviceID device,
|
|||
ranges = (AudioValueRange *)calloc( 1, propsize );
|
||||
if( !ranges )
|
||||
return paInsufficientMemory;
|
||||
err = pa_AudioDeviceGetProperty( device, 0, isInput,
|
||||
err = PaMacCore_AudioDeviceGetProperty( device, 0, isInput,
|
||||
kAudioDevicePropertyAvailableNominalSampleRates,
|
||||
&propsize, ranges );
|
||||
if( err )
|
||||
|
|
@ -675,10 +622,10 @@ PaError setBestFramesPerBuffer( const AudioDeviceID device,
|
|||
}
|
||||
|
||||
/* -- try and set exact FPB -- */
|
||||
err = pa_AudioDeviceSetProperty( device, NULL, 0, isInput,
|
||||
err = PaMacCore_AudioDeviceSetProperty( device, NULL, 0, isInput,
|
||||
kAudioDevicePropertyBufferFrameSize,
|
||||
propsize, &requestedFramesPerBuffer);
|
||||
err = pa_AudioDeviceGetProperty( device, 0, isInput,
|
||||
err = PaMacCore_AudioDeviceGetProperty( device, 0, isInput,
|
||||
kAudioDevicePropertyBufferFrameSize,
|
||||
&propsize, actualFramesPerBuffer);
|
||||
if( err )
|
||||
|
|
@ -693,7 +640,7 @@ PaError setBestFramesPerBuffer( const AudioDeviceID device,
|
|||
|
||||
// Clip requested value against legal range for the device.
|
||||
propsize = sizeof(AudioValueRange);
|
||||
err = pa_AudioDeviceGetProperty( device, 0, isInput,
|
||||
err = PaMacCore_AudioDeviceGetProperty( device, 0, isInput,
|
||||
kAudioDevicePropertyBufferFrameSizeRange,
|
||||
&propsize, &range );
|
||||
if( err )
|
||||
|
|
@ -711,11 +658,11 @@ PaError setBestFramesPerBuffer( const AudioDeviceID device,
|
|||
|
||||
/* --- set the buffer size (ignore errors) -- */
|
||||
propsize = sizeof( UInt32 );
|
||||
err = pa_AudioDeviceSetProperty( device, NULL, 0, isInput,
|
||||
err = PaMacCore_AudioDeviceSetProperty( device, NULL, 0, isInput,
|
||||
kAudioDevicePropertyBufferFrameSize,
|
||||
propsize, &requestedFramesPerBuffer );
|
||||
/* --- read the property to check that it was set -- */
|
||||
err = pa_AudioDeviceGetProperty( device, 0, isInput,
|
||||
err = PaMacCore_AudioDeviceGetProperty( device, 0, isInput,
|
||||
kAudioDevicePropertyBufferFrameSize,
|
||||
&propsize, actualFramesPerBuffer );
|
||||
|
||||
|
|
@ -744,7 +691,6 @@ static PaMacXRunListNode firstXRunListNode;
|
|||
static int xRunListSize;
|
||||
static pthread_mutex_t xrunMutex;
|
||||
|
||||
#if PA_NEW_HAL
|
||||
OSStatus xrunCallback(
|
||||
AudioObjectID inDevice,
|
||||
UInt32 inNumberAddresses,
|
||||
|
|
@ -756,41 +702,6 @@ OSStatus xrunCallback(
|
|||
|
||||
int ret = pthread_mutex_trylock( &xrunMutex ) ;
|
||||
|
||||
if( ret == 0 ) {
|
||||
node = node->next ; //skip the first node
|
||||
|
||||
for( ; node; node=node->next ) {
|
||||
PaMacCoreStream *stream = node->stream;
|
||||
|
||||
if( stream->state != ACTIVE )
|
||||
continue; //if the stream isn't active, we don't care if the device is dropping
|
||||
|
||||
if( isInput ) {
|
||||
if( stream->inputDevice == inDevice )
|
||||
OSAtomicOr32( paInputOverflow, &stream->xrunFlags );
|
||||
} else {
|
||||
if( stream->outputDevice == inDevice )
|
||||
OSAtomicOr32( paOutputUnderflow, &stream->xrunFlags );
|
||||
}
|
||||
}
|
||||
|
||||
pthread_mutex_unlock( &xrunMutex );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
OSStatus xrunCallback(
|
||||
AudioDeviceID inDevice,
|
||||
UInt32 inChannel,
|
||||
Boolean isInput,
|
||||
AudioDevicePropertyID inPropertyID,
|
||||
void* inClientData)
|
||||
{
|
||||
PaMacXRunListNode *node = (PaMacXRunListNode *) inClientData;
|
||||
|
||||
int ret = pthread_mutex_trylock( &xrunMutex ) ;
|
||||
|
||||
if( ret == 0 ) {
|
||||
|
||||
node = node->next ; //skip the first node
|
||||
|
|
@ -815,7 +726,6 @@ OSStatus xrunCallback(
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif /* PA_NEW_HAL */
|
||||
|
||||
int initializeXRunListenerList( void )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -111,28 +111,16 @@
|
|||
# define VVDBUG(MSG)
|
||||
#endif
|
||||
|
||||
#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5)
|
||||
#define PA_NEW_HAL 1
|
||||
#else
|
||||
#define PA_NEW_HAL 0
|
||||
#endif
|
||||
|
||||
#if PA_NEW_HAL
|
||||
typedef AudioObjectPropertyListenerProc pa_AudioDevicePropertyListenerProc;
|
||||
#else
|
||||
typedef AudioDevicePropertyListenerProc pa_AudioDevicePropertyListenerProc;
|
||||
#endif /* PA_NEW_HAL */
|
||||
|
||||
OSStatus pa_AudioHardwareGetProperty(
|
||||
OSStatus PaMacCore_AudioHardwareGetProperty(
|
||||
AudioHardwarePropertyID inPropertyID,
|
||||
UInt32* ioPropertyDataSize,
|
||||
void* outPropertyData);
|
||||
|
||||
OSStatus pa_AudioHardwareGetPropertySize(
|
||||
OSStatus PaMacCore_AudioHardwareGetPropertySize(
|
||||
AudioHardwarePropertyID inPropertyID,
|
||||
UInt32* outSize);
|
||||
|
||||
OSStatus pa_AudioDeviceGetProperty(
|
||||
OSStatus PaMacCore_AudioDeviceGetProperty(
|
||||
AudioDeviceID inDevice,
|
||||
UInt32 inChannel,
|
||||
Boolean isInput,
|
||||
|
|
@ -140,7 +128,7 @@ OSStatus pa_AudioDeviceGetProperty(
|
|||
UInt32* ioPropertyDataSize,
|
||||
void* outPropertyData);
|
||||
|
||||
OSStatus pa_AudioDeviceSetProperty(
|
||||
OSStatus PaMacCore_AudioDeviceSetProperty(
|
||||
AudioDeviceID inDevice,
|
||||
const AudioTimeStamp* inWhen,
|
||||
UInt32 inChannel,
|
||||
|
|
@ -149,30 +137,30 @@ OSStatus pa_AudioDeviceSetProperty(
|
|||
UInt32 inPropertyDataSize,
|
||||
const void* inPropertyData);
|
||||
|
||||
OSStatus pa_AudioDeviceGetPropertySize(
|
||||
OSStatus PaMacCore_AudioDeviceGetPropertySize(
|
||||
AudioDeviceID inDevice,
|
||||
UInt32 inChannel,
|
||||
Boolean isInput,
|
||||
AudioDevicePropertyID inPropertyID,
|
||||
UInt32* outSize);
|
||||
|
||||
OSStatus pa_AudioDeviceAddPropertyListener(
|
||||
AudioDeviceID inDevice,
|
||||
UInt32 inChannel,
|
||||
Boolean isInput,
|
||||
AudioDevicePropertyID inPropertyID,
|
||||
pa_AudioDevicePropertyListenerProc inProc,
|
||||
void* inClientData);
|
||||
OSStatus PaMacCore_AudioDeviceAddPropertyListener(
|
||||
AudioDeviceID inDevice,
|
||||
UInt32 inChannel,
|
||||
Boolean isInput,
|
||||
AudioDevicePropertyID inPropertyID,
|
||||
AudioObjectPropertyListenerProc inProc,
|
||||
void* inClientData);
|
||||
|
||||
OSStatus pa_AudioDeviceRemovePropertyListener(
|
||||
AudioDeviceID inDevice,
|
||||
UInt32 inChannel,
|
||||
Boolean isInput,
|
||||
AudioDevicePropertyID inPropertyID,
|
||||
pa_AudioDevicePropertyListenerProc inProc,
|
||||
void* inClientData);
|
||||
OSStatus PaMacCore_AudioDeviceRemovePropertyListener(
|
||||
AudioDeviceID inDevice,
|
||||
UInt32 inChannel,
|
||||
Boolean isInput,
|
||||
AudioDevicePropertyID inPropertyID,
|
||||
AudioObjectPropertyListenerProc inProc,
|
||||
void* inClientData);
|
||||
|
||||
OSStatus pa_AudioStreamGetProperty(
|
||||
OSStatus PaMacCore_AudioStreamGetProperty(
|
||||
AudioStreamID inStream,
|
||||
UInt32 inChannel,
|
||||
AudioDevicePropertyID inPropertyID,
|
||||
|
|
@ -207,20 +195,11 @@ long computeRingBufferSize( const PaStreamParameters *inputParameters,
|
|||
long outputFramesPerBuffer,
|
||||
double sampleRate );
|
||||
|
||||
#if PA_NEW_HAL
|
||||
OSStatus propertyProc(
|
||||
AudioObjectID inObjectID,
|
||||
UInt32 inNumberAddresses,
|
||||
const AudioObjectPropertyAddress* inAddresses,
|
||||
void* inClientData);
|
||||
#else
|
||||
OSStatus propertyProc(
|
||||
AudioDeviceID inDevice,
|
||||
UInt32 inChannel,
|
||||
Boolean isInput,
|
||||
AudioDevicePropertyID inPropertyID,
|
||||
void* inClientData );
|
||||
#endif /* PA_NEW_HAL */
|
||||
|
||||
/* sets the value of the given property and waits for the change to
|
||||
be acknowledged, and returns the final value, which is not guaranteed
|
||||
|
|
@ -270,20 +249,11 @@ PaError setBestFramesPerBuffer( const AudioDeviceID device,
|
|||
*
|
||||
*********************/
|
||||
|
||||
#if PA_NEW_HAL
|
||||
OSStatus xrunCallback(
|
||||
AudioObjectID inObjectID,
|
||||
UInt32 inNumberAddresses,
|
||||
const AudioObjectPropertyAddress* inAddresses,
|
||||
void * inClientData );
|
||||
#else
|
||||
OSStatus xrunCallback(
|
||||
AudioDeviceID inDevice,
|
||||
UInt32 inChannel,
|
||||
Boolean isInput,
|
||||
AudioDevicePropertyID inPropertyID,
|
||||
void* inClientData ) ;
|
||||
#endif /* PA_NEW_HAL */
|
||||
|
||||
/** returns zero on success or a unix style error code. */
|
||||
int initializeXRunListenerList( void );
|
||||
|
|
|
|||
Loading…
Reference in a new issue