PortAudio  2.0
Data Structures | Macros | Functions

CoreAudio-specific PortAudio API extension header file. More...

#include "portaudio.h"
#include <AudioUnit/AudioUnit.h>
#include <AudioToolbox/AudioToolbox.h>

Go to the source code of this file.

Data Structures

struct  PaMacCoreStreamInfo


#define paMacCoreChangeDeviceParameters   (0x01)
#define paMacCoreFailIfConversionRequired   (0x02)
#define paMacCoreConversionQualityMin   (0x0100)
#define paMacCoreConversionQualityMedium   (0x0200)
#define paMacCoreConversionQualityLow   (0x0300)
#define paMacCoreConversionQualityHigh   (0x0400)
#define paMacCoreConversionQualityMax   (0x0000)
#define paMacCorePlayNice   (0x00)
#define paMacCorePro   (0x01)
#define paMacCoreMinimizeCPUButPlayNice   (0x0100)
#define paMacCoreMinimizeCPU   (0x0101)


void PaMacCore_SetupStreamInfo (PaMacCoreStreamInfo *data, unsigned long flags)
void PaMacCore_SetupChannelMap (PaMacCoreStreamInfo *data, const SInt32 *const channelMap, unsigned long channelMapSize)
AudioDeviceID PaMacCore_GetStreamInputDevice (PaStream *s)
AudioDeviceID PaMacCore_GetStreamOutputDevice (PaStream *s)
const char * PaMacCore_GetChannelName (int device, int channelIndex, bool input)
PaError PaMacCore_GetBufferSizeRange (PaDeviceIndex device, long *minBufferSizeFrames, long *maxBufferSizeFrames)

Detailed Description

CoreAudio-specific PortAudio API extension header file.

Macro Definition Documentation

#define paMacCoreChangeDeviceParameters   (0x01)

Flags The following flags alter the behaviour of PA on the mac platform. they can be ORed together. These should work both for opening and checking a device. Allows PortAudio to change things like the device's frame size, which allows for much lower latency, but might disrupt the device if other programs are using it, even when you are just Querying the device.

#define paMacCoreConversionQualityHigh   (0x0400)
#define paMacCoreConversionQualityLow   (0x0300)
#define paMacCoreConversionQualityMax   (0x0000)
#define paMacCoreConversionQualityMedium   (0x0200)
#define paMacCoreConversionQualityMin   (0x0100)

These flags set the SR conversion quality, if required. The wierd ordering allows Maximum Quality to be the default.

#define paMacCoreFailIfConversionRequired   (0x02)

In combination with the above flag, causes the stream opening to fail, unless the exact sample rates are supported by the device.

#define paMacCoreMinimizeCPU   (0x0101)

This is a setting to minimize CPU usage, even if that means interrupting the device.

#define paMacCoreMinimizeCPUButPlayNice   (0x0100)

This is a setting to minimize CPU usage and still play nice.

#define paMacCorePlayNice   (0x00)

Here are some "preset" combinations of flags (above) to get to some common configurations. THIS IS OVERKILL, but if more flags are added it won't be.This is the default setting: do as much sample rate conversion as possible and as little mucking with the device as possible.

#define paMacCorePro   (0x01)

This setting is tuned for pro audio apps. It allows SR conversion on input and output, but it tries to set the appropriate SR on the device.

Function Documentation

PaError PaMacCore_GetBufferSizeRange ( PaDeviceIndex  device,
long *  minBufferSizeFrames,
long *  maxBufferSizeFrames 

Retrieve the range of legal native buffer sizes for the specificed device, in sample frames.

deviceThe global index of the PortAudio device about which the query is being made.
minBufferSizeFramesA pointer to the location which will receive the minimum buffer size value.
maxBufferSizeFramesA pointer to the location which will receive the maximum buffer size value.
See Also
kAudioDevicePropertyBufferFrameSizeRange in the CoreAudio SDK.

References PaUtilHostApiRepresentation::deviceInfos, PaMacAUHAL::devIds, PaMacAUHAL::inheritedHostApiRep, PaDeviceInfo::maxOutputChannels, paCoreAudio, paNoError, PaUtil_DeviceIndexToHostApiDeviceIndex(), PaUtil_GetHostApiRepresentation(), and WARNING.

const char* PaMacCore_GetChannelName ( int  device,
int  channelIndex,
bool  input 

Returns a statically allocated string with the device's name for the given channel. NULL will be returned on failure.

This function's implemenation is not complete!

deviceThe PortAudio device index.
channelThe channel number who's name is requested.
a statically allocated string with the name of the device. Because this string is statically allocated, it must be coppied if it is to be saved and used by the user after another call to this function.

References PaUtilHostApiRepresentation::deviceInfos, PaMacAUHAL::devIds, PaDeviceInfo::name, paCoreAudio, paNoError, and PaUtil_GetHostApiRepresentation().

AudioDeviceID PaMacCore_GetStreamInputDevice ( PaStream s)

Retrieve the AudioDeviceID of the input device assigned to an open stream

sThe stream to query.
A valid AudioDeviceID, or NULL if an error occurred.

References PaMacCoreStream::inputDevice, and VVDBUG.

AudioDeviceID PaMacCore_GetStreamOutputDevice ( PaStream s)

Retrieve the AudioDeviceID of the output device assigned to an open stream

sThe stream to query.
A valid AudioDeviceID, or NULL if an error occurred.

References PaMacCoreStream::outputDevice, and VVDBUG.

void PaMacCore_SetupChannelMap ( PaMacCoreStreamInfo data,
const SInt32 *const  channelMap,
unsigned long  channelMapSize 

call this after pa_SetupMacCoreStreamInfo to use channel mapping as described in notes.txt.

dataThe stream info structure to assign a channel mapping to
channelMapThe channel map array, as described in notes.txt. This array pointer will be used directly (ie the underlying data will not be copied), so the caller should not free the array until after the stream has been opened.
channelMapSizeThe size of the channel map array.

References PaMacCoreStreamInfo::channelMap, and PaMacCoreStreamInfo::channelMapSize.

void PaMacCore_SetupStreamInfo ( PaMacCoreStreamInfo data,
unsigned long  flags 

Functions Use this function to initialize a paMacCoreStreamInfo struct using the requested flags. Note that channel mapping is turned off after a call to this function.

dataThe datastructure to initialize
flagsThe flags to initialize the datastructure with.

References PaMacCoreStreamInfo::channelMap, PaMacCoreStreamInfo::channelMapSize, PaMacCoreStreamInfo::flags, PaMacCoreStreamInfo::hostApiType, paCoreAudio, PaMacCoreStreamInfo::size, and PaMacCoreStreamInfo::version.