The Audio I/O API provides functions for controlling audio devices.
Required Header
#include <audio_io.h>
Overview
The Audio I/O API provides a set of functions to directly manage the system audio devices. It gives easy access to the hardware layer of the sound card with a professional multichannel audio interface. It should be used for activities requiring raw audio data buffers(PCM format).
Programming the interface requires first obtaining a handle to the device, via the audio_in_create() or audio_out_create_new() function.
The input and output devices both have an available set of queries, to find the suggested buffer size, sampling rate, channel type, and sample type. For output, there is an additional query, to get the sound type (these types are defined in the Sound Manager API).
Reading from input device is done by audio_in_read() with allocated buffer after audio_in_prepare(). Similarly, writing to output device is done by audio_out_write() with allocated buffer after audio_out_prepare().
Enumeration Type Documentation
Enumeration for audio channel.
- Since :
- 2.3.1
- Enumerator:
AUDIO_CHANNEL_MONO |
1 channel, mono
|
AUDIO_CHANNEL_STEREO |
2 channels, stereo
|
AUDIO_CHANNEL_MULTI_3 |
3 channels (Since 5.5)
|
AUDIO_CHANNEL_MULTI_4 |
4 channels (Since 5.5)
|
AUDIO_CHANNEL_MULTI_5 |
5 channels (Since 5.5)
|
AUDIO_CHANNEL_MULTI_6 |
6 channels (Since 5.5)
|
AUDIO_CHANNEL_MULTI_7 |
7 channels (Since 5.5)
|
AUDIO_CHANNEL_MULTI_8 |
8 channels (Since 5.5)
|
AUDIO_CHANNEL_MULTI_9 |
9 channels (Since 6.5)
|
AUDIO_CHANNEL_MULTI_10 |
10 channels (Since 6.5)
|
AUDIO_CHANNEL_MULTI_11 |
11 channels (Since 6.5)
|
AUDIO_CHANNEL_MULTI_12 |
12 channels (Since 6.5)
|
AUDIO_CHANNEL_MULTI_13 |
13 channels (Since 6.5)
|
AUDIO_CHANNEL_MULTI_14 |
14 channels (Since 6.5)
|
AUDIO_CHANNEL_MULTI_15 |
15 channels (Since 6.5)
|
AUDIO_CHANNEL_MULTI_16 |
16 channels (Since 6.5)
|
Enumeration for audio input and output error.
- Since :
- 2.3.1
- Enumerator:
AUDIO_IO_ERROR_NONE |
Successful
|
AUDIO_IO_ERROR_OUT_OF_MEMORY |
Out of memory
|
AUDIO_IO_ERROR_INVALID_PARAMETER |
Invalid parameter
|
AUDIO_IO_ERROR_INVALID_OPERATION |
Invalid operation
|
AUDIO_IO_ERROR_PERMISSION_DENIED |
Device open error by security
|
AUDIO_IO_ERROR_NOT_SUPPORTED |
Not supported
|
AUDIO_IO_ERROR_DEVICE_POLICY_RESTRICTION |
Device policy restriction (Since 3.0)
|
AUDIO_IO_ERROR_DEVICE_NOT_OPENED |
Device open error
|
AUDIO_IO_ERROR_DEVICE_NOT_CLOSED |
Device close error
|
AUDIO_IO_ERROR_INVALID_BUFFER |
Invalid buffer pointer
|
AUDIO_IO_ERROR_SOUND_POLICY |
Sound policy error
|
AUDIO_IO_ERROR_INVALID_STATE |
Invalid state (Since 3.0)
|
AUDIO_IO_ERROR_NOT_SUPPORTED_TYPE |
Not supported stream type (Since 3.0)
|
Enumeration for audio input and output state.
- Since :
- 3.0
- Enumerator:
AUDIO_IO_STATE_IDLE |
Audio-io handle is created, but not prepared
|
AUDIO_IO_STATE_RUNNING |
Audio-io handle is ready and the stream is running
|
AUDIO_IO_STATE_PAUSED |
Audio-io handle is ready and the stream is paused
|
Enumeration for audio sample type with bit depth.
- Since :
- 2.3.1
- Enumerator:
AUDIO_SAMPLE_TYPE_U8 |
Unsigned 8-bit audio samples
|
AUDIO_SAMPLE_TYPE_S16_LE |
Signed 16-bit audio samples
|
AUDIO_SAMPLE_TYPE_S24_LE |
Signed 24-bit audio samples (Since 5.0)
|
AUDIO_SAMPLE_TYPE_S24_32_LE |
Signed 24-bit (packed in 32-bit) audio samples (Since 5.0)
|
AUDIO_SAMPLE_TYPE_S32_LE |
Signed 32-bit audio samples (Since 5.5)
|