comparison scripts/@audiorecorder/play.m @ 19510:e1f98e402a7e

New files - @audiorecorder and @audioplayer classes * @audiorecorder: new files implementing methods for the audiorecorder class * @audioplayer: new files implementing methods for the audioplayer class
author Vytautas Jančauskas <unaudio@gmail.com>
date Wed, 11 Sep 2013 22:40:18 +0300
parents
children
comparison
equal deleted inserted replaced
19509:b9df6b3fd5ef 19510:e1f98e402a7e
1 ## -*- texinfo -*-
2 ## @deftypefn{Function File} player = play (@var{recorderObj})
3 ## Play the audio recorded in @var{recorderObj} and return a corresponding audioplayer object.
4 ## @deftypefnx{Function File} player = play (@var{recorderObj}, start)
5 ## Play the audio recorded in @var{recorderObj} starting from @var{start} seconds in to the recording. Returns a corresponding audioplayer object.
6 ## @deftypefnx{Function File} player = play (@var{recorderObj}, [start, end])
7 ## Play the audio recorded in @var{recorderObj} starting from @var{start} seconds and ending at @var{end} seconds in the recording. Returns a corresponding audioplayer object.
8 ## @end deftypefn
9
10 function player = play(varargin)
11 if (nargin < 1 || nargin > 2)
12 print_usage ();
13 endif
14 recorder = varargin{1};
15 data = getaudiodata(recorder);
16 player = audioplayer(data, get(recorder, 'SampleRate'), get(recorder, 'BitsPerSample'));
17 if (nargin == 1)
18 play(player);
19 else
20 play(player, varargin{2});
21 endif
22 endfunction