00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef INCLUDED_AUDIO_OSX_H
00024 #define INCLUDED_AUDIO_OSX_H
00025
00026 #include <iostream>
00027 #include <string.h>
00028
00029 #define CheckErrorAndThrow(err,what,throw_str) \
00030 if (err) { \
00031 OSStatus error = static_cast<OSStatus>(err); \
00032 char err_str[4]; \
00033 strncpy (err_str, (char*)(&err), 4); \
00034 std::cerr << what << std::endl; \
00035 std::cerr << " Error# " << error << " ('" << err_str \
00036 << "')" << std::endl; \
00037 std::cerr << " " << __FILE__ << ":" << __LINE__ << std::endl; \
00038 fflush (stderr); \
00039 throw std::runtime_error (throw_str); \
00040 }
00041
00042 #define CheckError(err,what) \
00043 if (err) { \
00044 OSStatus error = static_cast<OSStatus>(err); \
00045 char err_str[4]; \
00046 strncpy (err_str, (char*)(&err), 4); \
00047 std::cerr << what << std::endl; \
00048 std::cerr << " Error# " << error << " ('" << err_str \
00049 << "')" << std::endl; \
00050 std::cerr << " " << __FILE__ << ":" << __LINE__ << std::endl; \
00051 fflush (stderr); \
00052 }
00053
00054 #ifdef WORDS_BIGENDIAN
00055 #define GR_PCM_ENDIANNESS kLinearPCMFormatFlagIsBigEndian
00056 #else
00057 #define GR_PCM_ENDIANNESS 0
00058 #endif
00059
00060
00061 #ifdef __APPLE_CC__
00062 #include <AvailabilityMacros.h>
00063 #ifndef MAC_OS_X_VERSION_10_6
00064 #define MAC_OS_X_VERSION_10_6 1060
00065 #endif
00066 #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
00067 #define GR_USE_OLD_AUDIO_UNIT
00068 #endif
00069 #endif
00070
00071 #endif