Mercurial > octave
changeset 30575:ff6e74a8f7ba
Replace assert() with error() to avoid aborts in audiorecorder.
* audiodevinfo.cc (~audioplayer, ~audiorecorder): Reword warning_with_id()
message about stopping stream for clarity.
* audiodevinfo.cc (audiorecorder::set_channels): Replace C++ assert() with call
to Octave error() function.
* audiodevinfo.cc (F__recorder_audiorecorder__, F__player_audioplayer__):
Reword error message about callback functions for clarity.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 31 Dec 2021 07:31:53 -0800 |
parents | 33f77d94b4c9 |
children | d2cd9ead4c84 |
files | libinterp/dldfcn/audiodevinfo.cc |
diffstat | 1 files changed, 8 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/dldfcn/audiodevinfo.cc Fri Dec 31 07:25:12 2021 -0800 +++ b/libinterp/dldfcn/audiodevinfo.cc Fri Dec 31 07:31:53 2021 -0800 @@ -565,8 +565,8 @@ octave_value get_userdata (void); PaStream * get_stream (void); + void play (void); void playblocking (void); - void play (void); void pause (void); void resume (void); void stop (void); @@ -886,7 +886,7 @@ if (isplaying ()) { warning_with_id ("Octave:audio-interrupt", - "interrupting playing audioplayer"); + "interrupting audioplayer during playback"); stop (); } } @@ -1558,7 +1558,7 @@ if (isrecording ()) { warning_with_id ("Octave:audio-interrupt", - "interrupting recording audiorecorder"); + "interrupting audiorecorder during recording"); stop (); } } @@ -1657,7 +1657,9 @@ void audiorecorder::set_channels (int channels_arg) { - assert (channels_arg == 1 || channels_arg == 2); + if (channels_arg != 1 && channels_arg != 2) + error ("audiorecorder: number of channels must be 1 or 2"); + channels = channels_arg; } @@ -1935,7 +1937,7 @@ || args(0).is_inline_function ()); if (is_function) - error ("audiorecorder: callbacks not yet implemented"); + error ("audiorecorder: callback functions are not yet implemented"); } if (nargin >= 3) @@ -2369,7 +2371,7 @@ || args(0).is_inline_function ()); if (is_function) - error ("audioplayer: callbacks not yet implemented"); + error ("audioplayer: callback functions are not yet implemented"); recorder->set_y (args(0)); recorder->set_fs (args(1).int_value ());