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
 

Macros

#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)
 

Functions

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.

Definition in file pa_mac_core.h.

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.

Definition at line 154 of file pa_mac_core.h.

#define paMacCoreConversionQualityMin   (0x0100)

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

Definition at line 163 of file pa_mac_core.h.

#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.

Definition at line 159 of file pa_mac_core.h.

#define paMacCoreMinimizeCPU   (0x0101)

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

Definition at line 184 of file pa_mac_core.h.

#define paMacCoreMinimizeCPUButPlayNice   (0x0100)

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

Definition at line 182 of file pa_mac_core.h.

#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.

Definition at line 177 of file pa_mac_core.h.

#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.

Definition at line 180 of file pa_mac_core.h.

Function Documentation

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

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

Parameters
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.
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 implementation is not complete!

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

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

Parameters
sThe stream to query.
Returns
A valid AudioDeviceID, or NULL if an error occurred.
AudioDeviceID PaMacCore_GetStreamOutputDevice ( PaStream s)

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

Parameters
sThe stream to query.
Returns
A valid AudioDeviceID, or NULL if an error occurred.
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.

Parameters
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.
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.

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