Infineon Logo AIROC BTSDK v4.2 - Documentation
 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
AIROC Audio Utilities

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...
 

Typedefs

typedef uint32_t wiced_audio_route_t
 
typedef uint8_t wiced_device_role_t
 
typedef uint8_t wiced_audio_sco_data_route_t
 
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_sco_data_cback_t )(uint32_t ltch_len, uint8_t *p_data)
 SCO Rx Data callback. More...
 

Enumerations

enum  {
  AUDIO_ROUTE_I2S = 0x00, AUDIO_ROUTE_UART = 0x01, AUDIO_ROUTE_SINE = 0x02, AUDIO_ROUTE_APP = 0x03,
  AUDIO_ROUTE_COMPRESSED_TRANSPORT = 0x04, AUDIO_ROUTE_COMPRESSED_APP = 0x05
}
 wiced audio routes More...
 
enum  { WICED_AUDIO_SOURCE_ROLE = 1 << 1, WICED_AUDIO_SINK_ROLE = 1 << 2, WICED_HF_ROLE = 1 << 3 }
 wiced device roles More...
 
enum  { WICED_SCO_ROUTE_NONE = 0, WICED_SCO_ROUTE_APP }
 wiced sco data routes
 

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...
 
void wiced_audio_sco_set_data_route (wiced_audio_sco_data_route_t sco_data_route, wiced_audio_sco_data_cback_t p_data_cb)
 Function wiced_audio_sco_set_data_route. More...
 
uint16_t wiced_audio_sco_add_mic_stream (uint16_t sco_index, uint8_t *p_pcmsrc, uint16_t len)
 Function wiced_audio_sco_add_mic_stream. More...
 

Variables

wiced_device_role_t role
 Role if audio source, sink or hf device.
 
uint32_t audio_tx_buffer_size
 Audio Tx buffer size.
 
uint32_t audio_codec_buffer_size
 Codec buffer size.
 
uint8_t audio_tx_buffer_watermark_level
 Watermark level in % in terms of % of buffers remaining. More...
 
uint32_t duration
 Duration of the a2dp streaming in which stats were captured.
 
uint32_t packet_ack_stats_table [11]
 Delay between packet sent OTA and ack received.
 

Detailed Description

Typedef Documentation

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()

Parameters
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

Parameters
is_congested: TRUE - when the audio stream is congested FALSE - when the congestion is cleared
typedef void(* wiced_audio_sco_data_cback_t)(uint32_t ltch_len, uint8_t *p_data)

SCO Rx Data callback.

Callback invoked if specific SCO data route was set This gets invoked when the application want to get SCO voice data

Parameters
ltch_len: sco data length in bytes p_data : sco voice data

Enumeration Type Documentation

anonymous enum

wiced audio routes

Enumerator
AUDIO_ROUTE_I2S 

Route the PCM Samples over I2S.

Read from I2S in case of audio source,write to I2S in case of audio sink

AUDIO_ROUTE_UART 

Route the PCM samples over transport.

Receive the audio data to be sent OTA from transport in case of audio source.Receive the audio data OTA, decode and send to transport in case of audio sink

AUDIO_ROUTE_SINE 

Route the stored sine samples over the air.

Applicable in case of audio source

AUDIO_ROUTE_APP 

Route the PCM samples to app.

Receive the audio data OTA, decode and send to app. Applicable in case of audio sink

AUDIO_ROUTE_COMPRESSED_TRANSPORT 

Route the compressed audio data(AVDTP media packet, including the header) over transport.

Receive the audio data OTA and send to transport. Applicable in case of audio sink

AUDIO_ROUTE_COMPRESSED_APP 

Route the compressed audio data(AVDTP media packet, including the header) to app.

Receive the audio data OTA and send to transport. Applicable in case of audio sink

anonymous enum

wiced device roles

Enumerator
WICED_AUDIO_SOURCE_ROLE 

Audio Source.

WICED_AUDIO_SINK_ROLE 

Audio Sink.

WICED_HF_ROLE 

Handsfree.

Function Documentation

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

Parameters
[in]wiced_audio_cfg_pool: Size of the audio tx buffer and codec buffer to be allocated
Returns
WICED_SUCCESS if Success, otherwise WICED_NO_MEMORY.

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:

In case of A2DP sink profile, set the transport buffer size if required to send the audio data over the transport

| USE CASE | Recommended size | |-------------------------------------------------------------------------------—| | A2DP Source (SBC Encode) | 8KB | | A2DP Sink(SBC Decode)* | 11KB (300ms jitter buffer) + 8KB for codec | | | Total 19KB |

| MSBC (WBS CODEC)* | 13KB = 5KB(for Encoding)+ 8KB(for Decoding) |

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

Parameters
[out]buffer_stat: pointer to fill statistics.
Returns
void
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

Parameters
[in]p_cback: callback function to be invoked on audio buffer empty event
Returns
void
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

Parameters
[in]p_cback: callback function to be invoked on audio stream congestion status change event
Returns
void
uint16_t wiced_audio_sco_add_mic_stream ( uint16_t  sco_index,
uint8_t *  p_pcmsrc,
uint16_t  len 
)

Function wiced_audio_sco_add_mic_stream.

Add sco microphone pcm data to internl audio pipe.

Parameters
[in]sco_index: sco index
[in]p_pcmsrc: microphone pcm source
[in]len: length of data
Returns
the legth of non transmited stream
void wiced_audio_sco_set_data_route ( wiced_audio_sco_data_route_t  sco_data_route,
wiced_audio_sco_data_cback_t  p_data_cb 
)

Function wiced_audio_sco_set_data_route.

Register the specific sco data route and callback function

Parameters
[in]sco_data_route: WICED_SCO_ROUTE_NONE/WICED_SCO_ROUTE_APP
[in]p_data_cb: callback function to be invoked when receiving sco rx data
Returns
void
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.

Parameters
[in]pOut: sine audio samples
Returns
void
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

Parameters
[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
Returns
void
void wiced_audio_stop ( uint16_t  lcid)

Function wiced_audio_stop.

To stop the audio streaming

Parameters
[in]lcid: lcid
Returns
void
void wiced_audio_suspend ( uint16_t  lcid,
wiced_audio_suspend_complete_cback_t  p_cback 
)

Function wiced_audio_suspend.

To suspend the audio streaming

Parameters
[in]lcid: lcid
Returns
void
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.

Parameters
[in]enable: enables the sw timer
Returns
void

Variable Documentation

uint8_t audio_tx_buffer_watermark_level

Watermark level in % in terms of % of buffers remaining.

Default is 50 for 50%. E.g. if set to 70, fw will request additional data when buffer reaches 70% of the full buffer size (i.e., audio_tx_buffer_size). Only applicable for A2DP source applications