Mercurial > octave-nkf
comparison scripts/audio/@audiorecorder/getaudiodata.m @ 19557:5802ea7037d4
style fixes for audioplayer and audiorecorder classes
* @audioplayer/__get_properties__.m, @audioplayer/audioplayer.m,
@audioplayer/display.m, @audioplayer/get.m, @audioplayer/isplaying.m,
@audioplayer/pause.m, @audioplayer/play.m,
@audioplayer/playblocking.m, @audioplayer/resume.m,
@audioplayer/set.m, @audioplayer/stop.m, @audioplayer/subsasgn.m,
@audioplayer/subsref.m, @audiorecorder/__get_properties__.m,
@audiorecorder/audiorecorder.m, @audiorecorder/display.m,
@audiorecorder/get.m, @audiorecorder/getaudiodata.m,
@audiorecorder/getplayer.m, @audiorecorder/isrecording.m,
@audiorecorder/pause.m, @audiorecorder/play.m,
@audiorecorder/record.m, @audiorecorder/recordblocking.m,
@audiorecorder/resume.m, @audiorecorder/set.m, @audiorecorder/stop.m,
@audiorecorder/subsasgn.m, @audiorecorder/subsref.m: Style fixes.
Do more basic argument checking. Use consistent style for error
messages.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 02 Jan 2015 17:23:38 -0500 |
parents | dac3191a5301 |
children | 72304a4e010a |
comparison
equal
deleted
inserted
replaced
19556:fc03d6e0d842 | 19557:5802ea7037d4 |
---|---|
25 ## to the specified type, which may be one of @qcode{"double"}, | 25 ## to the specified type, which may be one of @qcode{"double"}, |
26 ## @qcode{"single"}, @qcode{"int16"}, @qcode{"int8"} or @qcode{"uint8"}. | 26 ## @qcode{"single"}, @qcode{"int16"}, @qcode{"int8"} or @qcode{"uint8"}. |
27 ## @end deftypefn | 27 ## @end deftypefn |
28 | 28 |
29 function data = getaudiodata (varargin) | 29 function data = getaudiodata (varargin) |
30 | |
30 if (nargin < 1 || nargin > 2) | 31 if (nargin < 1 || nargin > 2) |
31 print_usage (); | 32 print_usage (); |
32 endif | 33 endif |
34 | |
33 recorder = varargin{1}; | 35 recorder = varargin{1}; |
36 | |
34 if (nargin == 1) | 37 if (nargin == 1) |
35 data = __recorder_getaudiodata__ (struct (recorder).recorder); | 38 data = __recorder_getaudiodata__ (struct (recorder).recorder); |
36 else | 39 else |
37 data = __recorder_getaudiodata__ (struct (recorder).recorder); | 40 data = __recorder_getaudiodata__ (struct (recorder).recorder); |
38 type = varargin{2}; | 41 type = varargin{2}; |
43 data = int8 (data * (2.0 ^ 7)); | 46 data = int8 (data * (2.0 ^ 7)); |
44 case "uint8" | 47 case "uint8" |
45 data = uint8 ((data + 1.0) * 0.5 * (2.0 ^ 8 - 1)); | 48 data = uint8 ((data + 1.0) * 0.5 * (2.0 ^ 8 - 1)); |
46 endswitch | 49 endswitch |
47 endif | 50 endif |
51 | |
48 if (get (recorder, "NumberOfChannels") == 2) | 52 if (get (recorder, "NumberOfChannels") == 2) |
49 data = data'; | 53 data = data'; |
50 else | 54 else |
51 data = data(1,:)'; | 55 data = data(1,:)'; |
52 endif | 56 endif |
57 | |
53 endfunction | 58 endfunction |