# Audio manager

**Detailed Description**

This section contains APIs related to Audio Manager operation.

- *group* Telematics\_audio\_manager

    - Typedefs

- using GetDevicesResponseCb = std::function&lt;void(std::vector&lt;std::shared\_ptr&lt;IAudioDevice&gt;&gt; devices, telux::common::ErrorCode error)&gt;

    - Invoked to pass the list of the supported audio devices. Used in conjunction with IAudioManager::getDevices().

- Param devices:

    - **[in]** List of the IAudioDevice devices

- Param error:

    - **[in]** telux::common::ErrorCode::SUCCESS if the list is fetched successfully, otherwise, an appropriate error code

- using GetStreamTypesResponseCb = std::function&lt;void(std::vector&lt;StreamType&gt; streamTypes, telux::common::ErrorCode error)&gt;

    - Invoked to pass the list of the supported audio stream types. Used in conjunction with IAudioManager::getStreamTypes().

- Param streamTypes:

    - **[in]** List of the StreamType types

- Param error:

    - **[in]** telux::common::ErrorCode::SUCCESS if the list is fetched successfully, otherwise, an appropriate error code

- using CreateStreamResponseCb = std::function&lt;void(std::shared\_ptr&lt;IAudioStream&gt; &stream, telux::common::ErrorCode error)&gt;

    - Invoked to pass the instance of the audio stream created. Used in conjunction with IAudioManager::createStream().

Passed stream should be type casted before using it, according to the StreamType::\* type that was requested while creating it.

For StreamType::VOICE\_CALL type cast to IAudioManager::IAudioVoiceStream. For StreamType::CAPTURE type cast to IAudioManager::IAudioCaptureStream. For StreamType::PLAY cast to IAudioManager::IAudioPlayStream. For StreamType::LOOPBACK cast to IAudioManager::IAudioLoopbackStream. For StreamType::TONE\_GENERATOR cast to IAudioManager::IAudioToneGeneratorStream.

- Param stream:

    - **[in]** Audio stream created or nullptr if creation failed

- Param error:

    - **[in]** telux::common::ErrorCode::SUCCESS if the stream is created successfully, otherwise, an appropriate error code

- using CreateTranscoderResponseCb = std::function&lt;void(std::shared\_ptr&lt;ITranscoder&gt; &transcoder, telux::common::ErrorCode error)&gt;

    - Invoked to pass the instance of the ITranscoder created. Used in conjunction with IAudioManager::createTranscoder().

- Param transcoder:

    - **[in]** ITranscoder instance or nullptr if transcoder can’t be setup

- Param error:

    - **[in]** telux::common::ErrorCode::SUCCESS if the transcoder is set up successfully, otherwise, an appropriate error code

- using DeleteStreamResponseCb = std::function&lt;void(telux::common::ErrorCode error)&gt;

    - Invoked to confirm if the stream is deleted or not. Used in conjunction with IAudioManager::deleteStream().

- Param error:

    - **[in]** telux::common::ErrorCode::SUCCESS if the stream is deleted, otherwise, an appropriate error code

- using GetCalInitStatusResponseCb = std::function&lt;void(CalibrationInitStatus calInitStatus, telux::common::ErrorCode error)&gt;

    - Invoked to pass the audio calibration database (ACDB) initialization status. Used in conjunction with IAudioManager::getCalibrationInitStatus().

- Param calInitStatus:

    - **[in]** CalibrationInitStatus::INIT\_SUCCESS if the ACDB is initialized successfully, CalibrationInitStatus::INIT\_FAILED if initialization failed

- Param error:

    - **[in]** telux::common::ErrorCode::SUCCESS if the status is is fetched successfully, otherwise, an appropriate error code

Enums

- enum DeviceType

    - Represents an audio device. Each device is mapped to its corresponding platform specific audio device type. This mapping is done in tel.conf file by the system integrator. Refer to README specified for the tel.conf file for details on the mapping of the DeviceType to a specific device on the HW platform.

*Values:*

- enumerator DEVICE\_TYPE\_NONE

    - Default device (invalid)

- enumerator DEVICE\_TYPE\_SPEAKER

    - Sink device as per above mapping

- enumerator DEVICE\_TYPE\_SPEAKER\_2

    - Sink device as per above mapping

- enumerator DEVICE\_TYPE\_SPEAKER\_3

    - Sink device as per above mapping

- enumerator DEVICE\_TYPE\_BT\_SCO\_SPEAKER

    - Bluetooth sink device for voice call

