Debian Codegraph @

3rdparty/iaxclient/lib/portaudio/docs/pa_tut_open.html

raw symbols SCIP
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.73 [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>
18 PortAudio Tutorial</h1></center>
19 </td>
20 </tr>
21 </table></center>
22
23 <h2>
24 Opening a Stream using Defaults</h2>
25
26 <blockquote>The next step is to open a stream which is similar to opening
27 a file. You can specify whether you want audio input and/or output, how
28 many channels, the data format, sample rate, etc. There are two calls for
29 opening streams, <tt>Pa_OpenStream</tt>() and <tt>Pa_OpenDefaultStream</tt>().
30 <p><tt>Pa_OpenStream()</tt> takes extra&nbsp; parameters which give you
31 more control. You can normally just use <tt>Pa_OpenDefaultStream</tt>()
32 which just calls <tt>Pa_OpenStream()</tt> <tt>with</tt> some reasonable
33 default values.&nbsp; Let's open a stream for stereo output, using floating
34 point data, at 44100 Hz.
35 <blockquote>
36 <pre>err = Pa_OpenDefaultStream(
37 &nbsp;&nbsp;&nbsp; &amp;stream,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* passes back stream pointer */
38 &nbsp;&nbsp;&nbsp; 0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* no input channels */
39 &nbsp;&nbsp;&nbsp; 2,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* stereo output */
40 &nbsp;&nbsp;&nbsp; paFloat32,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* 32 bit floating point output */
41 &nbsp;&nbsp;&nbsp; 44100,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* sample rate */
42 &nbsp;&nbsp;&nbsp; 256,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* frames per buffer */
43 &nbsp;&nbsp;&nbsp; 0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* number of buffers, if zero then use default minimum */
44 &nbsp;&nbsp;&nbsp; patestCallback, /* specify our custom callback */
45 &nbsp;&nbsp;&nbsp; &amp;data );&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* pass our data through to callback */</pre>
46 </blockquote>
47 If you want to use 16 bit integer data, pass <tt>paInt16</tt> instead of
48 <tt>paFloat32</tt>.</blockquote>
49 <font size=+2><a href="http://www.portaudio.com/">home</a> | <a href="pa_tutorial.html">contents</a>
50 | <a href="pa_tut_init.html">previous</a> |&nbsp; <a href="pa_tut_run.html">next</a></font>
51 </body>
52 </html>