PortAudio 2.0
pa_mac_core_utilities.h File Reference
#include <pthread.h>
#include "portaudio.h"
#include "pa_util.h"
#include <AudioUnit/AudioUnit.h>
#include <AudioToolbox/AudioToolbox.h>

Go to the source code of this file.

Macros

#define MIN(a, b)
 
#define MAX(a, b)
 
#define ERR(mac_error)
 
#define WARNING(mac_error)
 
#define INPUT_ELEMENT   (1)
 
#define OUTPUT_ELEMENT   (0)
 
#define MAC_CORE_DEBUG
 
#define DBUG(MSG)
 
#define VDBUG(MSG)
 
#define VVDBUG(MSG)
 
#define UNIX_ERR(err)
 

Functions

OSStatus PaMacCore_AudioHardwareGetProperty (AudioHardwarePropertyID inPropertyID, UInt32 *ioPropertyDataSize, void *outPropertyData)
 
OSStatus PaMacCore_AudioHardwareGetPropertySize (AudioHardwarePropertyID inPropertyID, UInt32 *outSize)
 
OSStatus PaMacCore_AudioDeviceGetProperty (AudioDeviceID inDevice, UInt32 inChannel, Boolean isInput, AudioDevicePropertyID inPropertyID, UInt32 *ioPropertyDataSize, void *outPropertyData)
 
OSStatus PaMacCore_AudioDeviceSetProperty (AudioDeviceID inDevice, const AudioTimeStamp *inWhen, UInt32 inChannel, Boolean isInput, AudioDevicePropertyID inPropertyID, UInt32 inPropertyDataSize, const void *inPropertyData)
 
OSStatus PaMacCore_AudioDeviceGetPropertySize (AudioDeviceID inDevice, UInt32 inChannel, Boolean isInput, AudioDevicePropertyID inPropertyID, UInt32 *outSize)
 
OSStatus PaMacCore_AudioDeviceAddPropertyListener (AudioDeviceID inDevice, UInt32 inChannel, Boolean isInput, AudioDevicePropertyID inPropertyID, AudioObjectPropertyListenerProc inProc, void *inClientData)
 
OSStatus PaMacCore_AudioDeviceRemovePropertyListener (AudioDeviceID inDevice, UInt32 inChannel, Boolean isInput, AudioDevicePropertyID inPropertyID, AudioObjectPropertyListenerProc inProc, void *inClientData)
 
OSStatus PaMacCore_AudioStreamGetProperty (AudioStreamID inStream, UInt32 inChannel, AudioDevicePropertyID inPropertyID, UInt32 *ioPropertyDataSize, void *outPropertyData)
 
PaError PaMacCore_SetUnixError (int err, int line)
 
PaError PaMacCore_SetError (OSStatus error, int line, int isError)
 
long computeRingBufferSize (const PaStreamParameters *inputParameters, const PaStreamParameters *outputParameters, long inputFramesPerBuffer, long outputFramesPerBuffer, double sampleRate)
 
OSStatus propertyProc (AudioObjectID inObjectID, UInt32 inNumberAddresses, const AudioObjectPropertyAddress *inAddresses, void *inClientData)
 
PaError AudioDeviceSetPropertyNowAndWaitForChange (AudioDeviceID inDevice, UInt32 inChannel, Boolean isInput, AudioDevicePropertyID inPropertyID, UInt32 inPropertyDataSize, const void *inPropertyData, void *outPropertyData)
 
PaError setBestSampleRateForDevice (const AudioDeviceID device, const bool isOutput, const bool requireExact, const Float64 desiredSrate)
 
PaError setBestFramesPerBuffer (const AudioDeviceID device, const bool isOutput, UInt32 requestedFramesPerBuffer, UInt32 *actualFramesPerBuffer)
 
OSStatus xrunCallback (AudioObjectID inObjectID, UInt32 inNumberAddresses, const AudioObjectPropertyAddress *inAddresses, void *inClientData)
 
int initializeXRunListenerList (void)
 
int destroyXRunListenerList (void)
 
void * addToXRunListenerList (void *stream)
 
int removeFromXRunListenerList (void *stream)
 

Macro Definition Documentation

◆ DBUG

#define DBUG ( MSG)
Value:
do { printf("||PaMacCore (AUHAL)|| "); printf MSG ; fflush(stdout); } while(0)

Referenced by AudioDeviceSetPropertyNowAndWaitForChange(), PaMacCore_SetError(), and PaMacCore_SetUnixError().

◆ ERR

#define ERR ( mac_error)
Value:
PaMacCore_SetError(mac_error, __LINE__, 1 )
PaError PaMacCore_SetError(OSStatus error, int line, int isError)
Definition pa_mac_core_utilities.c:188

Referenced by AudioDeviceSetPropertyNowAndWaitForChange(), setBestFramesPerBuffer(), and setBestSampleRateForDevice().

◆ INPUT_ELEMENT

#define INPUT_ELEMENT   (1)

◆ MAC_CORE_DEBUG

#define MAC_CORE_DEBUG

◆ MAX

#define MAX ( a,
b )
Value:
(((a)<(b))?(b):(a))

Referenced by computeRingBufferSize().

◆ MIN

#define MIN ( a,
b )
Value:
(((a)<(b))?(a):(b))

Referenced by ReadStream(), and WriteStream().

◆ OUTPUT_ELEMENT

#define OUTPUT_ELEMENT   (0)

◆ UNIX_ERR

#define UNIX_ERR ( err)
Value:
PaMacCore_SetUnixError( err, __LINE__ )
PaError PaMacCore_SetUnixError(int err, int line)
Definition pa_mac_core_utilities.c:159

