diff libinterp/dldfcn/audiodevinfo.cc @ 32191:19e4617fbc40 stable

Remove obsolete callback constructor code for @audioplayer, @audiorecorder (bug #64379) Remove ancient code for a calling form of @audioplayer, @audiorecorder constructor that is not supported by Matlab and has been commented out and unavailable in Octave for years. * audiodevinfo.cc (init_fn): Delete function. * audiodevinfo.cc (__recorder_audiorecorder__): Remove calling form with first argument a function from Texinfo focumentation. Remove input validation to check for function as first argument. Remove potential call to init_fn(). * audioplayer.m: Remove commented-out documentation for calling form with callback function. Remove input validation checking for function as first argument. Add FIXME note about incomplete input validation for this function. Remove commented-out BIST tests for this functionality. Add BIST test for existing input validation. * audiorecorder.m: Remove commented-out documentation for calling form with callback function. Remove input validation checking for function as first argument. Add FIXME note about lack of input validation for this function. Remove commented-out BIST tests for this functionality. Add BIST tests for existing input validation.
author Rik <rik@octave.org>
date Wed, 12 Jul 2023 09:18:37 -0700
parents 597f3ee61a48
children 372b73895c89
line wrap: on
line diff
--- a/libinterp/dldfcn/audiodevinfo.cc	Sat Jul 08 22:30:12 2023 -0700
+++ b/libinterp/dldfcn/audiodevinfo.cc	Wed Jul 12 09:18:37 2023 -0700
@@ -536,7 +536,6 @@
   bool print_as_scalar (void) const { return true; }
 
   void init (void);
-  void init_fn (void);
   void set_y (const octave_value& y);
   void set_y (octave_function *fcn);
   void set_y (std::string fcn);
@@ -904,36 +903,6 @@
 }
 
 void
-audioplayer::init_fn (void)
-{
-  if (Pa_Initialize () != paNoError)
-    error ("audioplayer: initialization error");
-
-  if (Pa_GetDeviceCount () < 1)
-    error ("audioplayer: no audio devices found or available");
-
-  int device = get_id ();
-
-  if (device == -1)
-    device = Pa_GetDefaultOutputDevice ();
-
-  output_parameters.device = device;
-  output_parameters.channelCount = 2;
-  output_parameters.sampleFormat = bits_to_format (get_nbits ());
-
-  const PaDeviceInfo *device_info = Pa_GetDeviceInfo (device);
-
-  if (! device_info)
-    warning_with_id ("Octave:invalid-default-audio-device",
-                     "invalid default audio device ID = %d", device);
-
-  output_parameters.suggestedLatency
-    = (device_info ? device_info->defaultHighOutputLatency : -1);
-
-  output_parameters.hostApiSpecificStreamInfo = nullptr;
-}
-
-void
 audioplayer::init (void)
 {
   // FIXME: Both of these variables are unused.
@@ -1916,7 +1885,6 @@
            doc: /* -*- texinfo -*-
 @deftypefn  {} {@var{recorder} =} __recorder_audiorecorder__ (@var{fs}, @var{nbits}, @var{channels})
 @deftypefnx {} {@var{recorder} =} __recorder_audiorecorder__ (@var{fs}, @var{nbits}, @var{channels}, @var{id})
-@deftypefnx {} {@var{recorder} =} __recorder_audiorecorder__ (@var{fcn}, @dots{})
 Undocumented internal function.
 @end deftypefn */)
 {
@@ -1928,15 +1896,6 @@
 
   audiorecorder *recorder = new audiorecorder ();
 
-  if (nargin > 0)
-    {
-      bool is_function = (args(0).is_string () || args(0).is_function_handle ()
-                          || args(0).is_inline_function ());
-
-      if (is_function)
-        error ("audiorecorder: callback functions are not yet implemented");
-    }
-
   if (nargin >= 3)
     {
       recorder->set_fs (args(0).int_value ());
@@ -2342,12 +2301,6 @@
 
   audioplayer *recorder = new audioplayer ();
 
-  bool is_function = (args(0).is_string () || args(0).is_function_handle ()
-                      || args(0).is_inline_function ());
-
-  if (is_function)
-    error ("audioplayer: callback functions are not yet implemented");
-
   recorder->set_y (args(0));
   recorder->set_fs (args(1).int_value ());
 
@@ -2371,10 +2324,7 @@
         }
     }
 
-  if (is_function)
-    recorder->init_fn ();
-  else
-    recorder->init ();
+  recorder->init ();
 
   retval = recorder;
 #else