annotate scripts/audio/@audiorecorder/play.m @ 31549:ed7b17c7ddf3 stable

maint: Strip trailing spaces and add missing EOL to all files. * README, NEWS.6.md, RELEASE_CHECKLIST.md, README.md, besselj.cc, Array.h, LSODE.cc, set.m, audiorecorder.m, play.m, set.m, patch.m: Strip trailing spaces. * command-widget.cc, led-indicator.cc, led-indicator.h: Add missing EOL to files.
author Rik <rik@octave.org>
date Fri, 25 Nov 2022 21:38:22 -0800
parents 2d6e60776588
children 597f3ee61a48
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ########################################################################
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 ##
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
3 ## Copyright (C) 2013-2022 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
4 ##
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 ## See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 ## distribution or <https://octave.org/copyright/>.
19500
8bb399569393 Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents: 19497
diff changeset
7 ##
8bb399569393 Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents: 19497
diff changeset
8 ## This file is part of Octave.
8bb399569393 Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents: 19497
diff changeset
9 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
10 ## Octave is free software: you can redistribute it and/or modify it
19500
8bb399569393 Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents: 19497
diff changeset
11 ## under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
12 ## the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
13 ## (at your option) any later version.
19500
8bb399569393 Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents: 19497
diff changeset
14 ##
8bb399569393 Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents: 19497
diff changeset
15 ## Octave is distributed in the hope that it will be useful, but
8bb399569393 Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents: 19497
diff changeset
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
18 ## GNU General Public License for more details.
19500
8bb399569393 Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents: 19497
diff changeset
19 ##
8bb399569393 Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents: 19497
diff changeset
20 ## You should have received a copy of the GNU General Public License
8bb399569393 Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents: 19497
diff changeset
21 ## along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
22 ## <https://www.gnu.org/licenses/>.
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 ##
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ########################################################################
19500
8bb399569393 Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents: 19497
diff changeset
25
19476
e1f98e402a7e New files - @audiorecorder and @audioplayer classes
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff changeset
26 ## -*- texinfo -*-
20852
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20181
diff changeset
27 ## @deftypefn {} {@var{player} =} play (@var{recorder})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20181
diff changeset
28 ## @deftypefnx {} {@var{player} =} play (@var{recorder}, @var{start})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20181
diff changeset
29 ## @deftypefnx {} {@var{player} =} play (@var{recorder}, [@var{start}, @var{end}])
30568
82b685157e2b doc: Update documentation in audio/ directory.
Rik <rik@octave.org>
parents: 30564
diff changeset
30 ## Play the audio recorded in @var{recorder} without blocking and return a
82b685157e2b doc: Update documentation in audio/ directory.
Rik <rik@octave.org>
parents: 30564
diff changeset
31 ## corresponding audioplayer object.
20181
aa36fb998a4d maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents: 20158
diff changeset
32 ##
20158
7503499a252b doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
33 ## If the optional argument @var{start} is provided, begin playing
30568
82b685157e2b doc: Update documentation in audio/ directory.
Rik <rik@octave.org>
parents: 30564
diff changeset
34 ## @var{start} seconds into the recording.
20181
aa36fb998a4d maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents: 20158
diff changeset
35 ##
19506
fdb8a62ef17a fix docstring style in .m files
John W. Eaton <jwe@octave.org>
parents: 19505
diff changeset
36 ## If the optional argument @var{end} is provided, stop playing at
30568
82b685157e2b doc: Update documentation in audio/ directory.
Rik <rik@octave.org>
parents: 30564
diff changeset
37 ## @var{end} seconds into the recording.
31549
ed7b17c7ddf3 maint: Strip trailing spaces and add missing EOL to all files.
Rik <rik@octave.org>
parents: 30569
diff changeset
38 ## @seealso{@audiorecorder/getplayer, @audioplayer/audioplayer,
30568
82b685157e2b doc: Update documentation in audio/ directory.
Rik <rik@octave.org>
parents: 30564
diff changeset
39 ## @audiorecorder/audiorecorder}
19476
e1f98e402a7e New files - @audiorecorder and @audioplayer classes
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff changeset
40 ## @end deftypefn
e1f98e402a7e New files - @audiorecorder and @audioplayer classes
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff changeset
41
30569
2d6e60776588 Overhaul @audiorecorder class.
Rik <rik@octave.org>
parents: 30568
diff changeset
42 function player = play (recorder, start)
19523
5802ea7037d4 style fixes for audioplayer and audiorecorder classes
John W. Eaton <jwe@octave.org>
parents: 19507
diff changeset
43
30569
2d6e60776588 Overhaul @audiorecorder class.
Rik <rik@octave.org>
parents: 30568
diff changeset
44 data = getaudiodata (recorder);
2d6e60776588 Overhaul @audiorecorder class.
Rik <rik@octave.org>
parents: 30568
diff changeset
45 player = audioplayer (data,
2d6e60776588 Overhaul @audiorecorder class.
Rik <rik@octave.org>
parents: 30568
diff changeset
46 get (recorder, "SampleRate"),
2d6e60776588 Overhaul @audiorecorder class.
Rik <rik@octave.org>
parents: 30568
diff changeset
47 get (recorder, "BitsPerSample"));
19523
5802ea7037d4 style fixes for audioplayer and audiorecorder classes
John W. Eaton <jwe@octave.org>
parents: 19507
diff changeset
48
19476
e1f98e402a7e New files - @audiorecorder and @audioplayer classes
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff changeset
49 if (nargin == 1)
19503
36a26a131209 Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents: 19500
diff changeset
50 play (player);
19476
e1f98e402a7e New files - @audiorecorder and @audioplayer classes
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff changeset
51 else
30569
2d6e60776588 Overhaul @audiorecorder class.
Rik <rik@octave.org>
parents: 30568
diff changeset
52 play (player, start);
19476
e1f98e402a7e New files - @audiorecorder and @audioplayer classes
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff changeset
53 endif
19523
5802ea7037d4 style fixes for audioplayer and audiorecorder classes
John W. Eaton <jwe@octave.org>
parents: 19507
diff changeset
54
19500
8bb399569393 Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents: 19497
diff changeset
55 endfunction
30569
2d6e60776588 Overhaul @audiorecorder class.
Rik <rik@octave.org>
parents: 30568
diff changeset
56
2d6e60776588 Overhaul @audiorecorder class.
Rik <rik@octave.org>
parents: 30568
diff changeset
57
2d6e60776588 Overhaul @audiorecorder class.
Rik <rik@octave.org>
parents: 30568
diff changeset
58 ## No tests possible for this function
2d6e60776588 Overhaul @audiorecorder class.
Rik <rik@octave.org>
parents: 30568
diff changeset
59 %!assert (1)