00001 #ifndef PA_TYPES_H 00002 #define PA_TYPES_H 00003 00004 /* 00005 * Portable Audio I/O Library 00006 * integer type definitions 00007 * 00008 * Based on the Open Source API proposed by Ross Bencina 00009 * Copyright (c) 1999-2006 Ross Bencina, Phil Burk 00010 * 00011 * Permission is hereby granted, free of charge, to any person obtaining 00012 * a copy of this software and associated documentation files 00013 * (the "Software"), to deal in the Software without restriction, 00014 * including without limitation the rights to use, copy, modify, merge, 00015 * publish, distribute, sublicense, and/or sell copies of the Software, 00016 * and to permit persons to whom the Software is furnished to do so, 00017 * subject to the following conditions: 00018 * 00019 * The above copyright notice and this permission notice shall be 00020 * included in all copies or substantial portions of the Software. 00021 * 00022 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00023 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00024 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00025 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 00026 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 00027 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 00028 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00029 */ 00030 00031 /* 00032 * The text above constitutes the entire PortAudio license; however, 00033 * the PortAudio community also makes the following non-binding requests: 00034 * 00035 * Any person wishing to distribute modifications to the Software is 00036 * requested to send the modifications to the original developer so that 00037 * they can be incorporated into the canonical version. It is also 00038 * requested that these non-binding requests be included along with the 00039 * license above. 00040 */ 00041 00054 #ifndef SIZEOF_SHORT 00055 #define SIZEOF_SHORT 2 00056 #endif 00057 00058 #ifndef SIZEOF_INT 00059 #define SIZEOF_INT 4 00060 #endif 00061 00062 #ifndef SIZEOF_LONG 00063 #define SIZEOF_LONG 4 00064 #endif 00065 00066 00067 #if SIZEOF_SHORT == 2 00068 typedef signed short PaInt16; 00069 typedef unsigned short PaUint16; 00070 #elif SIZEOF_INT == 2 00071 typedef signed int PaInt16; 00072 typedef unsigned int PaUint16; 00073 #else 00074 #error pa_types.h was unable to determine which type to use for 16bit integers on the target platform 00075 #endif 00076 00077 #if SIZEOF_SHORT == 4 00078 typedef signed short PaInt32; 00079 typedef unsigned short PaUint32; 00080 #elif SIZEOF_INT == 4 00081 typedef signed int PaInt32; 00082 typedef unsigned int PaUint32; 00083 #elif SIZEOF_LONG == 4 00084 typedef signed long PaInt32; 00085 typedef unsigned long PaUint32; 00086 #else 00087 #error pa_types.h was unable to determine which type to use for 32bit integers on the target platform 00088 #endif 00089 00090 00091 /* PA_VALIDATE_TYPE_SIZES compares the size of the integer types at runtime to 00092 ensure that PortAudio was configured correctly, and raises an assertion if 00093 they don't match the expected values. <assert.h> must be included in the 00094 context in which this macro is used. 00095 */ 00096 #define PA_VALIDATE_TYPE_SIZES \ 00097 { \ 00098 assert( "PortAudio: type sizes are not correct in pa_types.h" && sizeof( PaUint16 ) == 2 ); \ 00099 assert( "PortAudio: type sizes are not correct in pa_types.h" && sizeof( PaInt16 ) == 2 ); \ 00100 assert( "PortAudio: type sizes are not correct in pa_types.h" && sizeof( PaUint32 ) == 4 ); \ 00101 assert( "PortAudio: type sizes are not correct in pa_types.h" && sizeof( PaInt32 ) == 4 ); \ 00102 } 00103 00104 00105 #endif /* PA_TYPES_H */