mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-30 08:08:39 -05:00
66 lines
2.6 KiB
HTML
66 lines
2.6 KiB
HTML
|
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||
|
<meta name="GENERATOR" content="Mozilla/4.75 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||
|
<meta name="Author" content="Phil Burk">
|
||
|
<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.">
|
||
|
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||
|
<title>PortAudio Tutorial</title>
|
||
|
</head>
|
||
|
<body>
|
||
|
|
||
|
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||
|
<tr>
|
||
|
<td>
|
||
|
<center>
|
||
|
<h1>
|
||
|
PortAudio Tutorial</h1></center>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table></center>
|
||
|
|
||
|
<h2>
|
||
|
Querying for Available Devices</h2>
|
||
|
|
||
|
<blockquote>There are often several different audio devices available in
|
||
|
a computer with different capabilities. They can differ in the sample rates
|
||
|
supported, bit widths, etc. PortAudio provides a simple way to query for
|
||
|
the available devices, and then pass the selected device to Pa_OpenStream().
|
||
|
For an example, see the file "pa_tests/pa_devs.c".
|
||
|
<p>To determine the number of devices:
|
||
|
<blockquote>
|
||
|
<pre>numDevices = Pa_CountDevices();</pre>
|
||
|
</blockquote>
|
||
|
You can then query each device in turn by calling Pa_GetDeviceInfo() with
|
||
|
an index.
|
||
|
<blockquote>
|
||
|
<pre>for( i=0; i<numDevices; i++ ) {
|
||
|
pdi = Pa_GetDeviceInfo( i );</pre>
|
||
|
</blockquote>
|
||
|
It will return a pointer to a <tt>PaDeviceInfo</tt> structure which is
|
||
|
defined as:
|
||
|
<blockquote>
|
||
|
<pre>typedef struct{
|
||
|
int structVersion;
|
||
|
const char *name;
|
||
|
int maxInputChannels;
|
||
|
int maxOutputChannels;
|
||
|
/* Number of discrete rates, or -1 if range supported. */
|
||
|
int numSampleRates;
|
||
|
/* Array of supported sample rates, or {min,max} if range supported. */
|
||
|
const double *sampleRates;
|
||
|
PaSampleFormat nativeSampleFormat;
|
||
|
}PaDeviceInfo;</pre>
|
||
|
</blockquote>
|
||
|
If the device supports a continuous range of sample rates, then numSampleRates
|
||
|
will equal -1, and the sampleRates array will have two values, the minimum
|
||
|
and maximum rate.
|
||
|
<p>The device information is allocated by Pa_Initialize() and freed by
|
||
|
Pa_Terminate() so you do not have to free() the structure returned by Pa_GetDeviceInfo().</blockquote>
|
||
|
<font size=+2><a href="http://www.portaudio.com/">home</a> |
|
||
|
<a href="pa_tutorial.html">contents</a>
|
||
|
| <a href="pa_tut_util.html">previous</a> | <a href="pa_tut_rw.html">next</a></font>
|
||
|
</body>
|
||
|
</html>
|