- enumerator DEVICE\_TYPE\_PROXY\_SPEAKER

    - Virtual sink device as per above mapping

- enumerator DEVICE\_TYPE\_MIC

    - Source device as per above mapping

- enumerator DEVICE\_TYPE\_MIC\_2

    - Source device as per above mapping

- enumerator DEVICE\_TYPE\_MIC\_3

    - Source device as per above mapping

- enumerator DEVICE\_TYPE\_BT\_SCO\_MIC

    - Bluetooth source device for voice call

- enumerator DEVICE\_TYPE\_PROXY\_MIC

    - Virtual mic connected over ethernet

- enum DeviceDirection

    - Defines the direction of an audio device.

*Values:*

- enumerator NONE

    - Default direction (invalid)

- enumerator RX

    - Audio will go out of the device, for example through a speaker (sink)

- enumerator TX

    - Audio will come into the device, for example through a mic (source)

- enum StreamType

    - Defines the type of the audio stream and the type’s purpose.

*Values:*

- enumerator NONE

    - Default type (invalid)

- enumerator VOICE\_CALL

    - Used for audio over a cellular network

- enumerator PLAY

    - Used for playing audio, for example playing music and notifications

- enumerator CAPTURE

    - Used for capturing audio, for example recording sound using a mic

- enumerator LOOPBACK

    - Used for generating audio from a DeviceDirection::RX device, which is intended to be captured back by a DeviceDirection::TX device

- enumerator TONE\_GENERATOR

    - Used for single tone and DTMF tone generation

- enum StreamDirection

    - Defines the direction of an audio stream.

*Values:*

- enumerator NONE

    - Default direction (invalid)

- enumerator RX

    - Specifies that the audio data will flow towards a sink device

- enumerator TX

    - Specifies that the audio data originates from a source device

- enum AmrwbpFrameFormat

    - Defines the properties of the audio data for compressed playback and transcoding.

*Values:*

- enumerator UNKNOWN

    - Default format (invalid)

- enumerator TRANSPORT\_INTERFACE\_FORMAT

    - Unsupported

- enumerator FILE\_STORAGE\_FORMAT

    - Specifies that the AMR header has been stripped from the audio data sent

- enum EcnrMode

    - On a voice call stream, enables or disables echo cancellation and noise reduction (ECNR). Used with an audio device capable of supporting ECNR.

*Values:*

- enumerator DISABLE

    - Disables ECNR

- enumerator ENABLE

    - Enables ECNR

- enum CalibrationInitStatus

    - Represents the state of the platform calibration for audio.

*Values:*

- enumerator UNKNOWN

    - Default state

- enumerator INIT\_SUCCESS

    - Platform calibrated successfully

- enumerator INIT\_FAILED

    - Platform calibration failed

- struct FormatParams

    - Represents the base class for compressed audio formats.

Subclassed by telux::audio::AmrwbpParams

- struct AmrwbpParams : public telux::audio::FormatParams

    - Specifies the details of the adaptive multirate wide band format frame.

Public Members

- uint32\_t bitWidth

    - Bit width of the stream (for example 16 bit)

- AmrwbpFrameFormat frameFormat

    - Refer to AmrwbpFrameFormat

- struct StreamConfig

    - Defines the parameters when creating an audio stream. The required parameters for a given use-case are as follows:

For regular voicecall: type, slotId, channelTypeMask, format, deviceTypes For hpcm-voicecall: type, slotId, channelTypeMask, format, deviceTypes, enableHpcm For ecall: type, slotId, channelTypeMask, format, deviceTypes, ecnrMode For proxy mic voicecall: type, slotId, channelTypeMask, format, deviceTypes, sampleRate

For playback: type, sampleRate, channelTypeMask, format, deviceTypes For incall-playback: type, sampleRate, channelTypeMask, format, deviceTypes, voicePaths For hpcm-playback: type, sampleRate, channelTypeMask, format, deviceTypes, voicePaths, enableHpcm For proxy speaker playback: type, channelTypeMask, format, deviceTypes, sampleRate

For capture: type, sampleRate, channelTypeMask, format, deviceTypes For incall-capture: type, sampleRate, channelTypeMask, format, deviceTypes, voicePaths For hpcm-capture: type, sampleRate, channelTypeMask, format, deviceTypes, voicePaths, enableHpcm

For loopback: type, sampleRate, channelTypeMask, format, deviceTypes

For tone-generation: type, channelTypeMask, format, deviceTypes

