changeset 19702:b2fe4dbe5266

Don't play or record audio during 'make check' * @audioplayer/audioplayer.m, @audiorecorder/audiorecorder.m: Convert %!test blocks that play and record audio into %!demo blocks. Keep %!tests that can validate properties without playing or recording.
author Mike Miller <mtmiller@ieee.org>
date Sat, 07 Feb 2015 10:47:25 -0500
parents 4b1a43786489
children 2099e00b1833
files scripts/audio/@audioplayer/audioplayer.m scripts/audio/@audiorecorder/audiorecorder.m
diffstat 2 files changed, 30 insertions(+), 55 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/audio/@audioplayer/audioplayer.m	Sat Feb 07 10:13:25 2015 -0500
+++ b/scripts/audio/@audioplayer/audioplayer.m	Sat Feb 07 10:47:25 2015 -0500
@@ -107,6 +107,20 @@
 
 endfunction
 
+%!demo
+%! fs = 44100;
+%! audio = randn (2, 2*fs) - 0.5;
+%! player = audioplayer (audio, fs);
+%! play (player);
+%! sleep (1);
+%! pause (player);
+%! sleep (1);
+%! resume (player);
+%! sleep (1);
+%! stop (player);
+
+## Tests of audioplayer must not actually play anything.
+
 %!testif HAVE_PORTAUDIO
 %! mono = randn (1, 44100) - 0.5;
 %! stereo = randn (2, 44100) - 0.5;
@@ -119,36 +133,6 @@
 %! assert (player2.SampleRate, 44100);
 %! assert (player1.TotalSamples, 44100);
 %! assert (player2.TotalSamples, 44100);
-%! playblocking (player1);
-%! playblocking (player2);
-
-%!testif HAVE_PORTAUDIO
-%! audio = randn (2, 88200) - 0.5;
-%! fs = 44100;
-%! player = audioplayer (audio, fs);
-%! assert (!isplaying (player));
-%! play (player);
-%! assert (isplaying (player));
-%! sleep (1);
-%! pause (player);
-%! assert (!isplaying (player));
-%! sleep (1);
-%! resume (player);
-%! assert (isplaying (player));
-%! sleep (1);
-
-%!testif HAVE_PORTAUDIO
-%! audio = randn (2, 88200) - 0.5;
-%! fs = 44100;
-%! player = audioplayer (audio, fs);
-%! assert (!isplaying (player));
-%! play (player);
-%! assert (isplaying (player));
-%! sleep (1);
-%! stop (player);
-%! sleep (1);
-%! assert (!isplaying (player));
-%! assert (player.CurrentSample, 0);
 
 %!testif HAVE_PORTAUDIO
 %! audio = randn (2, 44100) - 0.5;
--- a/scripts/audio/@audiorecorder/audiorecorder.m	Sat Feb 07 10:13:25 2015 -0500
+++ b/scripts/audio/@audiorecorder/audiorecorder.m	Sat Feb 07 10:47:25 2015 -0500
@@ -51,29 +51,7 @@
 
 endfunction
 
-%!testif HAVE_PORTAUDIO
-%! recorder = audiorecorder (44100, 16, 2);
-%! recordblocking (recorder, 1);
-%! data = getaudiodata (recorder, "int16");
-%! assert (strcmp (class (data), "int16"));
-%! data = getaudiodata (recorder, "int8");
-%! assert (strcmp (class (data), "int8"));
-%! data = getaudiodata (recorder, "uint8");
-%! assert (strcmp (class (data), "uint8"));
-%! assert (size (data)(1), recorder.TotalSamples);
-%! assert (size (data)(2), 2);
-%! assert (size (data)(1) != 0);
-
-%!testif HAVE_PORTAUDIO
-%! recorder = audiorecorder (44100, 16, 2);
-%! record (recorder, 1)
-%! sleep (2);
-%! record (recorder, 1);
-%! sleep (2);
-%! data = getaudiodata (recorder);
-%! assert (size (data)(1) < 44100 * 2);
-
-%!testif HAVE_PORTAUDIO
+%!demo
 %! recorder = audiorecorder (44100, 16, 2);
 %! record (recorder, 1);
 %! sleep (2);
@@ -83,8 +61,21 @@
 %! sleep (2);
 %! play (player2);
 %! sleep (2);
-%! assert (player1.TotalSamples, recorder.TotalSamples);
-%! assert (player2.TotalSamples, recorder.TotalSamples);
+%! stop (player1);
+%! stop (player2);
+
+## Tests of audiorecorder must not actually record anything.
+
+%!testif HAVE_PORTAUDIO
+%! recorder = audiorecorder (44100, 16, 2);
+%! data = getaudiodata (recorder, "int16");
+%! assert (strcmp (class (data), "int16"));
+%! data = getaudiodata (recorder, "int8");
+%! assert (strcmp (class (data), "int8"));
+%! data = getaudiodata (recorder, "uint8");
+%! assert (strcmp (class (data), "uint8"));
+%! assert (size (data)(1), recorder.TotalSamples);
+%! assert (size (data)(2), 2);
 
 %!testif HAVE_PORTAUDIO
 %! recorder = audiorecorder;