| 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 | |
| 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 | Utility Functions</h2> |
| 25 | |
| 26 | <blockquote>Here are several more functions that are not critical, but |
| 27 | may be handy when using PortAudio. |
| 28 | <p>Pa_StreamActive() returns one when the stream in playing audio, zero |
| 29 | when not playing, or a negative error number if the stream is invalid. |
| 30 | The stream is active between calls to Pa_StartStream() and Pa_StopStream(), |
| 31 | but may also become inactive if the callback returns a non-zero value. |
| 32 | In the latter case, the stream is considered inactive after the last buffer |
| 33 | has finished playing. |
| 34 | <blockquote> |
| 35 | <pre>PaError Pa_StreamActive( PortAudioStream *stream );</pre> |
| 36 | </blockquote> |
| 37 | Pa_StreamTime() returns the number of samples that have been generated. |
| 38 | PaTimeStamp is a double precision number which is a convenient way to pass |
| 39 | big numbers around even though we only need integers. |
| 40 | <blockquote> |
| 41 | <pre>PaTimestamp Pa_StreamTime( PortAudioStream *stream );</pre> |
| 42 | </blockquote> |
| 43 | The "CPU Load" is a fraction of total CPU time consumed by the stream's |
| 44 | audio processing. A value of 0.5 would imply that PortAudio and the sound |
| 45 | generating callback was consuming roughly 50% of the available CPU time. |
| 46 | This function may be called from the callback function or the application. |
| 47 | <blockquote> |
| 48 | <pre>double Pa_GetCPULoad( PortAudioStream* stream );</pre> |
| 49 | </blockquote> |
| 50 | </blockquote> |
| 51 | <font size=+2><a href="http://www.portaudio.com/">home</a> | |
| 52 | <a href="pa_tutorial.html">contents</a> | <a href="pa_tut_term.html">previous</a> |
| 53 | | <a href="pa_tut_devs.html">next</a></font> |
| 54 | </body> |
| 55 | </html> |