summaryrefslogtreecommitdiff
path: root/gr-audio-osx/src/audio_osx.h
diff options
context:
space:
mode:
authorMichael2009-10-15 10:42:02 -0400
committerMichael2009-10-15 10:42:02 -0400
commit28d1a3fab5e2ccb593df9cd3a05b3911be326d9e (patch)
treea757d9a5e363e9a08862feac123660e260a52eea /gr-audio-osx/src/audio_osx.h
parent11cb05e10b5311bbaebfc67a6358d21fcd1b948d (diff)
downloadgnuradio-28d1a3fab5e2ccb593df9cd3a05b3911be326d9e.tar.gz
gnuradio-28d1a3fab5e2ccb593df9cd3a05b3911be326d9e.tar.bz2
gnuradio-28d1a3fab5e2ccb593df9cd3a05b3911be326d9e.zip
osx 10.6 x86_64 fixes for gr-audio-osx
Diffstat (limited to 'gr-audio-osx/src/audio_osx.h')
-rw-r--r--gr-audio-osx/src/audio_osx.h52
1 files changed, 37 insertions, 15 deletions
diff --git a/gr-audio-osx/src/audio_osx.h b/gr-audio-osx/src/audio_osx.h
index c92fbcb0d..79e79e36c 100644
--- a/gr-audio-osx/src/audio_osx.h
+++ b/gr-audio-osx/src/audio_osx.h
@@ -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<OSStatus>(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 <iostream>
+#include <string.h>
-#define CheckError(err,what) \
-if (err) { \
- OSStatus error = static_cast<OSStatus>(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<OSStatus>(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<OSStatus>(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 <AvailabilityMacros.h>
+#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 */