Mercurial > hg > octave-nkf
annotate scripts/deprecated/loadaudio.m @ 20076:781adfc2958c draft obsolete nkf
Build qt graphics toolkit menus with uimenu
* libgui/graphics/Figure.cc, libgui/graphics/Figure.h: Revert cset 7335cc071ab0
and remove all menu items.
* scripts/gui/private/__get_funcname__.m: Fix typo
* scripts/plot/util/private/__add_default_menu__.m: Enable uimenu for qt
graphics toolkit and fix setting pan/rotate/zoom for qt and fltk
author | Stefan Mahr <dac922@gmx.de> |
---|---|
date | Fri, 27 Feb 2015 18:36:05 +0100 |
parents | 4197fc428c7d |
children |
rev | line source |
---|---|
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19844
diff
changeset
|
1 ## Copyright (C) 1995-2015 John W. Eaton |
2313 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
2313 | 9 ## |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
2303 | 18 |
3332 | 19 ## -*- texinfo -*- |
20 ## @deftypefn {Function File} {} loadaudio (@var{name}, @var{ext}, @var{bps}) | |
19844
0165d9607624
Deprecate audio functions loadaudio, playaudio, saveaudio, and setaudio.
Mike Miller <mtmiller@ieee.org>
parents:
17744
diff
changeset
|
21 ## |
0165d9607624
Deprecate audio functions loadaudio, playaudio, saveaudio, and setaudio.
Mike Miller <mtmiller@ieee.org>
parents:
17744
diff
changeset
|
22 ## @code{loadaudio} is deprecated and will be removed in Octave version 4.4. |
0165d9607624
Deprecate audio functions loadaudio, playaudio, saveaudio, and setaudio.
Mike Miller <mtmiller@ieee.org>
parents:
17744
diff
changeset
|
23 ## Please use @code{audioread} in all new code. |
0165d9607624
Deprecate audio functions loadaudio, playaudio, saveaudio, and setaudio.
Mike Miller <mtmiller@ieee.org>
parents:
17744
diff
changeset
|
24 ## |
12575
d0b799dafede
Grammarcheck files for 3.4.1 release.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
25 ## Load audio data from the file @file{@var{name}.@var{ext}} into the |
3426 | 26 ## vector @var{x}. |
2311 | 27 ## |
3332 | 28 ## The extension @var{ext} determines how the data in the audio file is |
10793
be55736a0783
Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents:
10635
diff
changeset
|
29 ## interpreted; the extensions @file{lin} (default) and @file{raw} |
3332 | 30 ## correspond to linear, the extensions @file{au}, @file{mu}, or @file{snd} |
31 ## to mu-law encoding. | |
3426 | 32 ## |
3332 | 33 ## The argument @var{bps} can be either 8 (default) or 16, and specifies |
34 ## the number of bits per sample used in the audio file. | |
5642 | 35 ## @seealso{lin2mu, mu2lin, saveaudio, playaudio, setaudio, record} |
3332 | 36 ## @end deftypefn |
5642 | 37 |
2311 | 38 |
2312 | 39 ## Author: AW <Andreas.Weingessel@ci.tuwien.ac.at> |
40 ## Created: 10 April 1994 | |
41 ## Adapted-By: jwe | |
42 | |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
43 function X = loadaudio (name, ext, bps) |
2325 | 44 |
19844
0165d9607624
Deprecate audio functions loadaudio, playaudio, saveaudio, and setaudio.
Mike Miller <mtmiller@ieee.org>
parents:
17744
diff
changeset
|
45 persistent warned = false; |
0165d9607624
Deprecate audio functions loadaudio, playaudio, saveaudio, and setaudio.
Mike Miller <mtmiller@ieee.org>
parents:
17744
diff
changeset
|
46 if (! warned) |
0165d9607624
Deprecate audio functions loadaudio, playaudio, saveaudio, and setaudio.
Mike Miller <mtmiller@ieee.org>
parents:
17744
diff
changeset
|
47 warned = true; |
0165d9607624
Deprecate audio functions loadaudio, playaudio, saveaudio, and setaudio.
Mike Miller <mtmiller@ieee.org>
parents:
17744
diff
changeset
|
48 warning ("Octave:deprecated-function", |
0165d9607624
Deprecate audio functions loadaudio, playaudio, saveaudio, and setaudio.
Mike Miller <mtmiller@ieee.org>
parents:
17744
diff
changeset
|
49 "loadaudio is obsolete and will be removed from a future version of Octave, please use audioread instead"); |
0165d9607624
Deprecate audio functions loadaudio, playaudio, saveaudio, and setaudio.
Mike Miller <mtmiller@ieee.org>
parents:
17744
diff
changeset
|
50 endif |
0165d9607624
Deprecate audio functions loadaudio, playaudio, saveaudio, and setaudio.
Mike Miller <mtmiller@ieee.org>
parents:
17744
diff
changeset
|
51 |
1636 | 52 if (nargin == 0 || nargin > 3) |
6046 | 53 print_usage (); |
1636 | 54 endif |
55 | |
56 if (nargin == 1) | |
57 ext = "lin"; | |
58 endif | |
59 | |
60 if (nargin < 3) | |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
61 bps = 8; |
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
62 elseif (bps != 8 && bps != 16) |
11472
1740012184f9
Use uppercase for variable names in error() strings to match Info documentation. Only m-files done.
Rik <octave@nomad.inbox5.com>
parents:
11469
diff
changeset
|
63 error ("loadaudio: BPS must be either 8 or 16"); |
1636 | 64 endif |
65 | |
66 name = [name, ".", ext]; | |
3167 | 67 num = fopen (name, "rb"); |
1636 | 68 |
3167 | 69 if (strcmp (ext, "lin") || strcmp (ext, "raw") || strcmp (ext, "pcm")) |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
70 if (bps == 8) |
1636 | 71 [Y, c] = fread (num, inf, "uchar"); |
72 X = Y - 127; | |
73 else | |
74 [X, c] = fread (num, inf, "short"); | |
75 endif | |
3471 | 76 elseif (strcmp (ext, "mu") || strcmp (ext, "au") |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
77 || strcmp (ext, "snd") || strcmp (ext, "ul")) |
1636 | 78 [Y, c] = fread (num, inf, "uchar"); |
2303 | 79 ## remove file header |
6024 | 80 m = find (Y(1:64) == 0, 1, "last"); |
1636 | 81 if (! isempty (m)) |
82 Y(1:m) = []; | |
83 endif | |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
84 X = mu2lin (Y, bps); |
1636 | 85 else |
86 fclose (num); | |
10635
d1978e7364ad
Print name of function in error() string messages.
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
87 error ("loadaudio: unsupported extension"); |
1636 | 88 endif |
89 | |
90 fclose (num); | |
2325 | 91 |
1636 | 92 endfunction |
17338
1c89599167a6
maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
93 |