annotate src/portaudio/include/pa_mac_core.h @ 94:d278df1123f9

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