AIROC™ BTSDK v4.9 - Documentation | ||||
Data Structures | |
struct | wiced_bt_audio_config_buffer_t |
Audio buffer configuration structure Please refer wiced_audio_buffer_initialize API documentation for recommended size. More... | |
struct | wiced_bt_a2dp_statistics_t |
A2DP statistics structure. More... | |
Macros | |
#define | WICED_BT_AUDIO_PCM_DATA_SIZE_IN_AN_AUDIO_FRAME 1024 |
The audio data (PCM data) size in bytes in an outgoing A2DP audio frame. More... | |
Typedefs | |
typedef void(* | wiced_audio_suspend_complete_cback_t )(void) |
Audio suspend complete callback. | |
typedef void(* | wiced_audio_buffer_empty_cback_t )(uint32_t total_intr_count, uint32_t total_empty_count, uint32_t consecutive_empty_count) |
Audio buffer empty callback. More... | |
typedef void(* | wiced_audio_congestion_status_cback_t )(wiced_bool_t is_congested) |
Audio congestion status callback. More... | |
typedef void( | wiced_audio_request_samples_callback_t )(uint8_t num_packets, uint32_t packet_audio_size, uint32_t req_pkt_count, uint32_t rx_pkt_count) |
Audio Request Samples callback. More... | |
Enumerations | |
enum | wiced_audio_route_t { AUDIO_ROUTE_I2S = 0x00, AUDIO_ROUTE_UART = 0x01, AUDIO_ROUTE_SINE = 0x02, AUDIO_ROUTE_COMPRESSED_TRANSPORT = 0x04 } |
wiced audio routes More... | |
enum | wiced_device_role_t { WICED_AUDIO_SOURCE_ROLE = 1 << 1, WICED_AUDIO_SINK_ROLE = 1 << 2, WICED_HF_ROLE = 1 << 3 } |
wiced device roles More... | |
Functions | |
wiced_result_t | wiced_audio_buffer_initialize (wiced_bt_audio_config_buffer_t wiced_audio_cfg_pool) |
Function wiced_audio_buffer_initialize. More... | |
void | wiced_audio_start (int is_master, int audio_route, uint16_t lcid, wiced_bt_a2d_sbc_cie_t *pSbc) |
Function wiced_audio_start. More... | |
void | wiced_audio_stop (uint16_t lcid) |
Function wiced_audio_stop. More... | |
void | wiced_audio_suspend (uint16_t lcid, wiced_audio_suspend_complete_cback_t p_cback) |
Function wiced_audio_suspend. More... | |
void | wiced_audio_register_buffer_empty_cback (wiced_audio_buffer_empty_cback_t p_cback) |
Function wiced_audio_register_buffer_empty_cback. More... | |
void | wiced_audio_use_sw_timing (int enable) |
Function wiced_audio_use_sw_timing. More... | |
void | wiced_audio_set_sinwave (int16_t *pIn) |
Function wiced_audio_set_sinwave. More... | |
void | wiced_audio_get_statistics (wiced_bt_a2dp_statistics_t *buffer_stat) |
Function wiced_audio_get_statistics. More... | |
void | wiced_audio_register_congestion_cback (wiced_audio_congestion_status_cback_t p_congestion_stat) |
Function wiced_audio_register_congestion_cback. More... | |
wiced_result_t | wiced_audio_samples_route_init (wiced_audio_request_samples_callback_t *p_callback) |
Function wiced_audio_samples_route_init. More... | |
wiced_bool_t | wiced_audio_samples_set (uint8_t *p_in, uint32_t size) |
Function wiced_audio_samples_set. More... | |
wiced_result_t | wiced_audio_set_packet_types (BD_ADDR peer_bda, UINT16 packet_types) |
Function Name wiced_audio_set_packet_types. More... | |
wiced_result_t | wiced_audio_set_max_bitpool (uint8_t max_value) |
Function wiced_audio_set_max_bitpool. More... | |
uint8_t | wiced_audio_read_max_bitpool (void) |
Function wiced_audio_read_max_bitpool. More... | |
wiced_bool_t | wiced_mp3_codec_dec_init (void *p_mem) |
Initialize the MP3 decoder. More... | |
uint32_t | wiced_mp3_codec_dec_audio_frame_dec (void *p_in, void *p_out, uint32_t in_size) |
wiced_mp3_codec_dec_audio_frame_dec More... | |
#define WICED_BT_AUDIO_PCM_DATA_SIZE_IN_AN_AUDIO_FRAME 1024 |
The audio data (PCM data) size in bytes in an outgoing A2DP audio frame.
typedef void( * wiced_audio_buffer_empty_cback_t)(uint32_t total_intr_count, uint32_t total_empty_count, uint32_t consecutive_empty_count) |
Audio buffer empty callback.
Callback invoked on audio buffer empty event. Registered using wiced_audio_register_buffer_empty_cback()
total_intr_count | : Total number of i2s interrupts |
total_empty_count | : Total number of times the audio buffer is empty |
consecutive_empty_count | : Number of consecutive times the audio buffer is empty, resets on receiving audio data |
typedef void(* wiced_audio_congestion_status_cback_t)(wiced_bool_t is_congested) |
Audio congestion status callback.
Callback invoked when there is a change in the audio stream congestion status. This gets invoked when the audio stream is congested and also when the congestion is cleared
is_congested | : TRUE - when the audio stream is congested FALSE - when the congestion is cleared |
typedef void( wiced_audio_request_samples_callback_t)(uint8_t num_packets, uint32_t packet_audio_size, uint32_t req_pkt_count, uint32_t rx_pkt_count) |
Audio Request Samples callback.
Callback invoked when the litehost requires the audio data (PCM data) to compose the outgoing A2DP frames.
[in] | num_packets | : number of packes in a packet count |
[in] | packet_audio_size | : data (PCM data) size in bytes in a audio packet This shall be WICED_BT_AUDIO_PCM_DATA_SIZE_IN_AN_AUDIO_FRAME |
[in] | req_pkt_count | : requested packet count for outgoing transmission |
[in] | rx_pkt_count | : received packet count (ignored) |
enum wiced_audio_route_t |
wiced audio routes
enum wiced_device_role_t |
wiced_result_t wiced_audio_buffer_initialize | ( | wiced_bt_audio_config_buffer_t | wiced_audio_cfg_pool | ) |
Function wiced_audio_buffer_initialize.
Audio buffer initialization. Allocates the audio buffer and returns pointer to the audio buffer. This buffer is used by the a2dp source to hold the audio data received over the transport from the host
[in] | wiced_audio_cfg_pool | : Size of the audio tx buffer and codec buffer to be allocated |
NOTE : Recommended audio_tx_buffer_size : If the application includes A2DP source profile, the transport buffer size shall be set to at least 8KB. In case of A2DP sink profile, set the transport buffer size (recommended size 0x1c00) if required to send the encoded/decoded data over the transport.
Recommended audio_codec_buffer_size:
| USE CASE | Recommended size | |-------------------------------------------------------------------------------—| | A2DP Source (SBC Encode) | 8KB | | A2DP Sink(SBC Decode)* | 11KB (300ms jitter buffer) + 8KB for codec | | | Total 19KB |
TODO : Provide formula for calculating Jitter Buffer
In case of multiple profiles used by application simultaneously, example A2DP sink and HFP device profiles, size specified should be the maximum of the recommended value for each profile supported.
void wiced_audio_get_statistics | ( | wiced_bt_a2dp_statistics_t * | buffer_stat | ) |
Function wiced_audio_get_statistics.
Used by the A2DP source to read A2DP streaming statistics
[out] | buffer_stat | : pointer to fill statistics. |
uint8_t wiced_audio_read_max_bitpool | ( | void | ) |
Function wiced_audio_read_max_bitpool.
This function is called to read max_audio_bitpool
void wiced_audio_register_buffer_empty_cback | ( | wiced_audio_buffer_empty_cback_t | p_cback | ) |
Function wiced_audio_register_buffer_empty_cback.
Register the callback function to be invoked on audio buffer empty event
[in] | p_cback | : callback function to be invoked on audio buffer empty event |
void wiced_audio_register_congestion_cback | ( | wiced_audio_congestion_status_cback_t | p_congestion_stat | ) |
Function wiced_audio_register_congestion_cback.
Register the callback function to be invoked on audio stream congestion status change event
[in] | p_cback | : callback function to be invoked on audio stream congestion status change event |
wiced_result_t wiced_audio_samples_route_init | ( | wiced_audio_request_samples_callback_t * | p_callback | ) |
Function wiced_audio_samples_route_init.
Register to callback function to be invoked when the litehost prepares to compose the outgoing audio frames.
[in] | p_callback | : callback function to be invoked |
wiced_bool_t wiced_audio_samples_set | ( | uint8_t * | p_in, |
uint32_t | size | ||
) |
Function wiced_audio_samples_set.
Set audio data (PCM data) to the outgoing A2DP audio data.
[in] | p_in | : pointer to the PCM data |
[in] | size | : length of PCM data in bytes |
wiced_result_t wiced_audio_set_max_bitpool | ( | uint8_t | max_value | ) |
Function wiced_audio_set_max_bitpool.
This function is called to set max_audio_bitpool
[in] | max_value | : value to set max_audio_bitpool. Needs to be within WICED_MIN_AUDIO_BITPOOL and WICED_MAX_AUDIO_BITPOOL |
wiced_result_t wiced_audio_set_packet_types | ( | BD_ADDR | peer_bda, |
UINT16 | packet_types | ||
) |
Function Name wiced_audio_set_packet_types.
Sets the packet types used for a specific ACL connection and also sets the max_audio_mtu that the audio processing unit uses, based on the provided packet types, to format the SBC frames. By setting the max_audio_mtu according to the packet type, it helps to ensure no fragmentation across SBC frames occur.
[in] | peer_bda | Peer address of the desired ACL connection |
[in] | packet_types | Packet type bitmask. See hcidef.h for definitions for packet type masks (BT1.2 and BT2.0 definitions). |
void wiced_audio_set_sinwave | ( | int16_t * | pIn | ) |
Function wiced_audio_set_sinwave.
Used by the A2DP source to set the sine audio samples to be used in audio streaming when the audio route is set to sine.
[in] | pOut | : sine audio samples |
void wiced_audio_start | ( | int | is_master, |
int | audio_route, | ||
uint16_t | lcid, | ||
wiced_bt_a2d_sbc_cie_t * | pSbc | ||
) |
Function wiced_audio_start.
Used by the A2DP source to start the audio streaming. I2S interrupts are used for timing the audio data by default. Software timer can also be used for timing the audio data which can be enabled by using the API wiced_audio_use_sw_timing. Enable the software timer before invoking wiced_audio_start
[in] | is_master | : If the I2S has to configured as master when using I2S interrupts for timing the audio data. Set to 1 to configure I2S in the master mode. Set to 0 to configure the I2S in the slave mode. |
[in] | audio_route | : Audio route to be configured. Configure as AUDIO_ROUTE_I2S if the audio source is I2S Configure as AUDIO_ROUTE_UART if the audio source is FILE Configure as AUDIO_ROUTE_SINE if the audio source is the stored sine wave |
[in] | lcid | : lcid |
[in] | pSbc | : SBC codec info |
void wiced_audio_stop | ( | uint16_t | lcid | ) |
Function wiced_audio_stop.
To stop the audio streaming
[in] | lcid | : lcid |
void wiced_audio_suspend | ( | uint16_t | lcid, |
wiced_audio_suspend_complete_cback_t | p_cback | ||
) |
Function wiced_audio_suspend.
To suspend the audio streaming
[in] | lcid | : lcid |
void wiced_audio_use_sw_timing | ( | int | enable | ) |
Function wiced_audio_use_sw_timing.
Used by the A2DP source to time the audio data using software timer. Sofware timer internally uses slot timer to time the audio data. Period of the software timer is determined based on the chosen audio codec sampling frequency and the number of samples. Note: I2S interrupts are used for timing the audio data by default. Software timer can also be used for timing the audio data which can be enabled by using the API wiced_audio_use_sw_timing. Enable the software timer before invoking wiced_audio_start.
[in] | enable | : enables the sw timer |
uint32_t wiced_mp3_codec_dec_audio_frame_dec | ( | void * | p_in, |
void * | p_out, | ||
uint32_t | in_size | ||
) |
wiced_mp3_codec_dec_audio_frame_dec
Decode the MP3 Audio Frame into PCM samples. A MP3 Audio Frame includes a Audio Frame Header and a Audio Frame Body. The MP3 Audio Frame shall start with the Audio Frame Header.
[in] | p_in | : point to the input MP3 Audio Frame |
[out] | p_out | : point to the output PCM samples |
[in] | in_size | : size of the input MP3 Audio Frame in bytes |
wiced_bool_t wiced_mp3_codec_dec_init | ( | void * | p_mem | ) |
Initialize the MP3 decoder.
p_mem[in] | : pointer to the allocated buffer used for decoding |