Mercurial > octave-nkf
annotate libinterp/dldfcn/__player_audioplayer__.cc @ 19537:36a26a131209
Apply Octave coding style to audio project additions
* libinterp/dldfcn/__player_audioplayer__.cc,
libinterp/dldfcn/__recorder_audiorecorder__.cc,
libinterp/dldfcn/audiodevinfo.cc, libinterp/dldfcn/audioinfo.cc,
libinterp/dldfcn/audioread.cc, libinterp/dldfcn/audiowrite.cc,
libinterp/dldfcn/player_class.cc, libinterp/dldfcn/player_class.h,
libinterp/dldfcn/recorder_class.cc, libinterp/dldfcn/recorder_class.h,
scripts/audio/@audioplayer/__get_properties__.m,
scripts/audio/@audioplayer/audioplayer.m,
scripts/audio/@audioplayer/display.m, scripts/audio/@audioplayer/get.m,
scripts/audio/@audioplayer/isplaying.m, scripts/audio/@audioplayer/pause.m,
scripts/audio/@audioplayer/play.m,
scripts/audio/@audioplayer/playblocking.m,
scripts/audio/@audioplayer/resume.m, scripts/audio/@audioplayer/set.m,
scripts/audio/@audioplayer/stop.m, scripts/audio/@audioplayer/subsasgn.m,
scripts/audio/@audioplayer/subsref.m,
scripts/audio/@audiorecorder/__get_properties__.m,
scripts/audio/@audiorecorder/audiorecorder.m,
scripts/audio/@audiorecorder/display.m, scripts/audio/@audiorecorder/get.m,
scripts/audio/@audiorecorder/getaudiodata.m,
scripts/audio/@audiorecorder/getplayer.m,
scripts/audio/@audiorecorder/isrecording.m,
scripts/audio/@audiorecorder/pause.m, scripts/audio/@audiorecorder/play.m,
scripts/audio/@audiorecorder/record.m,
scripts/audio/@audiorecorder/recordblocking.m,
scripts/audio/@audiorecorder/resume.m, scripts/audio/@audiorecorder/set.m,
scripts/audio/@audiorecorder/stop.m,
scripts/audio/@audiorecorder/subsasgn.m,
scripts/audio/@audiorecorder/subsref.m: Apply consistent Octave indentation,
spacing, and quoting styles. Strip trailing whitespace. Remove braces from
one-line if-else blocks. Simplify some variable declarations.
author | Mike Miller <mtmiller@ieee.org> |
---|---|
date | Thu, 03 Oct 2013 07:52:58 -0400 |
parents | 1f551d169db2 |
children | d7b55fc1b37d |
rev | line source |
---|---|
19534
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19515
diff
changeset
|
1 /* |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19515
diff
changeset
|
2 |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19515
diff
changeset
|
3 Copyright (C) 2013 Vytautas JanĨauskas |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19515
diff
changeset
|
4 |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19515
diff
changeset
|
5 This file is part of Octave. |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19515
diff
changeset
|
6 |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19515
diff
changeset
|
7 Octave is free software; you can redistribute it and/or modify it |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19515
diff
changeset
|
8 under the terms of the GNU General Public License as published by the |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19515
diff
changeset
|
9 Free Software Foundation; either version 3 of the License, or (at your |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19515
diff
changeset
|
10 option) any later version. |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19515
diff
changeset
|
11 |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19515
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19515
diff
changeset
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19515
diff
changeset
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19515
diff
changeset
|
15 for more details. |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19515
diff
changeset
|
16 |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19515
diff
changeset
|
17 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:
19515
diff
changeset
|
18 along with Octave; see the file COPYING. If not, see |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19515
diff
changeset
|
19 <http://www.gnu.org/licenses/>. |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19515
diff
changeset
|
20 |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19515
diff
changeset
|
21 */ |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19515
diff
changeset
|
22 |
19535
1f551d169db2
Include config.h in audio project source files
Mike Miller <mtmiller@ieee.org>
parents:
19534
diff
changeset
|
23 #ifdef HAVE_CONFIG_H |
1f551d169db2
Include config.h in audio project source files
Mike Miller <mtmiller@ieee.org>
parents:
19534
diff
changeset
|
24 #include <config.h> |
1f551d169db2
Include config.h in audio project source files
Mike Miller <mtmiller@ieee.org>
parents:
19534
diff
changeset
|
25 #endif |
1f551d169db2
Include config.h in audio project source files
Mike Miller <mtmiller@ieee.org>
parents:
19534
diff
changeset
|
26 |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
27 #include "oct.h" |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
28 #include "ov-struct.h" |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
29 |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
30 #ifdef HAVE_PORTAUDIO |
19513
b8ea3ff8f5fd
include player_class.cc and recorder_class.cc in __player_audioplayer__.cc
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19512
diff
changeset
|
31 #include "player_class.cc" |
b8ea3ff8f5fd
include player_class.cc and recorder_class.cc in __player_audioplayer__.cc
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19512
diff
changeset
|
32 #include "recorder_class.cc" |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
33 #endif |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
34 |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
35 DEFUN_DLD (__player_audioplayer__, args, , |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
36 "__player_audioplayer__") |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
37 { |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
38 #ifdef HAVE_PORTAUDIO |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
39 int nargin = args.length (); |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
40 audioplayer* retval = new audioplayer (); |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
41 bool is_function = args(0).is_string () || args(0).is_function_handle () || args(0).is_inline_function (); |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
42 if (is_function) |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
43 retval->set_y (args(0).function_value ()); |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
44 else |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
45 retval->set_y (args(0)); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
46 retval->set_fs (args(1).int_value ()); |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
47 switch (nargin) |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
48 { |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
49 case 3: |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
50 retval->set_nbits (args(2).int_value ()); |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
51 break; |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
52 case 4: |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
53 retval->set_nbits (args(2).int_value ()); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
54 retval->set_id (args(3).int_value ()); |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
55 break; |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
56 } |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
57 if (is_function) |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
58 retval->init_fn (); |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
59 else |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
60 retval->init (); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
61 return octave_value (retval); |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
62 #else |
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
63 octave_value retval; |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
64 error ("portaudio not found on your system and thus audio functionality is not present"); |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
65 return retval; |
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
66 #endif |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
67 } |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
68 |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
69 DEFUN_DLD (__player_get_channels__, args, , |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
70 "__player_get_channels__") |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
71 { |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
72 octave_value retval; |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
73 #ifdef HAVE_PORTAUDIO |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
74 int nargin = args.length (); |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
75 if (nargin == 1) |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
76 { |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
77 const octave_base_value& rep = args(0).get_rep (); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
78 audioplayer *player = &((audioplayer &)rep); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
79 retval = octave_value (player->get_channels ()); |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
80 } |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
81 #else |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
82 error ("portaudio not found on your system and thus audio functionality is not present"); |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
83 #endif |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
84 return retval; |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
85 } |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
86 |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
87 DEFUN_DLD (__player_get_fs__, args, , |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
88 "__player_get_fs__") |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
89 { |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
90 octave_value retval; |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
91 #ifdef HAVE_PORTAUDIO |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
92 int nargin = args.length (); |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
93 if (nargin == 1) |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
94 { |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
95 const octave_base_value& rep = args(0).get_rep (); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
96 audioplayer *player = &((audioplayer &)rep); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
97 retval = octave_value (player->get_fs ()); |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
98 } |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
99 #else |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
100 error ("portaudio not found on your system and thus audio functionality is not present"); |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
101 #endif |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
102 return retval; |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
103 } |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
104 |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
105 DEFUN_DLD (__player_get_id__, args, , |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
106 "__player_get_id__") |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
107 { |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
108 octave_value retval; |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
109 #ifdef HAVE_PORTAUDIO |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
110 int nargin = args.length (); |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
111 if (nargin == 1) |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
112 { |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
113 const octave_base_value& rep = args(0).get_rep (); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
114 audioplayer *player = &((audioplayer &)rep); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
115 retval = octave_value (player->get_id ()); |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
116 } |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
117 #else |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
118 error ("portaudio not found on your system and thus audio functionality is not present"); |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
119 #endif |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
120 return retval; |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
121 } |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
122 |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
123 DEFUN_DLD (__player_get_nbits__, args, , |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
124 "__player_get_nbits__") |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
125 { |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
126 octave_value retval; |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
127 #ifdef HAVE_PORTAUDIO |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
128 int nargin = args.length (); |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
129 if (nargin == 1) |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
130 { |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
131 const octave_base_value& rep = args(0).get_rep (); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
132 audioplayer *player = &((audioplayer &)rep); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
133 retval = octave_value (player->get_nbits ()); |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
134 } |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
135 #else |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
136 error ("portaudio not found on your system and thus audio functionality is not present"); |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
137 #endif |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
138 return retval; |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
139 } |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
140 |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
141 DEFUN_DLD (__player_get_sample_number__, args, , |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
142 "__player_get_sample_number__") |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
143 { |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
144 octave_value retval; |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
145 #ifdef HAVE_PORTAUDIO |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
146 int nargin = args.length (); |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
147 if (nargin == 1) |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
148 { |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
149 const octave_base_value& rep = args(0).get_rep (); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
150 audioplayer *player = &((audioplayer &)rep); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
151 retval = octave_value (player->get_sample_number ()); |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
152 } |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
153 #else |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
154 error ("portaudio not found on your system and thus audio functionality is not present"); |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
155 #endif |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
156 return retval; |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
157 } |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
158 |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
159 DEFUN_DLD (__player_get_tag__, args, , |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
160 "__player_get_tag__") |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
161 { |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
162 octave_value retval; |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
163 #ifdef HAVE_PORTAUDIO |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
164 int nargin = args.length (); |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
165 if (nargin == 1) |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
166 { |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
167 const octave_base_value& rep = args(0).get_rep (); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
168 audioplayer *player = &((audioplayer &)rep); |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
169 retval = octave_value (player->get_tag ()); |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
170 } |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
171 #else |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
172 error ("portaudio not found on your system and thus audio functionality is not present"); |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
173 #endif |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
174 return retval; |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
175 } |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
176 |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
177 DEFUN_DLD (__player_get_total_samples__, args, , |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
178 "__player_get_total_samples__") |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
179 { |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
180 octave_value retval; |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
181 #ifdef HAVE_PORTAUDIO |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
182 int nargin = args.length (); |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
183 if (nargin == 1) |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
184 { |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
185 const octave_base_value& rep = args(0).get_rep (); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
186 audioplayer *player = &((audioplayer &)rep); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
187 retval = octave_value (player->get_total_samples ()); |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
188 } |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
189 #else |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
190 error ("portaudio not found on your system and thus audio functionality is not present"); |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
191 #endif |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
192 return retval; |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
193 } |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
194 |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
195 DEFUN_DLD (__player_get_userdata__, args, , |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
196 "__player_get_userdata__") |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
197 { |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
198 octave_value retval; |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
199 #ifdef HAVE_PORTAUDIO |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
200 int nargin = args.length (); |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
201 if (nargin == 1) |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
202 { |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
203 const octave_base_value& rep = args(0).get_rep (); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
204 audioplayer *player = &((audioplayer &)rep); |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
205 retval = player->get_userdata (); |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
206 } |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
207 #else |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
208 error ("portaudio not found on your system and thus audio functionality is not present"); |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
209 #endif |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
210 return retval; |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
211 } |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
212 |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
213 DEFUN_DLD (__player_isplaying__, args, , |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
214 "__player_isplaying__") |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
215 { |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
216 octave_value retval; |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
217 #ifdef HAVE_PORTAUDIO |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
218 int nargin = args.length (); |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
219 if (nargin == 1) |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
220 { |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
221 const octave_base_value& rep = args(0).get_rep (); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
222 audioplayer *player = &((audioplayer &)rep); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
223 if (player->isplaying ()) |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
224 return octave_value (1); |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
225 else |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
226 return octave_value (0); |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
227 } |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
228 #else |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
229 error ("portaudio not found on your system and thus audio functionality is not present"); |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
230 #endif |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
231 return retval; |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
232 } |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
233 |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
234 DEFUN_DLD (__player_pause__, args, , |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
235 "__player_pause__") |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
236 { |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
237 octave_value retval; |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
238 #ifdef HAVE_PORTAUDIO |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
239 int nargin = args.length (); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
240 if (nargin == 1) |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
241 { |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
242 const octave_base_value& rep = args(0).get_rep (); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
243 audioplayer *player = &((audioplayer &)rep); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
244 player->pause (); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
245 } |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
246 #else |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
247 error ("portaudio not found on your system and thus audio functionality is not present"); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
248 #endif |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
249 return retval; |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
250 } |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
251 |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
252 DEFUN_DLD (__player_playblocking__, args, , |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
253 "__player_playblocking__") |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
254 { |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
255 octave_value retval; |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
256 #ifdef HAVE_PORTAUDIO |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
257 int nargin = args.length (); |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
258 if (nargin == 1) |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
259 { |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
260 const octave_base_value& rep = args(0).get_rep (); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
261 audioplayer *player = &((audioplayer &)rep); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
262 player->playblocking (); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
263 } |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
264 else |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
265 { |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
266 const octave_base_value& rep = args(0).get_rep (); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
267 audioplayer *player = &((audioplayer &)rep); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
268 if (args(1).is_matrix_type ()) |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
269 { |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
270 unsigned int start, end; |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
271 RowVector range = args(1).row_vector_value (); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
272 start = range.elem (0) - 1; |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
273 end = range.elem (1) - 1; |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
274 if (start < 0 or start > player->get_total_samples () or |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
275 start > end or end < 0 or end > player->get_total_samples ()) |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
276 error ("audioplayer: invalid range specified for playback"); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
277 player->set_sample_number (start); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
278 player->set_end_sample (end); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
279 } |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
280 else |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
281 { |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
282 unsigned int start; |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
283 start = args(1).int_value () - 1; |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
284 if (start < 0 or start > player->get_total_samples ()) |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
285 error ("audioplayer: invalid range specified for playback"); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
286 player->set_sample_number (start); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
287 } |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
288 player->playblocking (); |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
289 } |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
290 #else |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
291 error ("portaudio not found on your system and thus audio functionality is not present"); |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
292 #endif |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
293 return retval; |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
294 } |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
295 |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
296 DEFUN_DLD (__player_play__, args, , |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
297 "__player_play__") |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
298 { |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
299 octave_value retval; |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
300 #ifdef HAVE_PORTAUDIO |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
301 int nargin = args.length (); |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
302 if (nargin == 1) |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
303 { |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
304 const octave_base_value& rep = args(0).get_rep (); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
305 audioplayer *player = &((audioplayer &)rep); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
306 player->play (); |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
307 } |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
308 else |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
309 { |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
310 const octave_base_value& rep = args(0).get_rep (); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
311 audioplayer *player = &((audioplayer &)rep); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
312 if (args(1).is_matrix_type ()) |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
313 { |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
314 unsigned int start, end; |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
315 RowVector range = args(1).row_vector_value (); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
316 start = range.elem (0) - 1; |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
317 end = range.elem (1) - 1; |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
318 if (start < 0 or start > player->get_total_samples () or |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
319 start > end or end < 0 or end > player->get_total_samples ()) |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
320 error ("audioplayer: invalid range specified for playback"); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
321 player->set_sample_number (start); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
322 player->set_end_sample (end); |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
323 } |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
324 else |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
325 { |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
326 unsigned int start; |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
327 start = args(1).int_value () - 1; |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
328 if (start < 0 or start > player->get_total_samples ()) |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
329 error ("audioplayer: invalid range specified for playback"); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
330 player->set_sample_number (start); |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
331 } |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
332 player->play (); |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
333 } |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
334 #else |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
335 error ("portaudio not found on your system and thus audio functionality is not present"); |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
336 #endif |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
337 return retval; |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
338 } |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
339 |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
340 DEFUN_DLD (__player_resume__, args, , |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
341 "__player_resume__") |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
342 { |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
343 octave_value retval; |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
344 #ifdef HAVE_PORTAUDIO |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
345 int nargin = args.length (); |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
346 if (nargin == 1) |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
347 { |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
348 const octave_base_value& rep = args(0).get_rep (); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
349 audioplayer *player = &((audioplayer &)rep); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
350 player->resume (); |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
351 } |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
352 #else |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
353 error ("portaudio not found on your system and thus audio functionality is not present"); |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
354 #endif |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
355 return retval; |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
356 } |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
357 |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
358 DEFUN_DLD (__player_set_fs__, args, , |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
359 "__player_set_fs__") |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
360 { |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
361 octave_value retval; |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
362 #ifdef HAVE_PORTAUDIO |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
363 int nargin = args.length (); |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
364 if (nargin == 2) |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
365 { |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
366 const octave_base_value& rep = args(0).get_rep (); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
367 audioplayer *player = &((audioplayer &)rep); |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
368 player->set_fs (args(1).int_value ()); |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
369 } |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
370 #else |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
371 error ("portaudio not found on your system and thus audio functionality is not present"); |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
372 #endif |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
373 return retval; |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
374 } |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
375 |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
376 DEFUN_DLD (__player_set_tag__, args, , |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
377 "__player_set_tag__") |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
378 { |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
379 octave_value retval; |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
380 #ifdef HAVE_PORTAUDIO |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
381 int nargin = args.length (); |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
382 if (nargin == 2) |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
383 { |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
384 const octave_base_value& rep = args(0).get_rep (); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
385 audioplayer *player = &((audioplayer &)rep); |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
386 player->set_tag (args(1).char_matrix_value ()); |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
387 } |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
388 #else |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
389 error ("portaudio not found on your system and thus audio functionality is not present"); |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
390 #endif |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
391 return retval; |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
392 } |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
393 |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
394 DEFUN_DLD (__player_set_userdata__, args, , |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
395 "__player_set_userdata__") |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
396 { |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
397 octave_value retval; |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
398 #ifdef HAVE_PORTAUDIO |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
399 int nargin = args.length (); |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
400 if (nargin == 2) |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
401 { |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
402 const octave_base_value& rep = args(0).get_rep (); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
403 audioplayer *player = &((audioplayer &)rep); |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
404 player->set_userdata (args(1)); |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
405 } |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
406 #else |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
407 error ("portaudio not found on your system and thus audio functionality is not present"); |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
408 #endif |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
409 return retval; |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
410 } |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
411 |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
412 DEFUN_DLD (__player_stop__, args, , |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
413 "__player_stop__") |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
414 { |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
415 octave_value retval; |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
416 #ifdef HAVE_PORTAUDIO |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
417 int nargin = args.length (); |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
418 if (nargin == 1) |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
419 { |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
420 const octave_base_value& rep = args(0).get_rep (); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
421 audioplayer *player = &((audioplayer &)rep); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
422 player->stop (); |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
423 } |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
424 #else |
19537
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19535
diff
changeset
|
425 error ("portaudio not found on your system and thus audio functionality is not present"); |
19515
9d1917a61759
allow __player_audioplayer__ to build even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19513
diff
changeset
|
426 #endif |
19511
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
427 return retval; |
ec76e10c28de
concatenated audioplayer wrapper code
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
428 } |