PortAudio 2.0

Data Structures | Macros | Functions
pa_mac_core.h File Reference
Public API definitions for users of PortAudio

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

## ◆ paMacCoreChangeDeviceParameters

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

## ◆ paMacCoreConversionQualityHigh

#define paMacCoreConversionQualityHigh (0x0400)

Definition at line 166 of file pa_mac_core.h.

## ◆ paMacCoreConversionQualityLow

#define paMacCoreConversionQualityLow (0x0300)

Definition at line 165 of file pa_mac_core.h.

## ◆ paMacCoreConversionQualityMax

#define paMacCoreConversionQualityMax (0x0000)

Definition at line 167 of file pa_mac_core.h.

## ◆ paMacCoreConversionQualityMedium

#define paMacCoreConversionQualityMedium (0x0200)

Definition at line 164 of file pa_mac_core.h.

## ◆ paMacCoreConversionQualityMin

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

## ◆ paMacCoreFailIfConversionRequired

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

## ◆ paMacCoreMinimizeCPU

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

## ◆ paMacCoreMinimizeCPUButPlayNice

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

## ◆ paMacCorePlayNice

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

## ◆ paMacCorePro

#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

## ◆ PaMacCore_GetBufferSizeRange()

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

  device | The global index of the PortAudio device about which the query is being made.
  minBufferSizeFrames | A pointer to the location which will receive the minimum buffer size value.
  maxBufferSizeFrames | A pointer to the location which will receive the maximum buffer size value.

See also
  kAudioDevicePropertyBufferFrameSizeRange in the CoreAudio SDK.

## ◆ PaMacCore_GetChannelName()

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

  device | The PortAudio device index.
  channel | The 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.

## ◆ PaMacCore_GetStreamInputDevice()

AudioDeviceID PaMacCore_GetStreamInputDevice | ( | PaStream * | s | ) |

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

Parameters

  s | The stream to query.

Returns
  A valid AudioDeviceID, or NULL if an error occurred.

## ◆ PaMacCore_GetStreamOutputDevice()

AudioDeviceID PaMacCore_GetStreamOutputDevice | ( | PaStream * | s | ) |

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

Parameters

  s | The stream to query.

Returns
  A valid AudioDeviceID, or NULL if an error occurred.

## ◆ PaMacCore_SetupChannelMap()

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

  data | The stream info structure to assign a channel mapping to
  channelMap | The 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.
  channelMapSize | The size of the channel map array.

## ◆ PaMacCore_SetupStreamInfo()

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

  data | The datastructure to initialize
  flags | The flags to initialize the datastructure with.