Workbench Library
0.1b
|
Audio system initialization and deinitialization for Workbench applications. More...
Typedefs | |
typedef SAMPLE | AudioSample_t |
Defines AudioSample_t as the type for audio samples. More... | |
typedef void(* | AudioCallback) (const void *, void *, unsigned long, void *) |
Type definition for audio callback functions. More... | |
Functions | |
void | audio_init () |
Initializes the audio system. More... | |
void | audio_deinit () |
Deinitializes the audio system. More... | |
Audio system initialization and deinitialization for Workbench applications.
This header file defines functions for initializing and deinitializing the audio system using the PortAudio library. It includes the type definition for audio callback functions that are used to process audio data.
The audio_init
function sets up and starts the audio stream based on configuration settings, while the audio_deinit
function stops and closes the audio stream, and terminates the PortAudio library.
typedef void(* AudioCallback) (const void *, void *, unsigned long, void *) |
Type definition for audio callback functions.
An AudioCallback
function is called during audio processing to handle input and output audio buffers. It takes the following parameters:
input_buffer
: A pointer to the input audio buffer.output_buffer
: A pointer to the output audio buffer.block_size
: The number of frames in the buffer.user_data
: A pointer to user-defined data passed to the callback function.Example usage:
Defines AudioSample_t
as the type for audio samples.
This typedef defines AudioSample_t
to be the type corresponding to SAMPLE_FORMAT
. For example, if SAMPLE_FORMAT
is paFloat32
, AudioSample_t
will be defined as float
.
void audio_deinit | ( | ) |
Deinitializes the audio system.
This function stops and closes the audio stream, and then terminates the PortAudio library. It logs any errors that occur during the deinitialization process.
void audio_init | ( | ) |
Initializes the audio system.
This function initializes the PortAudio library, sets up the audio input and output devices based on the configuration settings, and starts the audio stream. It also configures the audio stream parameters such as sample rate, block size, and channel counts.
If an error occurs during initialization, it logs the error message and deinitializes the audio system.