Public Members

- StreamType type

    - StreamType - defines purpose of the stream

- int modemSubId = 1

    - Deprecated, use the StreamConfig::slotId field instead of this

- SlotId slotId = INVALID\_SLOT\_ID

    - SlotId - specifies the slot ID where the UICC card is inserted

- uint32\_t sampleRate

    - Sample rate in Hz. Typical values are 8k, 16k, 32k and 48k. For Bluetooth use-cases, supported values are 8k and 16k

- ChannelTypeMask channelTypeMask

    - ChannelTypeMask - defines audio channels to use

- AudioFormat format

    - AudioFormat - defines audio format

- std::vector&lt;DeviceType&gt; deviceTypes

    - Defines the list of audio devices DeviceType to use for this stream. For StreamType::PLAY and StreamType::TONE\_GENERATOR, a single sink device should be specified. For StreamType::CAPTURE, a single source device should be specified. For StreamType::VOICE\_CALL and StreamType::LOOPBACK, both sink and source should be specified with sink as the first device and source as the second.

- std::vector&lt;Direction&gt; voicePaths

    - For an in-call and hpcm audio usecase, this represents the voice path direction Direction

- FormatParams \*formatParams

    - FormatParams - defines compressed playback format

- EcnrMode ecnrMode = EcnrMode::DISABLE

    - EcnrMode - true to enable ECNR on an ecall

- bool enableHpcm = false

    - True - if voice call is used with HPCM, false otherwise

- struct FormatInfo

    - Specifies the parameters when setting up streams for transcoding.

Public Members

- uint32\_t sampleRate

    - Sample rate in Hz, typical values 8k/16k/32k/48k Sample rate is a dummy paramter for voice stream and compressed playback

- ChannelTypeMask mask

    - Refer to ChannelTypeMask

- AudioFormat format

    - Refer to AudioFormat

- FormatParams \*params

    - Refer to FormatParams

- class IAudioListener : public telux::common::IServiceStatusListener

    - Listener for the audio service availability. Refer to telux::common::IServiceStatusListener for details.

When audio service becomes unavailable, if the client was waiting on any outstanding response callbacks for APIs that were called just before the SSR, those response callbacks will not be called anymore. For example, if stream-&gt;setVolume(callback) is called and SSR occurs then the ‘callback’ will be never invoked.

All the stream objects (IAudioVoiceStream/IAudioPlayStream/IAudioCaptureStream/ IAudioLoopbackStream/IAudioToneGeneratorStream) becomes invalid and should not be used after SSR. When SSR occurs, the implementation cleans up all resources associated with streams that were created before SSR. Application should create new audio stream.

The AudioFactory and IAudioManager objects remains valid even after SSR and can be used like they were used before SSR.

Public Functions

- inline virtual ~IAudioListener()

    - Destructor of IAudioListener.

- class IAudioManager

    - Provides the APIs to discover the supported audio devices, create streams, and subscribe for audio service status updates.

Public Functions

- virtual bool isSubsystemReady() = 0

    - Checks if the audio service is ready for use.

Deprecated Use getServiceStatus()

- Returns:

    - True if the audio service is ready for use, otherwise, False

- virtual telux::common::ServiceStatus getServiceStatus() = 0

    - Gets the audio service status.

- Returns:

    - telux::common::ServiceStatus::SERVICE\_AVAILABLE if the audio service is ready for use, telux::common::ServiceStatus::SERVICE\_UNAVAILABLE if the audio service is temporarily unavailable (possibly undergoing initialization), telux::common::ServiceStatus::SERVICE\_FAILED if the audio service needs re-initialization

- virtual std::future&lt;bool&gt; onSubsystemReady() = 0

    - Suggests when the audio service is ready.

Deprecated Use telux::common::InitResponseCb in AudioFactory::getAudioManager()

- Returns:

    - Future to block on until the service status is updated to read

- virtual telux::common::Status getDevices(GetDevicesResponseCb callback = nullptr) = 0

    - Gets the list of the supported audio devices.

- Parameters:

    - **callback** – **[in]** Mandatory, callback that will receive the list

- Returns:

    - telux::common::Status::SUCCESS if the request is initiated successfully, otherwise, an appropriate error code

- virtual telux::common::Status getStreamTypes(GetStreamTypesResponseCb callback = nullptr) = 0

    - Gets the list of the supported stream types.

- Parameters:

    - **callback** – **[in]** Mandatory, callback that will receive the list

