GNU Radio 3.6.5 C++ API

audio_osx.h

Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2006 Free Software Foundation, Inc.
00004  *
00005  * This file is part of GNU Radio.
00006  *
00007  * GNU Radio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 3, or (at your option)
00010  * any later version.
00011  *
00012  * GNU Radio is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with GNU Radio; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 51 Franklin Street,
00020  * Boston, MA 02110-1301, USA.
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 #include <boost/detail/endian.hpp> //BOOST_BIG_ENDIAN
00055 #ifdef BOOST_BIG_ENDIAN
00056 #define GR_PCM_ENDIANNESS kLinearPCMFormatFlagIsBigEndian
00057 #else
00058 #define GR_PCM_ENDIANNESS 0
00059 #endif
00060 
00061 // Check the version of MacOSX being used
00062 #ifdef __APPLE_CC__
00063 #include <AvailabilityMacros.h>
00064 #ifndef MAC_OS_X_VERSION_10_6
00065 #define MAC_OS_X_VERSION_10_6 1060
00066 #endif
00067 #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
00068 #define GR_USE_OLD_AUDIO_UNIT
00069 #endif
00070 #endif
00071 
00072 #endif /* INCLUDED_AUDIO_OSX_H */