Referenced by destroyBlioRingBuffers(), initializeBlioRingBuffers(), PaMacCore_Initialize(), ReadStream(), and WriteStream().

◆ VDBUG

◆ VVDBUG

◆ WARNING

#define WARNING ( mac_error)
Value:
PaMacCore_SetError(mac_error, __LINE__, 0 )

Referenced by PaMacCore_GetBufferSizeRange().

Function Documentation

◆ addToXRunListenerList()

void * addToXRunListenerList ( void * stream)

Returns the list, so that it can be passed to CorAudio.

References PaMacXRunListNode_s::next, and PaMacXRunListNode_s::stream.

◆ AudioDeviceSetPropertyNowAndWaitForChange()

PaError AudioDeviceSetPropertyNowAndWaitForChange ( AudioDeviceID inDevice,
UInt32 inChannel,
Boolean isInput,
AudioDevicePropertyID inPropertyID,
UInt32 inPropertyDataSize,
const void * inPropertyData,
void * outPropertyData )

◆ computeRingBufferSize()

long computeRingBufferSize ( const PaStreamParameters * inputParameters,
const PaStreamParameters * outputParameters,
long inputFramesPerBuffer,
long outputFramesPerBuffer,
double sampleRate )

◆ destroyXRunListenerList()

int destroyXRunListenerList ( void )

returns zero on success or a unix style error code.

References PaMacXRunListNode_s::next.

◆ initializeXRunListenerList()

int initializeXRunListenerList ( void )

returns zero on success or a unix style error code.

Referenced by PaMacCore_Initialize().

◆ PaMacCore_AudioDeviceAddPropertyListener()

OSStatus PaMacCore_AudioDeviceAddPropertyListener ( AudioDeviceID inDevice,
UInt32 inChannel,
Boolean isInput,
AudioDevicePropertyID inPropertyID,
AudioObjectPropertyListenerProc inProc,
void * inClientData )

◆ PaMacCore_AudioDeviceGetProperty()

OSStatus PaMacCore_AudioDeviceGetProperty ( AudioDeviceID inDevice,
UInt32 inChannel,
Boolean isInput,
AudioDevicePropertyID inPropertyID,
UInt32 * ioPropertyDataSize,
void * outPropertyData )

◆ PaMacCore_AudioDeviceGetPropertySize()

OSStatus PaMacCore_AudioDeviceGetPropertySize ( AudioDeviceID inDevice,
UInt32 inChannel,
Boolean isInput,
AudioDevicePropertyID inPropertyID,
UInt32 * outSize )

◆ PaMacCore_AudioDeviceRemovePropertyListener()

OSStatus PaMacCore_AudioDeviceRemovePropertyListener ( AudioDeviceID inDevice,
UInt32 inChannel,
Boolean isInput,
AudioDevicePropertyID inPropertyID,
AudioObjectPropertyListenerProc inProc,
void * inClientData )

◆ PaMacCore_AudioDeviceSetProperty()

OSStatus PaMacCore_AudioDeviceSetProperty ( AudioDeviceID inDevice,
const AudioTimeStamp * inWhen,
UInt32 inChannel,
Boolean isInput,
AudioDevicePropertyID inPropertyID,
UInt32 inPropertyDataSize,
const void * inPropertyData )

◆ PaMacCore_AudioHardwareGetProperty()

OSStatus PaMacCore_AudioHardwareGetProperty ( AudioHardwarePropertyID inPropertyID,
UInt32 * ioPropertyDataSize,
void * outPropertyData )

◆ PaMacCore_AudioHardwareGetPropertySize()

OSStatus PaMacCore_AudioHardwareGetPropertySize ( AudioHardwarePropertyID inPropertyID,
UInt32 * outSize )

◆ PaMacCore_AudioStreamGetProperty()

OSStatus PaMacCore_AudioStreamGetProperty ( AudioStreamID inStream,
UInt32 inChannel,
AudioDevicePropertyID inPropertyID,
UInt32 * ioPropertyDataSize,
void * outPropertyData )

◆ PaMacCore_SetError()

◆ PaMacCore_SetUnixError()

PaError PaMacCore_SetUnixError ( int err,
int line )

Map Unix error to PaError. Pretty much the only one that maps is ENOMEM.

References DBUG, paCoreAudio, paInsufficientMemory, paInternalError, paNoError, and PaUtil_SetLastHostErrorInfo().

Referenced by initializeBlioRingBuffers().

◆ propertyProc()

OSStatus propertyProc ( AudioObjectID inObjectID,
UInt32 inNumberAddresses,
const AudioObjectPropertyAddress * inAddresses,
void * inClientData )

◆ removeFromXRunListenerList()

int removeFromXRunListenerList ( void * stream)

Returns the number of Listeners in the list remaining.

References PaMacXRunListNode_s::next, and PaMacXRunListNode_s::stream.

◆ setBestFramesPerBuffer()

PaError setBestFramesPerBuffer ( const AudioDeviceID device,
const bool isOutput,
UInt32 requestedFramesPerBuffer,
UInt32 * actualFramesPerBuffer )

◆ setBestSampleRateForDevice()

PaError setBestSampleRateForDevice ( const AudioDeviceID device,
const bool isOutput,
const bool requireExact,
const Float64 desiredSrate )

◆ xrunCallback()

OSStatus xrunCallback ( AudioObjectID inObjectID,
UInt32 inNumberAddresses,
const AudioObjectPropertyAddress * inAddresses,
void * inClientData )