changeset 21096:a1529d24beff

maint: Use gripe_disabled_feature in audiodevinfo and audioread
author Andreas Weber <andy.weber.aw@gmail.com>
date Sun, 17 Jan 2016 17:20:23 +0100
parents d6fa72047aeb
children 87b3348d8d76
files libinterp/dldfcn/audiodevinfo.cc libinterp/dldfcn/audioread.cc
diffstat 2 files changed, 120 insertions(+), 50 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/dldfcn/audiodevinfo.cc	Sat Jan 16 12:58:18 2016 +1100
+++ b/libinterp/dldfcn/audiodevinfo.cc	Sun Jan 17 17:20:23 2016 +0100
@@ -66,10 +66,6 @@
 
 #endif
 
-#define NO_PORTAUDIO_MSG \
-  error ("portaudio not found on your system and thus audio functionality is not present"); \
-  (void) args;  /* silence compiler warning "unused parameter" */
-
 DEFUN_DLD (audiodevinfo, args, ,
            "-*- texinfo -*-\n\
 @deftypefn {} {@var{devinfo} =} audiodevinfo ()\n\
@@ -410,8 +406,9 @@
   return retval;
 
 #else
-  NO_PORTAUDIO_MSG
-  (void) args;  //silence compiler warning "unused parameter"
+  gripe_disabled_feature ("audiodevinfo",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #endif
 }
 
@@ -1815,7 +1812,9 @@
   octave_value retval;
 
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__recorder_audiorecorder__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
 
   int nargin = args.length ();
@@ -1877,7 +1876,9 @@
 {
   octave_value retval;
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__recorder_getaudiodata__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   retval = get_recorder (args(0))->getaudiodata ();
 #endif
@@ -1892,7 +1893,9 @@
 {
   octave_value retval;
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__recorder_get_channels__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   retval = get_recorder (args(0))->get_channels ();
 #endif
@@ -1907,7 +1910,9 @@
 {
   octave_value retval;
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__recorder_get_fs__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   retval = get_recorder (args(0))->get_fs ();
 #endif
@@ -1922,7 +1927,9 @@
 {
   octave_value retval;
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__recorder_get_id__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   retval = get_recorder (args(0))->get_id ();
 #endif
@@ -1937,7 +1944,9 @@
 {
   octave_value retval;
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__recorder_get_nbits__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   retval = get_recorder (args(0))->get_nbits ();
 #endif
@@ -1952,7 +1961,9 @@
 {
   octave_value retval;
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__recorder_get_sample_number__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   retval = get_recorder (args(0))->get_sample_number ();
 #endif
@@ -1967,7 +1978,9 @@
 {
   octave_value retval;
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__recorder_get_tag__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   retval = get_recorder (args(0))->get_tag ();
 #endif
@@ -1982,7 +1995,9 @@
 {
   octave_value retval;
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__recorder_get_total_samples__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   retval = get_recorder (args(0))->get_total_samples ();
 #endif
@@ -1997,7 +2012,9 @@
 {
   octave_value retval;
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__recorder_get_userdata__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   retval = get_recorder (args(0))->get_userdata ();
 #endif
@@ -2012,7 +2029,9 @@
 {
   octave_value retval;
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__recorder_isrecording__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   retval = get_recorder (args(0))->isrecording ();
 #endif
@@ -2026,7 +2045,9 @@
 @end deftypefn")
 {
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__recorder_pause__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   get_recorder (args(0))->pause ();
 #endif
@@ -2040,7 +2061,9 @@
 @end deftypefn")
 {
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__recorder_recordblocking__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   float seconds = args(1).float_value ();
   get_recorder (args(0))->recordblocking (seconds);
@@ -2056,7 +2079,9 @@
 @end deftypefn")
 {
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__recorder_record__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   audiorecorder *recorder = get_recorder (args(0));
 
@@ -2075,7 +2100,9 @@
 @end deftypefn")
 {
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__recorder_resume__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   if (args.length () == 1)
     get_recorder (args(0))->resume ();
@@ -2090,7 +2117,9 @@
 @end deftypefn")
 {
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__recorder_set_fs__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   if (args.length () == 2)
     get_recorder (args(0))->set_fs (args(1).int_value ());
@@ -2105,7 +2134,9 @@
 @end deftypefn")
 {
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__recorder_set_tag__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   if (args.length () == 2)
     get_recorder (args(0))->set_tag (args(1).char_matrix_value ());
@@ -2120,7 +2151,9 @@
 @end deftypefn")
 {
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__recorder_set_userdata__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   if (args.length () == 2)
     get_recorder (args(0))->set_userdata (args(1));
@@ -2135,7 +2168,9 @@
 @end deftypefn")
 {
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__recorder_stop__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   if (args.length () == 1)
     get_recorder (args(0))->stop ();
@@ -2153,7 +2188,9 @@
 {
   octave_value retval;
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__player_audioplayer__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
 
   int nargin = args.length ();
@@ -2220,7 +2257,9 @@
 {
   octave_value retval;
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__player_get_channels__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   if (args.length () == 1)
     retval = get_player (args(0))->get_channels ();
@@ -2236,7 +2275,9 @@
 {
   octave_value retval;
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__player_get_fs__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   if (args.length () == 1)
     retval = get_player (args(0))->get_fs ();
@@ -2252,7 +2293,9 @@
 {
   octave_value retval;
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__player_get_id__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   if (args.length () == 1)
     retval = get_player (args(0))->get_id ();
@@ -2268,7 +2311,9 @@
 {
   octave_value retval;
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__player_get_nbits__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   if (args.length () == 1)
     retval = get_player (args(0))->get_nbits ();
@@ -2284,7 +2329,9 @@
 {
   octave_value retval;
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__player_get_sample_number__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   if (args.length () == 1)
     retval = get_player (args(0))->get_sample_number ();
@@ -2300,7 +2347,9 @@
 {
   octave_value retval;
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__player_get_tag__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   if (args.length () == 1)
     retval = get_player (args(0))->get_tag ();
@@ -2316,7 +2365,9 @@
 {
   octave_value retval;
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__player_get_total_samples__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   if (args.length () == 1)
     retval = get_player (args(0))->get_total_samples ();
@@ -2332,7 +2383,9 @@
 {
   octave_value retval;
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__player_get_userdata__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   if (args.length () == 1)
     retval = get_player (args(0))->get_userdata ();
@@ -2348,7 +2401,9 @@
 {
   octave_value retval;
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__player_isplaying__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   if (args.length () == 1)
     retval = get_player (args(0))->isplaying ();
@@ -2363,7 +2418,9 @@
 @end deftypefn")
 {
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__player_pause__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   if (args.length () == 1)
     get_player (args(0))->pause ();
@@ -2380,7 +2437,9 @@
 @end deftypefn")
 {
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__player_playblocking__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
 
   audioplayer *player = get_player (args(0));
@@ -2432,7 +2491,9 @@
 @end deftypefn")
 {
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__player_play__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
 
   if (args.length () == 1)
@@ -2482,7 +2543,9 @@
 @end deftypefn")
 {
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__player_resume__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   if (args.length () == 1)
     get_player (args(0))->resume ();
@@ -2497,7 +2560,9 @@
 @end deftypefn")
 {
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__player_set_fs__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   if (args.length () == 2)
     get_player (args(0))->set_fs (args(1).int_value ());
@@ -2512,7 +2577,9 @@
 @end deftypefn")
 {
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__player_set_tag__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   if (args.length () == 2)
     get_player (args(0))->set_tag (args(1).char_matrix_value ());
@@ -2527,7 +2594,9 @@
 @end deftypefn")
 {
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__player_set_userdata__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   if (args.length () == 2)
     get_player (args(0))->set_userdata (args(1));
@@ -2542,7 +2611,9 @@
 @end deftypefn")
 {
 #ifndef HAVE_PORTAUDIO
-  NO_PORTAUDIO_MSG
+  gripe_disabled_feature ("__player_stop__",
+                          "audio playback and recording through PortAudio",
+                          "Octave");
 #else
   if (args.length () == 1)
     get_player (args(0))->stop ();
--- a/libinterp/dldfcn/audioread.cc	Sat Jan 16 12:58:18 2016 +1100
+++ b/libinterp/dldfcn/audioread.cc	Sun Jan 17 17:20:23 2016 +0100
@@ -172,7 +172,8 @@
   return ovl (ret_audio, info.samplerate);
 
 #else
-  error ("sndfile not found on your system and thus audioread is not functional");
+  gripe_disabled_feature ("audioread", "reading and writing sound files"
+                          " through libsndfile", "Octave");
 #endif
 }
 
@@ -419,9 +420,8 @@
   return ovl ();
 
 #else
-
-  error ("sndfile not found on your system and thus audiowrite is not functional");
-
+  gripe_disabled_feature ("audiowrite", "reading and writing sound files"
+                          " through libsndfile", "Octave");
 #endif
 }
 
@@ -492,8 +492,7 @@
   return ovl (result);
 
 #else
-
-  error ("sndfile not found on your system and thus audioinfo is not functional");
-
+  gripe_disabled_feature ("audioinfo", "reading and writing sound files"
+                          " through libsndfile", "Octave");
 #endif
 }