Mercurial > octave-nkf
comparison libinterp/dldfcn/__recorder_audiorecorder__.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 |
comparison
equal
deleted
inserted
replaced
19536:97c9ba013ed1 | 19537:36a26a131209 |
---|---|
29 | 29 |
30 #ifdef HAVE_PORTAUDIO | 30 #ifdef HAVE_PORTAUDIO |
31 #include "player_class.cc" | 31 #include "player_class.cc" |
32 #include "recorder_class.cc" | 32 #include "recorder_class.cc" |
33 #endif | 33 #endif |
34 | 34 |
35 DEFUN_DLD(__recorder_audiorecorder__, args, , | 35 DEFUN_DLD (__recorder_audiorecorder__, args, , |
36 "__recorder_audiorecorder__" | 36 "__recorder_audiorecorder__") |
37 ) | |
38 { | 37 { |
39 #ifdef HAVE_PORTAUDIO | 38 #ifdef HAVE_PORTAUDIO |
40 int nargin = args.length (); | 39 int nargin = args.length (); |
41 audiorecorder* retval = new audiorecorder (); | 40 audiorecorder* retval = new audiorecorder (); |
42 int offset = 0; | 41 int offset = 0; |
43 if (nargin > 0) | 42 if (nargin > 0) |
44 { | 43 { |
45 bool is_function = args(0).is_string () || args(0).is_function_handle () || args(0).is_inline_function (); | 44 bool is_function = args(0).is_string () || args(0).is_function_handle () || args(0).is_inline_function (); |
46 if (is_function) | 45 if (is_function) |
47 { | 46 { |
48 retval->octave_callback_function = args (0).function_value (); | 47 retval->octave_callback_function = args(0).function_value (); |
49 offset = 1; | 48 offset = 1; |
50 } | 49 } |
51 } | 50 } |
52 switch (nargin - offset) | 51 switch (nargin - offset) |
53 { | 52 { |
61 retval->set_nbits (args(1 + offset).int_value ()); | 60 retval->set_nbits (args(1 + offset).int_value ()); |
62 retval->set_channels (args(2 + offset).int_value ()); | 61 retval->set_channels (args(2 + offset).int_value ()); |
63 retval->set_id (args(3 + offset).int_value ()); | 62 retval->set_id (args(3 + offset).int_value ()); |
64 break; | 63 break; |
65 } | 64 } |
66 retval->init(); | 65 retval->init (); |
67 return octave_value(retval); | 66 return octave_value (retval); |
68 #else | 67 #else |
69 octave_value retval; | 68 octave_value retval; |
70 error ("portaudio not found on your system and thus audio functionality is not present"); | 69 error ("portaudio not found on your system and thus audio functionality is not present"); |
71 return retval; | 70 return retval; |
72 #endif | 71 #endif |
73 } | 72 } |
74 | 73 |
75 DEFUN_DLD(__recorder_getaudiodata__, args, , | 74 DEFUN_DLD (__recorder_getaudiodata__, args, , |
76 "__recorder_getaudiodata__" | 75 "__recorder_getaudiodata__") |
77 ) | 76 { |
78 { | 77 octave_value retval; |
79 octave_value retval; | 78 #ifdef HAVE_PORTAUDIO |
80 #ifdef HAVE_PORTAUDIO | 79 const octave_base_value& rep = args(0).get_rep (); |
81 audiorecorder* recorder = 0; | 80 audiorecorder *recorder = &((audiorecorder &)rep); |
82 const octave_base_value& rep = args (0).get_rep (); | |
83 recorder = &((audiorecorder &)rep); | |
84 retval = octave_value (recorder->getaudiodata ()); | 81 retval = octave_value (recorder->getaudiodata ()); |
85 #else | 82 #else |
86 error ("portaudio not found on your system and thus audio functionality is not present"); | 83 error ("portaudio not found on your system and thus audio functionality is not present"); |
87 #endif | 84 #endif |
88 return retval; | 85 return retval; |
89 } | 86 } |
90 | 87 |
91 DEFUN_DLD(__recorder_get_channels__, args, , | 88 DEFUN_DLD (__recorder_get_channels__, args, , |
92 "__recorder_get_channels__" | 89 "__recorder_get_channels__") |
93 ) | 90 { |
94 { | 91 octave_value retval; |
95 octave_value retval; | 92 #ifdef HAVE_PORTAUDIO |
96 #ifdef HAVE_PORTAUDIO | 93 int nargin = args.length (); |
97 int nargin = args.length (); | 94 if (nargin == 1) |
98 if (nargin == 1) | 95 { |
99 { | 96 const octave_base_value& rep = args(0).get_rep (); |
100 audiorecorder* recorder = 0; | 97 audiorecorder *recorder = &((audiorecorder &)rep); |
101 const octave_base_value& rep = args (0).get_rep (); | 98 retval = octave_value (recorder->get_channels ()); |
102 recorder = &((audiorecorder &)rep); | 99 } |
103 retval = octave_value(recorder->get_channels()); | 100 #else |
104 } | 101 error ("portaudio not found on your system and thus audio functionality is not present"); |
105 #else | 102 #endif |
106 error ("portaudio not found on your system and thus audio functionality is not present"); | 103 return retval; |
107 #endif | 104 } |
108 return retval; | 105 |
109 } | 106 DEFUN_DLD (__recorder_get_fs__, args, , |
110 | 107 "__recorder_get_fs__") |
111 DEFUN_DLD(__recorder_get_fs__, args, , | 108 { |
112 "__recorder_get_fs__" | 109 octave_value retval; |
113 ) | 110 #ifdef HAVE_PORTAUDIO |
114 { | 111 int nargin = args.length (); |
115 octave_value retval; | 112 if (nargin == 1) |
116 #ifdef HAVE_PORTAUDIO | 113 { |
117 int nargin = args.length (); | 114 const octave_base_value& rep = args(0).get_rep (); |
118 if (nargin == 1) | 115 audiorecorder *recorder = &((audiorecorder &)rep); |
119 { | 116 retval = octave_value (recorder->get_fs ()); |
120 audiorecorder* recorder = 0; | 117 } |
121 const octave_base_value& rep = args (0).get_rep (); | 118 #else |
122 recorder = &((audiorecorder &)rep); | 119 error ("portaudio not found on your system and thus audio functionality is not present"); |
123 retval = octave_value(recorder->get_fs()); | 120 #endif |
124 } | 121 return retval; |
125 #else | 122 } |
126 error ("portaudio not found on your system and thus audio functionality is not present"); | 123 |
127 #endif | 124 DEFUN_DLD (__recorder_get_id__, args, , |
128 return retval; | 125 "__recorder_get_id__") |
129 } | 126 { |
130 | 127 octave_value retval; |
131 DEFUN_DLD(__recorder_get_id__, args, , | 128 #ifdef HAVE_PORTAUDIO |
132 "__recorder_get_id__" | 129 int nargin = args.length (); |
133 ) | 130 if (nargin == 1) |
134 { | 131 { |
135 octave_value retval; | 132 const octave_base_value& rep = args(0).get_rep (); |
136 #ifdef HAVE_PORTAUDIO | 133 audiorecorder *recorder = &((audiorecorder &)rep); |
137 int nargin = args.length (); | 134 retval = octave_value (recorder->get_id ()); |
138 if (nargin == 1) | 135 } |
139 { | 136 #else |
140 audiorecorder* recorder = 0; | 137 error ("portaudio not found on your system and thus audio functionality is not present"); |
141 const octave_base_value& rep = args (0).get_rep (); | 138 #endif |
142 recorder = &((audiorecorder &)rep); | 139 return retval; |
143 retval = octave_value(recorder->get_id()); | 140 } |
144 } | 141 |
145 #else | 142 DEFUN_DLD (__recorder_get_nbits__, args, , |
146 error ("portaudio not found on your system and thus audio functionality is not present"); | 143 "__recorder_get_nbits__") |
147 #endif | 144 { |
148 return retval; | 145 octave_value retval; |
149 } | 146 #ifdef HAVE_PORTAUDIO |
150 | 147 int nargin = args.length (); |
151 DEFUN_DLD(__recorder_get_nbits__, args, , | 148 if (nargin == 1) |
152 "__recorder_get_nbits__" | 149 { |
153 ) | 150 const octave_base_value& rep = args(0).get_rep (); |
154 { | 151 audiorecorder *recorder = &((audiorecorder &)rep); |
155 octave_value retval; | 152 retval = octave_value (recorder->get_nbits ()); |
156 #ifdef HAVE_PORTAUDIO | 153 } |
157 int nargin = args.length (); | 154 #else |
158 if (nargin == 1) | 155 error ("portaudio not found on your system and thus audio functionality is not present"); |
159 { | 156 #endif |
160 audiorecorder* recorder = 0; | 157 return retval; |
161 const octave_base_value& rep = args (0).get_rep (); | 158 } |
162 recorder = &((audiorecorder &)rep); | 159 |
163 retval = octave_value(recorder->get_nbits ()); | 160 DEFUN_DLD (__recorder_get_sample_number__, args, , |
164 } | 161 "__recorder_get_sample_number__") |
165 #else | 162 { |
166 error ("portaudio not found on your system and thus audio functionality is not present"); | 163 octave_value retval; |
167 #endif | 164 #ifdef HAVE_PORTAUDIO |
168 return retval; | 165 int nargin = args.length (); |
169 } | 166 if (nargin == 1) |
170 | 167 { |
171 DEFUN_DLD(__recorder_get_sample_number__, args, , | 168 const octave_base_value& rep = args(0).get_rep (); |
172 "__recorder_get_sample_number__" | 169 audiorecorder *recorder = &((audiorecorder &)rep); |
173 ) | 170 retval = octave_value (recorder->get_sample_number ()); |
174 { | 171 } |
175 octave_value retval; | 172 #else |
176 #ifdef HAVE_PORTAUDIO | 173 error ("portaudio not found on your system and thus audio functionality is not present"); |
177 int nargin = args.length (); | 174 #endif |
178 if (nargin == 1) | 175 return retval; |
179 { | 176 } |
180 audiorecorder* recorder = 0; | 177 |
181 const octave_base_value& rep = args (0).get_rep (); | 178 DEFUN_DLD (__recorder_get_tag__, args, , |
182 recorder = &((audiorecorder &)rep); | 179 "__recorder_get_tag__") |
183 retval = octave_value(recorder->get_sample_number()); | 180 { |
184 } | 181 octave_value retval; |
185 #else | 182 #ifdef HAVE_PORTAUDIO |
186 error ("portaudio not found on your system and thus audio functionality is not present"); | 183 int nargin = args.length (); |
187 #endif | 184 if (nargin == 1) |
188 return retval; | 185 { |
189 } | 186 const octave_base_value& rep = args(0).get_rep (); |
190 | 187 audiorecorder *recorder = &((audiorecorder &)rep); |
191 DEFUN_DLD(__recorder_get_tag__, args, , | |
192 "__recorder_get_tag__" | |
193 ) | |
194 { | |
195 octave_value retval; | |
196 #ifdef HAVE_PORTAUDIO | |
197 int nargin = args.length (); | |
198 if (nargin == 1) | |
199 { | |
200 audiorecorder* recorder = 0; | |
201 const octave_base_value& rep = args (0).get_rep (); | |
202 recorder = &((audiorecorder &)rep); | |
203 retval = octave_value (recorder->get_tag ()); | 188 retval = octave_value (recorder->get_tag ()); |
204 } | 189 } |
205 #else | 190 #else |
206 error ("portaudio not found on your system and thus audio functionality is not present"); | 191 error ("portaudio not found on your system and thus audio functionality is not present"); |
207 #endif | 192 #endif |
208 return retval; | 193 return retval; |
209 } | 194 } |
210 | 195 |
211 DEFUN_DLD(__recorder_get_total_samples__, args, , | 196 DEFUN_DLD (__recorder_get_total_samples__, args, , |
212 "__recorder_get_total_samples__" | 197 "__recorder_get_total_samples__") |
213 ) | 198 { |
214 { | 199 octave_value retval; |
215 octave_value retval; | 200 #ifdef HAVE_PORTAUDIO |
216 #ifdef HAVE_PORTAUDIO | 201 int nargin = args.length (); |
217 int nargin = args.length (); | 202 if (nargin == 1) |
218 if (nargin == 1) | 203 { |
219 { | 204 const octave_base_value& rep = args(0).get_rep (); |
220 audiorecorder* recorder = 0; | 205 audiorecorder *recorder = &((audiorecorder &)rep); |
221 const octave_base_value& rep = args (0).get_rep (); | 206 retval = octave_value (recorder->get_total_samples ()); |
222 recorder = &((audiorecorder &)rep); | 207 } |
223 retval = octave_value(recorder->get_total_samples()); | 208 #else |
224 } | 209 error ("portaudio not found on your system and thus audio functionality is not present"); |
225 #else | 210 #endif |
226 error ("portaudio not found on your system and thus audio functionality is not present"); | 211 return retval; |
227 #endif | 212 } |
228 return retval; | 213 |
229 } | 214 DEFUN_DLD (__recorder_get_userdata__, args, , |
230 | 215 "__recorder_get_userdata__") |
231 DEFUN_DLD(__recorder_get_userdata__, args, , | 216 { |
232 "__recorder_get_userdata__" | 217 octave_value retval; |
233 ) | 218 #ifdef HAVE_PORTAUDIO |
234 { | 219 int nargin = args.length (); |
235 octave_value retval; | 220 if (nargin == 1) |
236 #ifdef HAVE_PORTAUDIO | 221 { |
237 int nargin = args.length (); | 222 const octave_base_value& rep = args(0).get_rep (); |
238 if (nargin == 1) | 223 audiorecorder *recorder = &((audiorecorder &)rep); |
239 { | |
240 audiorecorder* recorder = 0; | |
241 const octave_base_value& rep = args (0).get_rep (); | |
242 recorder = &((audiorecorder &)rep); | |
243 retval = recorder->get_userdata (); | 224 retval = recorder->get_userdata (); |
244 } | 225 } |
245 #else | 226 #else |
246 error ("portaudio not found on your system and thus audio functionality is not present"); | 227 error ("portaudio not found on your system and thus audio functionality is not present"); |
247 #endif | 228 #endif |
248 return retval; | 229 return retval; |
249 } | 230 } |
250 | 231 |
251 DEFUN_DLD(__recorder_isrecording__, args, , | 232 DEFUN_DLD (__recorder_isrecording__, args, , |
252 "__recorder_isrecording__" | 233 "__recorder_isrecording__") |
253 ) | 234 { |
254 { | 235 octave_value retval; |
255 octave_value retval; | 236 #ifdef HAVE_PORTAUDIO |
256 #ifdef HAVE_PORTAUDIO | 237 int nargin = args.length (); |
257 int nargin = args.length (); | 238 if (nargin == 1) |
258 if (nargin == 1) | 239 { |
259 { | 240 const octave_base_value& rep = args(0).get_rep (); |
260 audiorecorder* recorder = 0; | 241 audiorecorder *recorder = &((audiorecorder &)rep); |
261 const octave_base_value& rep = args (0).get_rep (); | 242 if (recorder->isrecording ()) |
262 recorder = &((audiorecorder &)rep); | 243 return octave_value (1); |
263 if (recorder->isrecording()) | |
264 { | |
265 return octave_value(1); | |
266 } | |
267 else | 244 else |
268 { | 245 return octave_value (0); |
269 return octave_value(0); | 246 } |
270 } | 247 #else |
271 } | 248 error ("portaudio not found on your system and thus audio functionality is not present"); |
272 #else | 249 #endif |
273 error ("portaudio not found on your system and thus audio functionality is not present"); | 250 return retval; |
274 #endif | 251 } |
275 return retval; | 252 |
276 } | 253 DEFUN_DLD (__recorder_pause__, args, , |
277 | 254 "__recorder_pause__") |
278 DEFUN_DLD(__recorder_pause__, args, , | 255 { |
279 "__recorder_pause__" | 256 octave_value retval; |
280 ) | 257 #ifdef HAVE_PORTAUDIO |
281 { | 258 int nargin = args.length (); |
282 octave_value retval; | 259 if (nargin == 1) |
283 #ifdef HAVE_PORTAUDIO | 260 { |
284 int nargin = args.length (); | 261 const octave_base_value& rep = args(0).get_rep (); |
285 if (nargin == 1) | 262 audiorecorder *recorder = &((audiorecorder &)rep); |
286 { | 263 recorder->pause (); |
287 audiorecorder* recorder = 0; | 264 } |
288 const octave_base_value& rep = args (0).get_rep (); | 265 #else |
289 recorder = &((audiorecorder &)rep); | 266 error ("portaudio not found on your system and thus audio functionality is not present"); |
290 recorder->pause(); | 267 #endif |
291 } | 268 return retval; |
292 #else | 269 } |
293 error ("portaudio not found on your system and thus audio functionality is not present"); | 270 |
294 #endif | 271 DEFUN_DLD (__recorder_recordblocking__, args, , |
295 return retval; | 272 "__recorder_recordblocking__") |
296 } | 273 { |
297 | 274 octave_value retval; |
298 DEFUN_DLD(__recorder_recordblocking__, args, , | 275 #ifdef HAVE_PORTAUDIO |
299 "__recorder_recordblocking__" | 276 const octave_base_value& rep = args(0).get_rep (); |
300 ) | 277 audiorecorder *recorder = &((audiorecorder &)rep); |
301 { | 278 recorder->recordblocking (args(1).float_value ()); |
302 octave_value retval; | 279 #else |
303 #ifdef HAVE_PORTAUDIO | 280 error ("portaudio not found on your system and thus audio functionality is not present"); |
304 audiorecorder* recorder = 0; | 281 #endif |
305 const octave_base_value& rep = args (0).get_rep (); | 282 return retval; |
306 recorder = &((audiorecorder &)rep); | 283 } |
307 recorder->recordblocking (args (1).float_value ()); | 284 |
308 #else | 285 DEFUN_DLD (__recorder_record__, args, , |
309 error ("portaudio not found on your system and thus audio functionality is not present"); | 286 "__recorder_record__") |
310 #endif | 287 { |
311 return retval; | 288 octave_value retval; |
312 } | 289 #ifdef HAVE_PORTAUDIO |
313 | 290 const octave_base_value& rep = args(0).get_rep (); |
314 DEFUN_DLD(__recorder_record__, args, , | 291 audiorecorder *recorder = &((audiorecorder &)rep); |
315 "__recorder_record__" | |
316 ) | |
317 { | |
318 octave_value retval; | |
319 #ifdef HAVE_PORTAUDIO | |
320 audiorecorder* recorder = 0; | |
321 const octave_base_value& rep = args (0).get_rep (); | |
322 recorder = &((audiorecorder &)rep); | |
323 if (args.length () == 1) | 292 if (args.length () == 1) |
324 { | 293 { |
325 recorder->record (); | 294 recorder->record (); |
326 } | 295 } |
327 else if (args.length () == 2) | 296 else if (args.length () == 2) |
328 { | 297 { |
329 recorder->set_end_sample (args (1).int_value () * recorder->get_fs ()); | 298 recorder->set_end_sample (args(1).int_value () * recorder->get_fs ()); |
330 recorder->record (); | 299 recorder->record (); |
331 } | 300 } |
332 else | 301 else |
333 { | 302 { |
334 error ("audiorecorder: wrong number of arguments passed to record"); | 303 error ("audiorecorder: wrong number of arguments passed to record"); |
337 error ("portaudio not found on your system and thus audio functionality is not present"); | 306 error ("portaudio not found on your system and thus audio functionality is not present"); |
338 #endif | 307 #endif |
339 return retval; | 308 return retval; |
340 } | 309 } |
341 | 310 |
342 DEFUN_DLD(__recorder_resume__, args, , | 311 DEFUN_DLD (__recorder_resume__, args, , |
343 "__recorder_resume__" | 312 "__recorder_resume__") |
344 ) | 313 { |
345 { | 314 octave_value retval; |
346 octave_value retval; | 315 #ifdef HAVE_PORTAUDIO |
347 #ifdef HAVE_PORTAUDIO | 316 int nargin = args.length (); |
348 int nargin = args.length (); | 317 if (nargin == 1) |
349 if (nargin == 1) | 318 { |
350 { | 319 const octave_base_value& rep = args(0).get_rep (); |
351 audiorecorder* recorder = 0; | 320 audiorecorder *recorder = &((audiorecorder &)rep); |
352 const octave_base_value& rep = args (0).get_rep (); | 321 recorder->resume (); |
353 recorder = &((audiorecorder &)rep); | 322 } |
354 recorder->resume(); | 323 #else |
355 } | 324 error ("portaudio not found on your system and thus audio functionality is not present"); |
356 #else | 325 #endif |
357 error ("portaudio not found on your system and thus audio functionality is not present"); | 326 return retval; |
358 #endif | 327 } |
359 return retval; | 328 |
360 } | 329 DEFUN_DLD (__recorder_set_fs__, args, , |
361 | 330 "__recorder_set_fs__") |
362 DEFUN_DLD(__recorder_set_fs__, args, , | |
363 "__recorder_set_fs__" | |
364 ) | |
365 { | 331 { |
366 octave_value retval; | 332 octave_value retval; |
367 #ifdef HAVE_PORTAUDIO | 333 #ifdef HAVE_PORTAUDIO |
368 int nargin = args.length (); | 334 int nargin = args.length (); |
369 if (nargin == 2) | 335 if (nargin == 2) |
370 { | 336 { |
371 audiorecorder* recorder = 0; | 337 const octave_base_value& rep = args(0).get_rep (); |
372 const octave_base_value& rep = args (0).get_rep (); | 338 audiorecorder *recorder = &((audiorecorder &)rep); |
373 recorder = &((audiorecorder &)rep); | 339 recorder->set_fs (args(1).int_value ()); |
374 recorder->set_fs (args (1).int_value()); | 340 } |
375 } | 341 #else |
376 #else | 342 error ("portaudio not found on your system and thus audio functionality is not present"); |
377 error ("portaudio not found on your system and thus audio functionality is not present"); | 343 #endif |
378 #endif | 344 return retval; |
379 return retval; | 345 } |
380 } | 346 |
381 | 347 DEFUN_DLD (__recorder_set_tag__, args, , |
382 DEFUN_DLD(__recorder_set_tag__, args, , | 348 "__recorder_set_tag__") |
383 "__recorder_set_tag__" | |
384 ) | |
385 { | 349 { |
386 octave_value retval; | 350 octave_value retval; |
387 #ifdef HAVE_PORTAUDIO | 351 #ifdef HAVE_PORTAUDIO |
388 int nargin = args.length (); | 352 int nargin = args.length (); |
389 if (nargin == 2) | 353 if (nargin == 2) |
390 { | 354 { |
391 audiorecorder* recorder = 0; | 355 const octave_base_value& rep = args(0).get_rep (); |
392 const octave_base_value& rep = args (0).get_rep (); | 356 audiorecorder *recorder = &((audiorecorder &)rep); |
393 recorder = &((audiorecorder &)rep); | |
394 recorder->set_tag (args(1).char_matrix_value ()); | 357 recorder->set_tag (args(1).char_matrix_value ()); |
395 } | 358 } |
396 #else | 359 #else |
397 error ("portaudio not found on your system and thus audio functionality is not present"); | 360 error ("portaudio not found on your system and thus audio functionality is not present"); |
398 #endif | 361 #endif |
399 return retval; | 362 return retval; |
400 } | 363 } |
401 | 364 |
402 DEFUN_DLD(__recorder_set_userdata__, args, , | 365 DEFUN_DLD (__recorder_set_userdata__, args, , |
403 "__recorder_set_userdata__" | 366 "__recorder_set_userdata__") |
404 ) | |
405 { | 367 { |
406 octave_value retval; | 368 octave_value retval; |
407 #ifdef HAVE_PORTAUDIO | 369 #ifdef HAVE_PORTAUDIO |
408 int nargin = args.length (); | 370 int nargin = args.length (); |
409 if (nargin == 2) | 371 if (nargin == 2) |
410 { | 372 { |
411 audiorecorder* recorder = 0; | 373 const octave_base_value& rep = args(0).get_rep (); |
412 const octave_base_value& rep = args (0).get_rep (); | 374 audiorecorder *recorder = &((audiorecorder &)rep); |
413 recorder = &((audiorecorder &)rep); | |
414 recorder->set_userdata (args(1)); | 375 recorder->set_userdata (args(1)); |
415 } | 376 } |
416 #else | 377 #else |
417 error ("portaudio not found on your system and thus audio functionality is not present"); | 378 error ("portaudio not found on your system and thus audio functionality is not present"); |
418 #endif | 379 #endif |
419 return retval; | 380 return retval; |
420 } | 381 } |
421 | 382 |
422 DEFUN_DLD(__recorder_stop__, args, , | 383 DEFUN_DLD (__recorder_stop__, args, , |
423 "__recorder_stop__" | 384 "__recorder_stop__") |
424 ) | 385 { |
425 { | 386 octave_value retval; |
426 octave_value retval; | 387 #ifdef HAVE_PORTAUDIO |
427 #ifdef HAVE_PORTAUDIO | 388 const octave_base_value& rep = args(0).get_rep (); |
428 audiorecorder* recorder = 0; | 389 audiorecorder *recorder = &((audiorecorder &)rep); |
429 const octave_base_value& rep = args (0).get_rep (); | 390 recorder->stop (); |
430 recorder = &((audiorecorder &)rep); | 391 #else |
431 recorder->stop(); | 392 error ("portaudio not found on your system and thus audio functionality is not present"); |
432 #else | 393 #endif |
433 error ("portaudio not found on your system and thus audio functionality is not present"); | 394 return retval; |
434 #endif | 395 } |
435 return retval; | |
436 } |