Mercurial > octave-nkf
comparison scripts/audio/@audioplayer/audioplayer.m @ 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 | 72304a4e010a |
children | 4197fc428c7d |
comparison
equal
deleted
inserted
replaced
19701:4b1a43786489 | 19702:b2fe4dbe5266 |
---|---|
105 player = class (player, "audioplayer"); | 105 player = class (player, "audioplayer"); |
106 endif | 106 endif |
107 | 107 |
108 endfunction | 108 endfunction |
109 | 109 |
110 %!demo | |
111 %! fs = 44100; | |
112 %! audio = randn (2, 2*fs) - 0.5; | |
113 %! player = audioplayer (audio, fs); | |
114 %! play (player); | |
115 %! sleep (1); | |
116 %! pause (player); | |
117 %! sleep (1); | |
118 %! resume (player); | |
119 %! sleep (1); | |
120 %! stop (player); | |
121 | |
122 ## Tests of audioplayer must not actually play anything. | |
123 | |
110 %!testif HAVE_PORTAUDIO | 124 %!testif HAVE_PORTAUDIO |
111 %! mono = randn (1, 44100) - 0.5; | 125 %! mono = randn (1, 44100) - 0.5; |
112 %! stereo = randn (2, 44100) - 0.5; | 126 %! stereo = randn (2, 44100) - 0.5; |
113 %! fs = 44100; | 127 %! fs = 44100; |
114 %! player1 = audioplayer (mono, fs); | 128 %! player1 = audioplayer (mono, fs); |
117 %! assert (player2.NumberOfChannels, 2); | 131 %! assert (player2.NumberOfChannels, 2); |
118 %! assert (player1.SampleRate, 44100); | 132 %! assert (player1.SampleRate, 44100); |
119 %! assert (player2.SampleRate, 44100); | 133 %! assert (player2.SampleRate, 44100); |
120 %! assert (player1.TotalSamples, 44100); | 134 %! assert (player1.TotalSamples, 44100); |
121 %! assert (player2.TotalSamples, 44100); | 135 %! assert (player2.TotalSamples, 44100); |
122 %! playblocking (player1); | |
123 %! playblocking (player2); | |
124 | |
125 %!testif HAVE_PORTAUDIO | |
126 %! audio = randn (2, 88200) - 0.5; | |
127 %! fs = 44100; | |
128 %! player = audioplayer (audio, fs); | |
129 %! assert (!isplaying (player)); | |
130 %! play (player); | |
131 %! assert (isplaying (player)); | |
132 %! sleep (1); | |
133 %! pause (player); | |
134 %! assert (!isplaying (player)); | |
135 %! sleep (1); | |
136 %! resume (player); | |
137 %! assert (isplaying (player)); | |
138 %! sleep (1); | |
139 | |
140 %!testif HAVE_PORTAUDIO | |
141 %! audio = randn (2, 88200) - 0.5; | |
142 %! fs = 44100; | |
143 %! player = audioplayer (audio, fs); | |
144 %! assert (!isplaying (player)); | |
145 %! play (player); | |
146 %! assert (isplaying (player)); | |
147 %! sleep (1); | |
148 %! stop (player); | |
149 %! sleep (1); | |
150 %! assert (!isplaying (player)); | |
151 %! assert (player.CurrentSample, 0); | |
152 | 136 |
153 %!testif HAVE_PORTAUDIO | 137 %!testif HAVE_PORTAUDIO |
154 %! audio = randn (2, 44100) - 0.5; | 138 %! audio = randn (2, 44100) - 0.5; |
155 %! fs = 44100; | 139 %! fs = 44100; |
156 %! player = audioplayer (audio, fs); | 140 %! player = audioplayer (audio, fs); |