changeset 19560:7f271cef5850

protect all portaudio and sndfile dependent code with #ifdefs * audiodevinfo.cc: Protect all code that depends on portaudio with #ifdef HAVE_PORTAUDIO * audioread.cc: Protect all code that depends on sndfile with #ifdef HAVE_SNDFILE.
author John W. Eaton <jwe@octave.org>
date Sat, 03 Jan 2015 02:01:23 -0500
parents 18377fc879d0
children 651f12640c90
files libinterp/dldfcn/audiodevinfo.cc libinterp/dldfcn/audioread.cc
diffstat 2 files changed, 19 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/dldfcn/audiodevinfo.cc	Fri Jan 02 18:05:24 2015 -0800
+++ b/libinterp/dldfcn/audiodevinfo.cc	Sat Jan 03 02:01:23 2015 -0500
@@ -40,8 +40,8 @@
 #include "parse.h"
 
 #if defined (HAVE_PORTAUDIO)
+
 #include <portaudio.h>
-#endif
 
 PaSampleFormat
 bits_to_format (int bits)
@@ -60,6 +60,8 @@
     return 0;
 }
 
+#endif
+
 DEFUN_DLD (audiodevinfo, args, ,
   "-*- texinfo -*-\n\
 @deftypefn {Loadable Function} {@var{devinfo} =} audiodevinfo ()\n\
@@ -429,6 +431,8 @@
 %! endfor
 */
 
+#ifdef HAVE_PORTAUDIO
+
 enum audio_type { INT8, UINT8, INT16, DOUBLE };
 
 class audioplayer : public octave_base_value
@@ -1638,6 +1642,8 @@
   return stream;
 }
 
+#endif
+
 DEFUN_DLD (__recorder_audiorecorder__, args, ,
   "-*- texinfo -*-\n\
 @deftypefn  {Loadable Function} {@var{recorder} =} __recorder_audiorecorder__ (@var{fs}, @var{nbits}, @var{channels})\n\
@@ -1696,6 +1702,8 @@
   return retval;
 }
 
+#ifdef HAVE_PORTAUDIO
+
 static audiorecorder *
 get_recorder (const octave_value& ov)
 {
@@ -1706,6 +1714,8 @@
   return dynamic_cast<audiorecorder *> (ncrep);
 }
 
+#endif
+
 DEFUN_DLD (__recorder_getaudiodata__, args, ,
   "-*- texinfo -*-\n\
 @deftypefn {Loadable Function} {@var{data}} __recorder_getaudiodata__ (@var{recorder})\n\
@@ -2206,6 +2216,8 @@
   return retval;
 }
 
+#ifdef HAVE_PORTAUDIO
+
 static audioplayer *
 get_player (const octave_value& ov)
 {
@@ -2216,6 +2228,8 @@
   return dynamic_cast<audioplayer *> (ncrep);
 }
 
+#endif
+
 DEFUN_DLD (__player_get_channels__, args, ,
   "-*- texinfo -*-\n\
 @deftypefn {Loadable Function} {@var{n} =} __player_get_channels__ (@var{player})\n\
--- a/libinterp/dldfcn/audioread.cc	Fri Jan 02 18:05:24 2015 -0800
+++ b/libinterp/dldfcn/audioread.cc	Sat Jan 03 02:01:23 2015 -0500
@@ -153,6 +153,7 @@
 }
 
 #ifdef HAVE_SNDFILE
+
 static void
 fill_extension_table (std::map<std::string, int> &table)
 {
@@ -182,6 +183,7 @@
   table["mpc2k"] = SF_FORMAT_MPC2K;
   table["rf64"] = SF_FORMAT_RF64;
 }
+
 #endif
 
 DEFUN_DLD (audiowrite, args, ,
@@ -337,14 +339,14 @@
 {
   octave_value retval;
 
+#ifdef HAVE_SNDFILE
+
   if (args.length () != 1)
     {
       print_usage ();
       return retval;
     }
 
-#ifdef HAVE_SNDFILE
-
   SF_INFO info;
   info.format = 0;
   SNDFILE *file = sf_open (args(0).string_value ().c_str (), SFM_READ, &info);