4
* PortAudio Portable Real-Time Audio Library
5
* Macintosh Core Audio specific extensions
6
* portaudio.h should be included before this file.
8
* Copyright (c) 2005-2006 Bjorn Roche
10
* Permission is hereby granted, free of charge, to any person obtaining
11
* a copy of this software and associated documentation files
12
* (the "Software"), to deal in the Software without restriction,
13
* including without limitation the rights to use, copy, modify, merge,
14
* publish, distribute, sublicense, and/or sell copies of the Software,
15
* and to permit persons to whom the Software is furnished to do so,
16
* subject to the following conditions:
18
* The above copyright notice and this permission notice shall be
19
* included in all copies or substantial portions of the Software.
21
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
25
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
26
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31
* The text above constitutes the entire PortAudio license; however,
32
* the PortAudio community also makes the following non-binding requests:
34
* Any person wishing to distribute modifications to the Software is
35
* requested to send the modifications to the original developer so that
36
* they can be incorporated into the canonical version. It is also
37
* requested that these non-binding requests be included along with the
42
* @ingroup public_header
43
* @brief CoreAudio-specific PortAudio API extension header file.
46
#include <AudioUnit/AudioUnit.h>
47
//#include <AudioToolbox/AudioToolbox.h>
55
* A pointer to a paMacCoreStreamInfo may be passed as
56
* the hostApiSpecificStreamInfo in the PaStreamParameters struct
57
* when opening a stream or querying the format. Use NULL, for the
58
* defaults. Note that for duplex streams, flags for input and output
59
* should be the same or behaviour is undefined.
63
unsigned long size; /**size of whole structure including this header */
64
PaHostApiTypeId hostApiType; /**host API for which this data is intended */
65
unsigned long version; /**structure version */
66
unsigned long flags; /* flags to modify behaviour */
67
SInt32 const * channelMap; /* Channel map for HAL channel mapping , if not needed, use NULL;*/
68
unsigned long channelMapSize; /* Channel map size for HAL channel mapping , if not needed, use 0;*/
69
} PaMacCoreStreamInfo;
76
/* Use this function to initialize a paMacCoreStreamInfo struct
77
* using the requested flags. Note that channel mapping is turned
78
* off after a call to this function.
79
* @param data The datastructure to initialize
80
* @param flags The flags to initialize the datastructure with.
82
void PaMacCore_SetupStreamInfo( PaMacCoreStreamInfo *data, unsigned long flags );
84
/* call this after pa_SetupMacCoreStreamInfo to use channel mapping as described in notes.txt.
85
* @param data The stream info structure to assign a channel mapping to
86
* @param 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.
87
* @param channelMapSize The size of the channel map array.
89
void PaMacCore_SetupChannelMap( PaMacCoreStreamInfo *data, const SInt32 * const channelMap, unsigned long channelMapSize );
92
* Retrieve the AudioDeviceID of the input device assigned to an open stream
94
* @param s The stream to query.
96
* @return A valid AudioDeviceID, or NULL if an error occurred.
98
AudioDeviceID PaMacCore_GetStreamInputDevice( PaStream* s );
101
* Retrieve the AudioDeviceID of the output device assigned to an open stream
103
* @param s The stream to query.
105
* @return A valid AudioDeviceID, or NULL if an error occurred.
107
AudioDeviceID PaMacCore_GetStreamOutputDevice( PaStream* s );
110
* Returns a statically allocated string with the device's name
111
* for the given channel. NULL will be returned on failure.
113
* This function's implemenation is not complete!
115
* @param device The PortAudio device index.
116
* @param channel The channel number who's name is requested.
117
* @return a statically allocated string with the name of the device.
118
* Because this string is statically allocated, it must be
119
* coppied if it is to be saved and used by the user after
120
* another call to this function.
123
const char *PaMacCore_GetChannelName( int device, int channelIndex, bool input );
130
* The following flags alter the behaviour of PA on the mac platform.
131
* they can be ORed together. These should work both for opening and
135
/* Allows PortAudio to change things like the device's frame size,
136
* which allows for much lower latency, but might disrupt the device
137
* if other programs are using it, even when you are just Querying
139
#define paMacCoreChangeDeviceParameters (0x01)
141
/* In combination with the above flag,
142
* causes the stream opening to fail, unless the exact sample rates
143
* are supported by the device. */
144
#define paMacCoreFailIfConversionRequired (0x02)
146
/* These flags set the SR conversion quality, if required. The wierd ordering
147
* allows Maximum Quality to be the default.*/
148
#define paMacCoreConversionQualityMin (0x0100)
149
#define paMacCoreConversionQualityMedium (0x0200)
150
#define paMacCoreConversionQualityLow (0x0300)
151
#define paMacCoreConversionQualityHigh (0x0400)
152
#define paMacCoreConversionQualityMax (0x0000)
155
* Here are some "preset" combinations of flags (above) to get to some
156
* common configurations. THIS IS OVERKILL, but if more flags are added
160
/*This is the default setting: do as much sample rate conversion as possible
161
* and as little mucking with the device as possible. */
162
#define paMacCorePlayNice (0x00)
163
/*This setting is tuned for pro audio apps. It allows SR conversion on input
164
and output, but it tries to set the appropriate SR on the device.*/
165
#define paMacCorePro (0x01)
166
/*This is a setting to minimize CPU usage and still play nice.*/
167
#define paMacCoreMinimizeCPUButPlayNice (0x0100)
168
/*This is a setting to minimize CPU usage, even if that means interrupting the device. */
169
#define paMacCoreMinimizeCPU (0x0101)
174
#endif /* __cplusplus */
176
#endif /* PA_MAC_CORE_H */