Author: Phil Burk
Description: 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.
Keywords: audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,

# PortAudio Tutorial

## Utility Functions

> Here are several more functions that are not critical, but may be handy when using PortAudio.

> Pa_StreamActive() returns one when the stream in playing audio, zero when not playing, or a negative error number if the stream is invalid. The stream is active between calls to Pa_StartStream() and Pa_StopStream(), but may also become inactive if the callback returns a non-zero value. In the latter case, the stream is considered inactive after the last buffer has finished playing.

> >     PaError Pa_StreamActive( PortAudioStream *stream );

> Pa_StreamTime() returns the number of samples that have been generated. PaTimeStamp is a double precision number which is a convenient way to pass big numbers around even though we only need integers.

> >     PaTimestamp Pa_StreamTime( PortAudioStream *stream );

> The "CPU Load" is a fraction of total CPU time consumed by the stream's audio processing. A value of 0.5 would imply that PortAudio and the sound generating callback was consuming roughly 50% of the available CPU time. This function may be called from the callback function or the application.

> >     double Pa_GetCPULoad( PortAudioStream* stream );

home | contents | previous | next