00001 /* 00002 * PortAudio Portable Real-Time Audio Library 00003 * Macintosh Core Audio specific extensions 00004 * portaudio.h should be included before this file. 00005 * 00006 * Copyright (c) 2005-2006 Bjorn Roche 00007 * 00008 * Permission is hereby granted, free of charge, to any person obtaining 00009 * a copy of this software and associated documentation files 00010 * (the "Software"), to deal in the Software without restriction, 00011 * including without limitation the rights to use, copy, modify, merge, 00012 * publish, distribute, sublicense, and/or sell copies of the Software, 00013 * and to permit persons to whom the Software is furnished to do so, 00014 * subject to the following conditions: 00015 * 00016 * The above copyright notice and this permission notice shall be 00017 * included in all copies or substantial portions of the Software. 00018 * 00019 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00020 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00021 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00022 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 00023 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 00024 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 00025 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00026 */ 00027 00028 /* 00029 * The text above constitutes the entire PortAudio license; however, 00030 * the PortAudio community also makes the following non-binding requests: 00031 * 00032 * Any person wishing to distribute modifications to the Software is 00033 * requested to send the modifications to the original developer so that 00034 * they can be incorporated into the canonical version. It is also 00035 * requested that these non-binding requests be included along with the 00036 * license above. 00037 */ 00038 00039 #ifdef __cplusplus 00040 extern "C" { 00041 #endif 00042 00043 00044 /* 00045 * A pointer to a paMacCoreStreamInfo may be passed as 00046 * the hostApiSpecificStreamInfo in the PaStreamParameters struct 00047 * when opening a stream or querying the format. Use NULL, for the 00048 * defaults. Note that for duplex streams, both infos should be the 00049 * same or behaviour is undefined. 00050 */ 00051 typedef struct paMacCoreStreamInfo 00052 { 00053 unsigned long size; 00054 PaHostApiTypeId hostApiType; 00055 unsigned long version; 00056 unsigned long flags; /* flags to modify behaviour */ 00057 } paMacCoreStreamInfo; 00058 00059 /* Use this function to initialize a paMacCoreStreamInfo struct 00060 using the requested flags. */ 00061 void paSetupMacCoreStreamInfo( paMacCoreStreamInfo *data, unsigned long flags ) 00062 { 00063 bzero( data, sizeof( paMacCoreStreamInfo ) ); 00064 data->size = sizeof( paMacCoreStreamInfo ); 00065 data->hostApiType = paCoreAudio; 00066 data->version = 0x01; 00067 data->flags = flags; 00068 } 00069 00070 /* 00071 * The following flags alter the behaviour of PA on the mac platform. 00072 * they can be ORed together. These should work both for opening and 00073 * checking a device. 00074 */ 00075 /* Allows PortAudio to change things like the device's frame size, 00076 * which allows for much lower latency, but might disrupt the device 00077 * if other programs are using it, even when you are just Querying 00078 * the device. */ 00079 const unsigned long paMacCore_ChangeDeviceParameters = 0x01; 00080 00081 /* In combination with the above flag, 00082 * causes the stream opening to fail, unless the exact sample rates 00083 * are supported by the device. */ 00084 const unsigned long paMacCore_FailIfConversionRequired = 0x02; 00085 00086 /* These flags set the SR conversion quality, if required. The wierd ordering 00087 * allows Maximum Quality to be the default.*/ 00088 const unsigned long paMacCore_ConversionQualityMin = 0x0100; 00089 const unsigned long paMacCore_ConversionQualityMedium = 0x0200; 00090 const unsigned long paMacCore_ConversionQualityLow = 0x0300; 00091 const unsigned long paMacCore_ConversionQualityHigh = 0x0400; 00092 const unsigned long paMacCore_ConversionQualityMax = 0x0000; 00093 00094 /* 00095 * Here are some "preset" combinations of flags (above) to get to some 00096 * common configurations. THIS IS OVERKILL, but if more flags are added 00097 * it won't be. 00098 */ 00099 /*This is the default setting: do as much sample rate conversion as possible 00100 * and as little mucking with the device as possible. */ 00101 const unsigned long paMacCorePlayNice = 0x00; 00102 /*This setting is tuned for pro audio apps. It allows SR conversion on input 00103 and output, but it tries to set the appropriate SR on the device.*/ 00104 const unsigned long paMacCorePro = 0x01; 00105 /*This is a setting to minimize CPU usage and still play nice.*/ 00106 const unsigned long paMacCoreMinimizeCPUButPlayNice = 0x0100; 00107 /*This is a setting to minimize CPU usage, even if that means interrupting the device. */ 00108 const unsigned long paMacCoreMinimizeCPU = 0x0101; 00109 00110 00111 #ifdef __cplusplus 00112 } 00113 #endif /* __cplusplus */