Top |
struct alsa * | alsa_init () |
int | alsa_open_output () |
int | alsa_open_input () |
void | alsa_close_output () |
void | alsa_close_input () |
bool | alsa_test_output_configuration () |
bool | alsa_test_input_configuration () |
void | alsa_configure_output () |
void | alsa_configure_input () |
void | alsa_register_output_callback () |
void | alsa_register_input_callback () |
int | alsa_run () |
int alsa_open_output (struct alsa *alsa
,const char *device_name
);
Open ALSA output devices whose name prefixes match the provided name prefix.
int alsa_open_input (struct alsa *alsa
,const char *device_name
);
Open the ALSA input device whose name matches the provided name prefix.
bool alsa_test_output_configuration (struct alsa *alsa
,int channels
,int sampling_rate
);
Test the output configuration specified by channels
and sampling_rate
for the output devices.
bool alsa_test_input_configuration (struct alsa *alsa
,int channels
,int sampling_rate
);
Test the input configuration specified by channels
and sampling_rate
for the input device.
void alsa_configure_output (struct alsa *alsa
,int channels
,int sampling_rate
);
Configure the output devices with the configuration specified by channels
and sampling_rate
.
void alsa_configure_input (struct alsa *alsa
,int channels
,int sampling_rate
);
Configure the input device with the configuration specified by channels
and sampling_rate
.
void alsa_register_output_callback (struct alsa *alsa
,int (*callback) (void *data, short *buffer, int samples)
,void *callback_data
,int samples_trigger
);
Register a callback function to be called to fill output data during a run.
The callback is called when samples_trigger
samples are required.
The callback should return an integer equal to zero for success and negative for failure.
void alsa_register_input_callback (struct alsa *alsa
,int (*callback) (void *data, short *buffer, int samples)
,void *callback_data
,int samples_trigger
);
Register a callback function to be called when input data is available during
a run. The callback is called when samples_trigger
samples are available.
The callback should return an integer equal to zero for success, negative for failure and positive to indicate that the run should stop.
int alsa_run (struct alsa *alsa
,int duration_ms
);
Run ALSA playback and capture on the input and output devices for at
most duration_ms
milliseconds, calling the registered callbacks when needed.