source: portaudio/branches/V18.1/docs/pa_tut_devs.html @ 168

Revision 168, 2.6 KB checked in by philburk, 8 years ago (diff)

Documents should be in CVS to simplify release.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
2<html>
3<head>
4   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
5   <meta name="GENERATOR" content="Mozilla/4.75 [en]C-gatewaynet  (Win98; U) [Netscape]">
6   <meta name="Author" content="Phil Burk">
7   <meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
8   <meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
9   <title>PortAudio Tutorial</title>
10</head>
11<body>
12&nbsp;
13<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
14<tr>
15<td>
16<center>
17<h1>
18PortAudio Tutorial</h1></center>
19</td>
20</tr>
21</table></center>
22
23<h2>
24Querying for Available Devices</h2>
25
26<blockquote>There are often several different audio devices available in
27a computer with different capabilities. They can differ in the sample rates
28supported, bit widths, etc. PortAudio provides a simple way to query for
29the available devices, and then pass the selected device to Pa_OpenStream().
30For an example, see the file "pa_tests/pa_devs.c".
31<p>To determine the number of devices:
32<blockquote>
33<pre>numDevices = Pa_CountDevices();</pre>
34</blockquote>
35You can then query each device in turn by calling Pa_GetDeviceInfo() with
36an index.
37<blockquote>
38<pre>for( i=0; i&lt;numDevices; i++ ) {
39&nbsp;&nbsp;&nbsp;&nbsp; pdi = Pa_GetDeviceInfo( i );</pre>
40</blockquote>
41It will return a pointer to a <tt>PaDeviceInfo</tt> structure which is
42defined as:
43<blockquote>
44<pre>typedef struct{
45&nbsp;&nbsp;&nbsp; int structVersion;&nbsp;
46&nbsp;&nbsp;&nbsp; const char *name;
47&nbsp;&nbsp;&nbsp; int maxInputChannels;
48&nbsp;&nbsp;&nbsp; int maxOutputChannels;
49/* Number of discrete rates, or -1 if range supported. */
50&nbsp;&nbsp;&nbsp; int numSampleRates;
51/* Array of supported sample rates, or {min,max} if range supported. */
52&nbsp;&nbsp;&nbsp; const double *sampleRates;
53&nbsp;&nbsp;&nbsp; PaSampleFormat nativeSampleFormat;
54}PaDeviceInfo;</pre>
55</blockquote>
56If the device supports a continuous range of sample rates, then numSampleRates
57will equal -1, and the sampleRates array will have two values, the minimum&nbsp;
58and maximum rate.
59<p>The device information is allocated by Pa_Initialize() and freed by
60Pa_Terminate() so you do not have to free() the structure returned by Pa_GetDeviceInfo().</blockquote>
61<font size=+2><a href="http://www.portaudio.com/">home</a> |
62<a href="pa_tutorial.html">contents</a>
63| <a href="pa_tut_util.html">previous</a> |&nbsp; <a href="pa_tut_rw.html">next</a></font>
64</body>
65</html>
Note: See TracBrowser for help on using the repository browser.