Mercurial > octave
annotate libinterp/dldfcn/audiodevinfo.cc @ 19503: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 | ce02743b6f2a |
rev | line source |
---|---|
19500
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19498
diff
changeset
|
1 /* |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19498
diff
changeset
|
2 |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19498
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:
19498
diff
changeset
|
4 |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19498
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:
19498
diff
changeset
|
6 |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19498
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:
19498
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:
19498
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:
19498
diff
changeset
|
10 option) any later version. |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19498
diff
changeset
|
11 |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19498
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:
19498
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:
19498
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:
19498
diff
changeset
|
15 for more details. |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19498
diff
changeset
|
16 |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19498
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:
19498
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:
19498
diff
changeset
|
19 <http://www.gnu.org/licenses/>. |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19498
diff
changeset
|
20 |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19498
diff
changeset
|
21 */ |
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19498
diff
changeset
|
22 |
19501
1f551d169db2
Include config.h in audio project source files
Mike Miller <mtmiller@ieee.org>
parents:
19500
diff
changeset
|
23 #ifdef HAVE_CONFIG_H |
1f551d169db2
Include config.h in audio project source files
Mike Miller <mtmiller@ieee.org>
parents:
19500
diff
changeset
|
24 #include <config.h> |
1f551d169db2
Include config.h in audio project source files
Mike Miller <mtmiller@ieee.org>
parents:
19500
diff
changeset
|
25 #endif |
1f551d169db2
Include config.h in audio project source files
Mike Miller <mtmiller@ieee.org>
parents:
19500
diff
changeset
|
26 |
19472
c2031ad6dbe7
Fix octave header includes in audiodevinfo
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19469
diff
changeset
|
27 #include "oct.h" |
c2031ad6dbe7
Fix octave header includes in audiodevinfo
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19469
diff
changeset
|
28 #include "ov-struct.h" |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
29 #include <portaudio.h> |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
30 |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
31 PaSampleFormat |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
32 bits_to_format (int bits) |
19473
2e174b5e7703
Fix audiodevinfo, audioinfo, audioread and audiowrite build process
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19472
diff
changeset
|
33 { |
2e174b5e7703
Fix audiodevinfo, audioinfo, audioread and audiowrite build process
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19472
diff
changeset
|
34 if (bits == 8) |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
35 return paInt8; |
19473
2e174b5e7703
Fix audiodevinfo, audioinfo, audioread and audiowrite build process
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19472
diff
changeset
|
36 else if (bits == 16) |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
37 return paInt16; |
19473
2e174b5e7703
Fix audiodevinfo, audioinfo, audioread and audiowrite build process
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19472
diff
changeset
|
38 else if (bits == 24) |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
39 return paInt24; |
19473
2e174b5e7703
Fix audiodevinfo, audioinfo, audioread and audiowrite build process
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19472
diff
changeset
|
40 else if (bits == 32) |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
41 return paInt32; |
19473
2e174b5e7703
Fix audiodevinfo, audioinfo, audioread and audiowrite build process
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19472
diff
changeset
|
42 else if (bits == -1) |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
43 return paFloat32; |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
44 else |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
45 return 0; |
19473
2e174b5e7703
Fix audiodevinfo, audioinfo, audioread and audiowrite build process
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19472
diff
changeset
|
46 } |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
47 |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
48 DEFUN_DLD (audiodevinfo, args, , |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
49 "-*- texinfo -*-\n\ |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
50 @deftypefn{Loadable Function} @var{devinfo} = audiodevinfo\n\ |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
51 \n\ |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
52 Returns a structure with two fields called \"input\" and \"output\". \ |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
53 Each structure contains an array of structures with three fields called \ |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
54 \"Name\", \"DriverVersion\" and \"ID\". Each structure contains information \ |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
55 about a PortAudio device.\n\ |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
56 \n\ |
19498
0ac6a4e7369b
change docstrings in audio defundld cc files to work with new texinfo
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19483
diff
changeset
|
57 @end deftypefn\n\ |
0ac6a4e7369b
change docstrings in audio defundld cc files to work with new texinfo
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19483
diff
changeset
|
58 \n\ |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
59 @deftypefn{Loadable Function} @var{devs} = audiodevinfo (@var{IO})\n\ |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
60 \n\ |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
61 Returns the number of input or output devices available. Set @var{IO} to 1 \ |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
62 for input devices and to 0 for output devices.\n\ |
19498
0ac6a4e7369b
change docstrings in audio defundld cc files to work with new texinfo
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19483
diff
changeset
|
63 @end deftypefn\n\ |
0ac6a4e7369b
change docstrings in audio defundld cc files to work with new texinfo
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19483
diff
changeset
|
64 \n\ |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
65 @deftypefn{Loadable Function} @var{name} = audiodevinfo (@var{IO}, @var{ID})\n\ |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
66 \n\ |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
67 Returns the name of a device specified by numerical @var{ID}. Set @var{IO} \ |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
68 to 1 for input devices and to 0 for output devices.\n\ |
19498
0ac6a4e7369b
change docstrings in audio defundld cc files to work with new texinfo
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19483
diff
changeset
|
69 @end deftypefn\n\ |
0ac6a4e7369b
change docstrings in audio defundld cc files to work with new texinfo
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19483
diff
changeset
|
70 \n\ |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
71 @deftypefn{Loadable Function} @var{id} = audiodevinfo (@var{IO}, @var{name})\n\ |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
72 \n\ |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
73 Returns the id of a device specified by name. Set @var{IO} \ |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
74 to 1 for input devices and to 0 for output devices.\n\ |
19498
0ac6a4e7369b
change docstrings in audio defundld cc files to work with new texinfo
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19483
diff
changeset
|
75 @end deftypefn\n\ |
0ac6a4e7369b
change docstrings in audio defundld cc files to work with new texinfo
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19483
diff
changeset
|
76 \n\ |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
77 @deftypefn{Loadable Function} @var{id} = audiodevinfo (@var{IO}, @var{rate},\ |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
78 @var{bits}, @var{chans})\n\ |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
79 \n\ |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
80 Returns the id of the first device that supports playback or recording\ |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
81 using the specified sampling rate (@var{rate}), bits per sample (@var{bits})\ |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
82 and number of channels (@var{chans}). Set @var{IO} to 1 for input devices\ |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
83 ant to 0 for output devices.\ |
19498
0ac6a4e7369b
change docstrings in audio defundld cc files to work with new texinfo
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19483
diff
changeset
|
84 @end deftypefn\n\ |
0ac6a4e7369b
change docstrings in audio defundld cc files to work with new texinfo
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19483
diff
changeset
|
85 \n\ |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
86 @deftypefn{Loadable Function} @var{supports} = audiodevinfo (@var{IO}, @var{ID},\ |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
87 @var{rate}, @var{bits}, @var{chans})\n\ |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
88 \n\ |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
89 Returns 1 if the device bearing @var{ID} supports specified sampling rate\ |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
90 (@var{rate}), bits per sample (@var{bits}) and number of channels (@var{chans}).\ |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
91 Returns 0 otherwise. Set @var{IO} to 1 for input devices and to 0 for output\ |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
92 devices.\n\ |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
93 @end deftypefn") |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
94 { |
19483
abde714a4f88
let audiodevinfo be built even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19473
diff
changeset
|
95 octave_value retval; |
abde714a4f88
let audiodevinfo be built even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19473
diff
changeset
|
96 #ifdef HAVE_PORTAUDIO |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
97 int nargin = args.length (); |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
98 PaError err; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
99 octave_scalar_map devinfo; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
100 octave_value_list input; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
101 octave_value_list output; |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
102 |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
103 err = Pa_Initialize (); |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
104 if (err != paNoError) |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
105 { |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
106 error ("audiodevinfo: cannot initialize PortAudio"); |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
107 return retval; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
108 } |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
109 |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
110 int num_devices = Pa_GetDeviceCount (); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
111 if (num_devices < 0) |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
112 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
113 error ("audiodevinfo: no audio device found"); |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
114 return retval; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
115 } |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
116 |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
117 octave_idx_type numinput = 0, numoutput = 0; |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
118 for (int i = 0; i < num_devices; i++) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
119 { |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
120 const PaDeviceInfo *device_info = Pa_GetDeviceInfo (i); |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
121 if (device_info->maxInputChannels != 0) |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
122 numinput++; |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
123 if (device_info->maxOutputChannels != 0) |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
124 numoutput++; |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
125 } |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
126 |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
127 Cell input_name (dim_vector (1, numinput)); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
128 Cell input_driver_version (dim_vector (1, numinput)); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
129 Cell input_id (dim_vector (1, numinput)); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
130 Cell output_name (dim_vector (1, numoutput)); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
131 Cell output_driver_version (dim_vector (1, numoutput)); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
132 Cell output_id (dim_vector (1, numoutput)); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
133 |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
134 octave_idx_type idx_i = 0, idx_o = 0; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
135 for (int i = 0; i < num_devices; i++) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
136 { |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
137 const PaDeviceInfo *device_info = Pa_GetDeviceInfo (i); |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
138 const char *driver; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
139 char name[128]; |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
140 driver = Pa_GetHostApiInfo (device_info->hostApi)->name; |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
141 sprintf (name, "%s (%s)", device_info->name, driver); |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
142 |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
143 if (device_info->maxInputChannels != 0) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
144 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
145 input_name(idx_i) = name; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
146 input_driver_version(idx_i) = driver; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
147 input_id(idx_i) = i; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
148 idx_i++; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
149 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
150 |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
151 if (device_info->maxOutputChannels != 0) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
152 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
153 output_name(idx_o) = name; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
154 output_driver_version(idx_o) = driver; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
155 output_id(idx_o) = i; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
156 idx_o++; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
157 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
158 } |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
159 |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
160 octave_map inputdev, outputdev; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
161 inputdev.setfield ("Name", input_name); |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
162 inputdev.setfield ("DriverVersion", input_driver_version); |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
163 inputdev.setfield ("ID", input_id); |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
164 outputdev.setfield ("Name", output_name); |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
165 outputdev.setfield ("DriverVersion", output_driver_version); |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
166 outputdev.setfield ("ID", output_id); |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
167 devinfo.setfield ("input", inputdev); |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
168 devinfo.setfield ("output", outputdev); |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
169 |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
170 // Return information about input and output audio devices and |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
171 // their properties. |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
172 if (nargin == 0) |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
173 retval = devinfo; |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
174 // Return the number of input or output devices |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
175 else if (nargin == 1) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
176 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
177 if (args(0).int_value () == 0) |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
178 retval = octave_value (numoutput); |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
179 else if (args(0).int_value () == 1) |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
180 retval = octave_value (numinput); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
181 else |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
182 { |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
183 error ("audiodevinfo: please specify 0 for output and 1 for input devices"); |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
184 return retval; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
185 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
186 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
187 // Return device name when given id or id when given device name. |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
188 else if (nargin == 2) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
189 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
190 bool found = false; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
191 int outin = args(0).int_value (); |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
192 if (args(1).is_string ()) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
193 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
194 if (outin == 0) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
195 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
196 for (int i = 0; i < numoutput; i++) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
197 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
198 if (output_name(i).string_value () == args(1).string_value ()) |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
199 { |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
200 retval = output_id(i); |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
201 found = true; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
202 break; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
203 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
204 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
205 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
206 else if (outin == 1) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
207 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
208 for (int i = 0; i < numinput; i++) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
209 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
210 if (input_name(i).string_value () == args(1).string_value ()) |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
211 { |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
212 retval = input_id(i); |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
213 found = true; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
214 break; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
215 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
216 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
217 } |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
218 else |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
219 { |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
220 error ("audiodevinfo: please specify 0 for output and 1 for input devices"); |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
221 return retval; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
222 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
223 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
224 else |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
225 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
226 if (outin == 0) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
227 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
228 for (int i = 0; i < numoutput; i++) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
229 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
230 if (output_id(i).int_value () == args(1).int_value ()) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
231 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
232 retval = output_name(i); |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
233 found = true; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
234 break; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
235 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
236 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
237 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
238 else if (outin == 1) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
239 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
240 for (int i = 0; i < numinput; i++) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
241 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
242 if (input_id(i).int_value () == args(1).int_value ()) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
243 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
244 retval = input_name(i); |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
245 found = true; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
246 break; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
247 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
248 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
249 } |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
250 else |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
251 { |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
252 error ("audiodevinfo: please specify 0 for output and 1 for input devices"); |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
253 return retval; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
254 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
255 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
256 if (not found) |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
257 error ("audiodevinfo: no device meeting the specified criteria found"); |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
258 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
259 else if (nargin == 3) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
260 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
261 // |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
262 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
263 // Return the id of the first device meeting specified criteria. |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
264 else if (nargin == 4) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
265 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
266 int io = args(0).int_value (); |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
267 int rate = args(1).int_value (); |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
268 int bits = args(2).int_value (); |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
269 int chans = args(3).int_value (); |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
270 for (int i = 0; i < num_devices; i++) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
271 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
272 PaStreamParameters stream_parameters; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
273 stream_parameters.device = i; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
274 stream_parameters.channelCount = chans; |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
275 PaSampleFormat format = bits_to_format (bits); |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
276 if (format != 0) |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
277 stream_parameters.sampleFormat = format; |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
278 else |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
279 { |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
280 error ("audiodevinfo: no such bits per sample format"); |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
281 return retval; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
282 } |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
283 stream_parameters.suggestedLatency = |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
284 Pa_GetDeviceInfo (i)->defaultLowInputLatency; |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
285 stream_parameters.hostApiSpecificStreamInfo = NULL; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
286 if (io == 0) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
287 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
288 if (Pa_GetDeviceInfo (i)->maxOutputChannels < chans) |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
289 continue; |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
290 |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
291 err = Pa_IsFormatSupported (NULL, &stream_parameters, rate); |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
292 if (err == paFormatIsSupported) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
293 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
294 retval = i; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
295 return retval; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
296 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
297 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
298 else if (io == 1) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
299 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
300 if (Pa_GetDeviceInfo (i)->maxInputChannels < chans) |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
301 continue; |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
302 |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
303 err = Pa_IsFormatSupported (&stream_parameters, NULL, rate); |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
304 if (err == paFormatIsSupported) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
305 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
306 retval = i; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
307 return retval; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
308 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
309 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
310 } |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
311 retval = -1; |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
312 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
313 // Check if given device supports specified playback or recording modes. |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
314 else if (nargin == 5) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
315 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
316 int io = args(0).int_value (); |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
317 int id = args(1).int_value (); |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
318 int rate = args(2).int_value (); |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
319 int bits = args(3).int_value (); |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
320 int chans = args(4).int_value (); |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
321 PaStreamParameters stream_parameters; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
322 stream_parameters.device = id; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
323 stream_parameters.channelCount = chans; |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
324 PaSampleFormat format = bits_to_format (bits); |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
325 if (format != 0) |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
326 stream_parameters.sampleFormat = format; |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
327 else |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
328 { |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
329 error ("audiodevinfo: no such bits per sample format"); |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
330 return retval; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
331 } |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
332 stream_parameters.suggestedLatency = |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
333 Pa_GetDeviceInfo (id)->defaultLowInputLatency; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
334 stream_parameters.hostApiSpecificStreamInfo = NULL; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
335 if (io == 0) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
336 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
337 if (Pa_GetDeviceInfo (id)->maxOutputChannels < chans) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
338 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
339 retval = 0; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
340 return retval; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
341 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
342 err = Pa_IsFormatSupported (NULL, &stream_parameters, rate); |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
343 if (err == paFormatIsSupported) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
344 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
345 retval = 1; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
346 return retval; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
347 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
348 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
349 else if (io == 1) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
350 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
351 if (Pa_GetDeviceInfo (id)->maxInputChannels < chans) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
352 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
353 retval = 0; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
354 return retval; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
355 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
356 err = Pa_IsFormatSupported (&stream_parameters, NULL, rate); |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
357 if (err == paFormatIsSupported) |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
358 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
359 retval = 1; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
360 return retval; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
361 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
362 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
363 else |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
364 { |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
365 error ("audiodevinfo: please specify 0 for output and 1 for input devices"); |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
366 return retval; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
367 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
368 retval = 0; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
369 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
370 else |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
371 { |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
372 error ("audiodevinfo: wrong number of arguments"); |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
373 return retval; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
374 } |
19483
abde714a4f88
let audiodevinfo be built even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19473
diff
changeset
|
375 #else |
abde714a4f88
let audiodevinfo be built even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19473
diff
changeset
|
376 error ("portaudio not found on your system and thus audio functionality is not present"); |
abde714a4f88
let audiodevinfo be built even when PortAudio is not present
Vytautas Jančauskas <unaudio@gmail.com>
parents:
19473
diff
changeset
|
377 #endif |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
378 return retval; |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
379 } |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
380 |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
381 /* |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
382 %!test |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
383 %! devinfo = audiodevinfo; |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
384 %! assert(rows(devinfo.('input')) == 1); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
385 %! assert(rows(devinfo.('output')) == 1); |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
386 |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
387 %!test |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
388 %! devinfo = audiodevinfo; |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
389 %! nout = audiodevinfo(0); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
390 %! nin = audiodevinfo(1); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
391 %! assert(columns(devinfo.('output')) == nout); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
392 %! assert(columns(devinfo.('input')) == nin); |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
393 |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
394 %!test |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
395 %! devinfo = audiodevinfo; |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
396 %! nout = audiodevinfo(0); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
397 %! nin = audiodevinfo(1); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
398 %! for i=1:nout, |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
399 %! assert(devinfo.('output')(i).('Name') == audiodevinfo(0, devinfo.('output')(i).('ID'))) |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
400 %! end |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
401 %! for i=1:nin, |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
402 %! assert(devinfo.('input')(i).('Name') == audiodevinfo(0, devinfo.('input')(i).('ID'))) |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
403 %! end |
19469
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
404 |
ea5c156aa804
audiodevinfo.cc: new file
Vytautas Jančauskas <unaudio@gmail.com>
parents:
diff
changeset
|
405 %!test |
19503
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
406 %! devinfo = audiodevinfo; |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
407 %! nout = audiodevinfo(0); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
408 %! nin = audiodevinfo(1); |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
409 %! for i=1:nout, |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
410 %! assert(devinfo.('output')(i).('ID') == audiodevinfo(0, devinfo.('output')(i).('Name'))) |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
411 %! end |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
412 %! for i=1:nin, |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
413 %! assert(devinfo.('input')(i).('ID') == audiodevinfo(0, devinfo.('input')(i).('Name'))) |
36a26a131209
Apply Octave coding style to audio project additions
Mike Miller <mtmiller@ieee.org>
parents:
19501
diff
changeset
|
414 %! end |
19500
8bb399569393
Add Octave copyright header block to audio project files
Mike Miller <mtmiller@ieee.org>
parents:
19498
diff
changeset
|
415 */ |