Logo
UNICENS V2.3.0-4567
User Manual and API Reference
Audio Transportation Delay

Introduction

Due to INIC internal routing and network setup, audio data can have different delay times from source to sink for diverse routes. These delay between source and sink is called ATD (Audio Transportation Delay). There are application scenarios of audio data processing where it is essential to know the ATD value of the routes, for example Beam Forming or Noise Canceling. In such applications it is required that all simultaneously recorded samples from multiple microphones are processed together. Therefore the time shift between the microphones can be determined with the use of the ATD module.

The ATD calculation is implemented as an additional feature of the Route Management. It can be enabled for desired routes. The class CAtd calculates the audio transportation delay for the corresponding route and keeps the value ready for user requests. Also the user gets notified, if the ATD value changes due to a network event.

Initialization

The initialization of the ATD class is done by the Routing Management. Desired routes can be signed in for ATD calculation by setting the atd_enabled flag to true and the clock_config to the corresponding streaming port clock speed of the source endpoint.

/* Configuration structure of routes ATD settings. */
typedef struct Ucs_Rm_Atd_
{
/*! \brief Flag to enable the ATD calculation for the corresponding route. */
uint8_t enabled;
/*! \brief Clock speed configured for the source streaming port. */
/* Configuration structure of a Route. */
typedef struct Ucs_Rm_Route_
{
Ucs_Rm_EndPoint_t * source_endpoint_ptr;
Ucs_Rm_EndPoint_t * sink_endpoint_ptr;
uint8_t active;
uint16_t route_id;
Ucs_Rm_Atd_t atd; /* ATD settings */
Ucs_Rm_RouteInt_t internal_infos;

This ATD configuration could look like the example below. The required values are set in the AtdSetup structure and included in the route structure.

Ucs_Rm_Route_t route = {
&SourceEndpointForRoute,
&SinkEndpointForRoute,
1,
0x0066,
{1, UCS_STREAM_PORT_CLK_CFG_64FS} /* ATD enabled and clock configuration set */
};

Processing Narrative

The ATD module acts as a subclass of the Routes Management. Direct interaction between the API and ATD class is not needed. However, the API gets notified if the ATD value has changed due to an MPR change event or new route build event. This notification is realized by a call of the App_OnRoutingResult() function. Through the given route info it can be distinguish whether it is an ATD update available, an ATD error occurred or an other routes event occurred. If an updated ATD value is available for a route, the user can get if by calling the Routing Management function Ucs_Rm_GetAtdValue().

The following also illustrates the interaction between these objects within the "ATD calculation process" use case.

atd_seq_api.png

Processing Example

The code example below shows how the CAtd class is used from the API using the routing management.

static void App_OnRoutingResult(Ucs_Rm_Route_t* route_ptr, Ucs_Rm_RouteInfos_t route_infos, void *user_ptr)
{
uint16_t atd_value_ptr;
APP_UNUSED(user_ptr);
(void)printf("\rRoute {%X} ", route_ptr->route_id);
switch (route_infos)
{
(void)printf(" ATD update available\r\n");
switch (Ucs_Rm_GetAtdValue(running_inst_ptr, route_ptr, &atd_value_ptr))
{
/* Pointer "atd_value_ptr" to ATD value in micro seconds */
break;
/* ATD value is not available */
break;
/* ATD value is not up to date */
break;
default:
/* ATD value is not available */
break;
}
break;
(void)printf(" ATD error occurred: \r\n");
break;
}
}

Limitations

  • The ATD class can't perform when the network is in Fallback mode.
  • The ATD class does not support the use case when source node is also the sink node.
  • The ATD calculation can be processed for synchronous streaming connections only. MediaLB is not supported.