- Returns:

    - Status telux::common::Status::SUCCESS if the request is initiated successfully, otherwise, an appropriate error code

- virtual telux::common::Status createStream(StreamConfig streamConfig, CreateStreamResponseCb callback = nullptr) = 0

    - Creates an audio stream with the parameters provided.

For incall playback/capture use cases, StreamType::VOICE\_CALL should be created before StreamType::PLAY and StreamType::CAPTURE.

On platforms with access control enabled, the caller must have TELUX\_AUDIO\_VOICE, TELUX\_AUDIO\_PLAY, TELUX\_AUDIO\_CAPTURE, or TELUX\_AUDIO\_FACTORY\_TEST permission to invoke this method successfully.

- Parameters:

    - - **streamConfig** – **[in]** Parameters of the stream
- **callback** – **[in]** Mandatory, invoked to pass the stream created

- Returns:

    - telux::common::Status::SUCCESS if the request is initiated successfully, otherwise, an appropriate error code

- virtual telux::common::Status createTranscoder(FormatInfo input, FormatInfo output, CreateTranscoderResponseCb callback) = 0

    - Set up the transcoder with the given parameters.

Transcoder instance is obtained in CreateTranscoderResponseCb. It can be used only for a single transcoding operation.

On platforms with access control enabled, the caller must have TELUX\_AUDIO\_TRANSCODE permission to invoke this method successfully.

- Parameters:

    - - **input** – **[in]** Details of the input to transcode
- **output** – **[in]** Details of the transcoded output required
- **callback** – **[in]** Mandatory, invoked to pass the transcoder instance

- Returns:

    - telux::common::Status::SUCCESS if the request is initiated successfully, otherwise, an appropriate error code

- virtual telux::common::Status deleteStream(std::shared\_ptr&lt;IAudioStream&gt; stream, DeleteStreamResponseCb callback = nullptr) = 0

    - Deletes the stream created with createStream(). It closes the stream and releases all resources allocated for this stream.

For incall playback/capture use cases, StreamType::PLAY and StreamType::CAPTURE streams should be deleted before StreamType::VOICE\_CALL.

On platforms with access control enabled, the caller must have TELUX\_AUDIO\_VOICE, TELUX\_AUDIO\_PLAY, TELUX\_AUDIO\_CAPTURE, or TELUX\_AUDIO\_FACTORY\_TEST permission to invoke this method successfully.

- Parameters:

    - - **stream** – **[in]** Stream to delete
- **callback** – **[in]** Optional, invoked to pass the result of the stream deletion

- Returns:

    - telux::common::Status::SUCCESS if the request is initiated successfully, otherwise, an appropriate error code

- virtual telux::common::Status registerListener(std::weak\_ptr&lt;IAudioListener&gt; listener) = 0

    - Registers the given listener to get notified when the audio service status changes. The method IAudioListener::onServiceStatusChange() is invoked to notify of the new status.

- Parameters:

    - **listener** – **[in]** Invoked to pass the new service status

- Returns:

    - telux::common::Status::SUCCESS if the listener is registered, otherwise, an appropriate error code

- virtual telux::common::Status deRegisterListener(std::weak\_ptr&lt;IAudioListener&gt; listener) = 0

    - Unregisters the given listener registered previously with registerListener().

- Parameters:

    - **listener** – **[in]** Listener to unregister

- Returns:

    - telux::common::Status::SUCCESS if the listener is deregistered, otherwise, an appropriate error code

- virtual telux::common::Status getCalibrationInitStatus(GetCalInitStatusResponseCb callback) = 0

    - Gets the current initialization status of the audio calibration database (ACDB). This status is obtained in the GetCalInitStatusResponseCb callback.

- Parameters:

    - **callback** – **[in]** Mandatory, invoked to pass the initialization status

- Returns:

    - telux::common::Status::SUCCESS if the request is initiated successfully, otherwise, an appropriate error code

- inline virtual ~IAudioManager()

    - Destructor of the IAudioManager.

- class IAudioDevice

    - Represents an audio device. Used in conjunction with GetDevicesResponseCb.

Public Functions

- virtual DeviceType getType() = 0

    - Gets the type of the audio device.

- Returns:

    - Type of the audio device

- virtual DeviceDirection getDirection() = 0

    - Gets the direction of the audio device.

- Returns:

    - Direction of the audio device

- inline virtual ~IAudioDevice()

    - Destructor of the IAudioDevice.

Last Published: Apr 14, 2026

Previous Topic
 
Audio Next Topic

Audio stream