X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=gr-audio-osx%2Fsrc%2Faudio_osx.h;h=79e79e36cb0edeed5f7d43183cf76a520b32db53;hb=refs%2Fheads%2Fdfsg-orig;hp=05465114ffb26b331a8e2ddf5615a28bf7b2b5f5;hpb=18a684bf3dc144c48fc4cc6cc72f5070febd8074;p=debian%2Fgnuradio diff --git a/gr-audio-osx/src/audio_osx.h b/gr-audio-osx/src/audio_osx.h index 05465114..79e79e36 100644 --- a/gr-audio-osx/src/audio_osx.h +++ b/gr-audio-osx/src/audio_osx.h @@ -6,7 +6,7 @@ * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU Radio is distributed in the hope that it will be useful, @@ -23,22 +23,33 @@ #ifndef INCLUDED_AUDIO_OSX_H #define INCLUDED_AUDIO_OSX_H -#define CheckErrorAndThrow(err,what,throw_str) \ -if (err) { \ - OSStatus error = static_cast(err); \ - fprintf (stderr, "%s\n Error# %ld ('%4s')\n %s:%d\n", \ - what, error, (char*)(&err), __FILE__, __LINE__); \ - fflush (stdout); \ - throw std::runtime_error (throw_str); \ -} +#include +#include -#define CheckError(err,what) \ -if (err) { \ - OSStatus error = static_cast(err); \ - fprintf (stderr, "%s\n Error# %ld ('%4s')\n %s:%d\n", \ - what, error, (char*)(&err), __FILE__, __LINE__); \ - fflush (stdout); \ -} +#define CheckErrorAndThrow(err,what,throw_str) \ + if (err) { \ + OSStatus error = static_cast(err); \ + char err_str[4]; \ + strncpy (err_str, (char*)(&err), 4); \ + std::cerr << what << std::endl; \ + std::cerr << " Error# " << error << " ('" << err_str \ + << "')" << std::endl; \ + std::cerr << " " << __FILE__ << ":" << __LINE__ << std::endl; \ + fflush (stderr); \ + throw std::runtime_error (throw_str); \ + } + +#define CheckError(err,what) \ + if (err) { \ + OSStatus error = static_cast(err); \ + char err_str[4]; \ + strncpy (err_str, (char*)(&err), 4); \ + std::cerr << what << std::endl; \ + std::cerr << " Error# " << error << " ('" << err_str \ + << "')" << std::endl; \ + std::cerr << " " << __FILE__ << ":" << __LINE__ << std::endl; \ + fflush (stderr); \ + } #ifdef WORDS_BIGENDIAN #define GR_PCM_ENDIANNESS kLinearPCMFormatFlagIsBigEndian @@ -46,4 +57,15 @@ if (err) { \ #define GR_PCM_ENDIANNESS 0 #endif +// Check the version of MacOSX being used +#ifdef __APPLE_CC__ +#include +#ifndef MAC_OS_X_VERSION_10_6 +#define MAC_OS_X_VERSION_10_6 1060 +#endif +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 +#define GR_USE_OLD_AUDIO_UNIT +#endif +#endif + #endif /* INCLUDED_AUDIO_OSX_H */