Telematics SDK - API Reference  v1.55.0
Audio Manager

Data Structures

struct  telux::audio::FormatParams
 
struct  telux::audio::AmrwbpParams
 
struct  telux::audio::StreamConfig
 
struct  telux::audio::FormatInfo
 
class  telux::audio::IAudioListener
 
class  telux::audio::IAudioManager
 
class  telux::audio::IAudioDevice
 

Typedefs

using telux::audio::GetDevicesResponseCb = std::function< void(std::vector< std::shared_ptr< IAudioDevice >> devices, telux::common::ErrorCode error)>
 
using telux::audio::GetStreamTypesResponseCb = std::function< void(std::vector< StreamType > streamTypes, telux::common::ErrorCode error)>
 
using telux::audio::CreateStreamResponseCb = std::function< void(std::shared_ptr< IAudioStream > &stream, telux::common::ErrorCode error)>
 
using telux::audio::CreateTranscoderResponseCb = std::function< void(std::shared_ptr< ITranscoder > &transcoder, telux::common::ErrorCode error)>
 
using telux::audio::DeleteStreamResponseCb = std::function< void(telux::common::ErrorCode error)>
 
using telux::audio::GetCalInitStatusResponseCb = std::function< void(CalibrationInitStatus calInitStatus, telux::common::ErrorCode error)>
 

Enumerations

enum  telux::audio::DeviceType {
  telux::audio::DEVICE_TYPE_NONE = -1, telux::audio::DEVICE_TYPE_SPEAKER = 1, telux::audio::DEVICE_TYPE_SPEAKER_2 = 2, telux::audio::DEVICE_TYPE_SPEAKER_3 = 3,
  telux::audio::DEVICE_TYPE_BT_SCO_SPEAKER = 4, telux::audio::DEVICE_TYPE_PROXY_SPEAKER = 5, telux::audio::DEVICE_TYPE_MIC = 257, telux::audio::DEVICE_TYPE_MIC_2 = 258,
  telux::audio::DEVICE_TYPE_MIC_3 = 259, telux::audio::DEVICE_TYPE_BT_SCO_MIC = 260, telux::audio::DEVICE_TYPE_PROXY_MIC = 261
}
 
enum  telux::audio::DeviceDirection { telux::audio::DeviceDirection::NONE = -1, telux::audio::DeviceDirection::RX = 1, telux::audio::DeviceDirection::TX = 2 }
 
enum  telux::audio::StreamType {
  telux::audio::StreamType::NONE = -1, telux::audio::StreamType::VOICE_CALL = 1, telux::audio::StreamType::PLAY = 2, telux::audio::StreamType::CAPTURE = 3,
  telux::audio::StreamType::LOOPBACK = 4, telux::audio::StreamType::TONE_GENERATOR = 5
}
 
enum  telux::audio::StreamDirection { telux::audio::StreamDirection::NONE = -1, telux::audio::StreamDirection::RX = 1, telux::audio::StreamDirection::TX = 2 }
 
enum  telux::audio::AmrwbpFrameFormat { telux::audio::AmrwbpFrameFormat::UNKNOWN = -1, telux::audio::AmrwbpFrameFormat::TRANSPORT_INTERFACE_FORMAT, telux::audio::AmrwbpFrameFormat::FILE_STORAGE_FORMAT }
 
enum  telux::audio::EcnrMode { telux::audio::EcnrMode::DISABLE = 0, telux::audio::EcnrMode::ENABLE = 1 }
 
enum  telux::audio::CalibrationInitStatus { telux::audio::CalibrationInitStatus::UNKNOWN = -1, telux::audio::CalibrationInitStatus::INIT_SUCCESS = 0, telux::audio::CalibrationInitStatus::INIT_FAILED = 1 }
 

Detailed Description

This section contains APIs related to Audio Manager operation.


Data Structure Documentation

struct telux::audio::FormatParams

Represents the base class for compressed audio formats.

struct telux::audio::AmrwbpParams

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

Data Fields

uint32_t bitWidth
 
AmrwbpFrameFormat frameFormat
 

Field Documentation

uint32_t telux::audio::AmrwbpParams::bitWidth

Bit width of the stream, typically 16 or 24

AmrwbpFrameFormat telux::audio::AmrwbpParams::frameFormat
struct telux::audio::StreamConfig

Defines the parameters when creating an audio stream.

Data Fields
StreamType type

Refer to StreamType

int modemSubId
Deprecated
represents modem subscription ID (default set to 1). Use the StreamConfig::slotId field instead of this
SlotId slotId

SlotId – specifies the slot ID where the UICC card is inserted. Used in conjuction with StreamType::VOICE_CALL only

uint32_t sampleRate

Sample rate in Hz, typical values 8k/16k/32k/48k

ChannelTypeMask channelTypeMask

Refer to ChannelTypeMask

AudioFormat format

Refer to AudioFormat

vector< DeviceType > deviceTypes

Defines the list of audio devices DeviceType to use for this stream

vector< Direction > voicePaths

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

FormatParams * formatParams

Refer to FormatParams

EcnrMode ecnrMode

Refer to EcnrMode

struct telux::audio::FormatInfo

Specifies the parameters when setting up streams for transcoding.

Data Fields
uint32_t sampleRate

Sample rate in Hz, typical values 8k/16k/32k/48k

ChannelTypeMask mask

Refer to ChannelTypeMask

AudioFormat format

Refer to AudioFormat

FormatParams * params

Refer to FormatParams

class telux::audio::IAudioListener

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

Public Member Functions

virtual ~IAudioListener ()
 
- Public Member Functions inherited from telux::common::IServiceStatusListener
virtual void onServiceStatusChange (ServiceStatus status)
 
virtual ~IServiceStatusListener ()
 

Constructor & Destructor Documentation

virtual telux::audio::IAudioListener::~IAudioListener ( )
virtual

Destructor of IAudioListener.

class telux::audio::IAudioManager

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

Public Member Functions

virtual bool isSubsystemReady ()=0
 
virtual telux::common::ServiceStatus getServiceStatus ()=0
 
virtual std::future< bool > onSubsystemReady ()=0
 
virtual telux::common::Status getDevices (GetDevicesResponseCb callback=nullptr)=0
 
virtual telux::common::Status getStreamTypes (GetStreamTypesResponseCb callback=nullptr)=0
 
virtual telux::common::Status createStream (StreamConfig streamConfig, CreateStreamResponseCb callback=nullptr)=0
 
virtual telux::common::Status createTranscoder (FormatInfo input, FormatInfo output, CreateTranscoderResponseCb callback)=0
 
virtual telux::common::Status deleteStream (std::shared_ptr< IAudioStream > stream, DeleteStreamResponseCb callback=nullptr)=0
 
virtual telux::common::Status registerListener (std::weak_ptr< IAudioListener > listener)=0
 
virtual telux::common::Status deRegisterListener (std::weak_ptr< IAudioListener > listener)=0
 
virtual telux::common::Status getCalibrationInitStatus (GetCalInitStatusResponseCb callback)=0
 
virtual ~IAudioManager ()
 

Constructor & Destructor Documentation

virtual telux::audio::IAudioManager::~IAudioManager ( )
virtual

Destructor of the IAudioManager.

Member Function Documentation

virtual bool telux::audio::IAudioManager::isSubsystemReady ( )
pure virtual

Checks if the audio service is ready for use.

Returns
True if the audio service is ready for use, otherwise, False
Deprecated
Use getServiceStatus()
virtual telux::common::ServiceStatus telux::audio::IAudioManager::getServiceStatus ( )
pure virtual

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<bool> telux::audio::IAudioManager::onSubsystemReady ( )
pure virtual

Suggests when the audio service is ready.

Returns
Future to block on until the service status is updated to read
Deprecated
Use telux::common::InitResponseCb in AudioFactory::getAudioManager()
virtual telux::common::Status telux::audio::IAudioManager::getDevices ( GetDevicesResponseCb  callback = nullptr)
pure virtual

Gets the list of the supported audio devices.

Parameters
[in]callbackMandatory, 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 telux::audio::IAudioManager::getStreamTypes ( GetStreamTypesResponseCb  callback = nullptr)
pure virtual

Gets the list of the supported stream types.

Parameters
[in]callbackMandatory, 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 telux::audio::IAudioManager::createStream ( StreamConfig  streamConfig,
CreateStreamResponseCb  callback = nullptr 
)
pure virtual

Creates an audio stream with the parameters provided.

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
[in]streamConfigParameters of the stream
[in]callbackMandatory, invoked to pass the stream created
Returns
Status telux::common::Status::SUCCESS if the request is initiated successfully, otherwise, an appropriate error code
virtual telux::common::Status telux::audio::IAudioManager::createTranscoder ( FormatInfo  input,
FormatInfo  output,
CreateTranscoderResponseCb  callback 
)
pure virtual

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
[in]inputDetails of the input to transcode
[in]outputDetails of the transcoded output required
[in]callbackInvoked to pass the transcoder instance
Returns
Status telux::common::Status::SUCCESS if the request is initiated successfully, otherwise, an appropriate error code
virtual telux::common::Status telux::audio::IAudioManager::deleteStream ( std::shared_ptr< IAudioStream stream,
DeleteStreamResponseCb  callback = nullptr 
)
pure virtual

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

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
[in]streamStream to delete
[in]callbackOptional, invoked to pass the result of the stream deletion
Returns
Status telux::common::Status::SUCCESS if the request is initiated successfully, otherwise, an appropriate error code
virtual telux::common::Status telux::audio::IAudioManager::registerListener ( std::weak_ptr< IAudioListener listener)
pure virtual

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
[in]listenerInvoked 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 telux::audio::IAudioManager::deRegisterListener ( std::weak_ptr< IAudioListener listener)
pure virtual

Unregisters the given listener registered previously with registerListener().

Parameters
[in]listenerListener to unregister
Returns
telux::common::Status::SUCCESS if the listener is unregistered, otherwise, an appropriate error code
virtual telux::common::Status telux::audio::IAudioManager::getCalibrationInitStatus ( GetCalInitStatusResponseCb  callback)
pure virtual

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

Parameters
[in]callbackInvoked to pass the initialization status
Returns
Status telux::common::Status::SUCCESS if the request is initiated successfully, otherwise, an appropriate error code
class telux::audio::IAudioDevice

Represents an audio device. Used in conjunction with GetDevicesResponseCb.

Public Member Functions

virtual DeviceType getType ()=0
 
virtual DeviceDirection getDirection ()=0
 
virtual ~IAudioDevice ()
 

Constructor & Destructor Documentation

virtual telux::audio::IAudioDevice::~IAudioDevice ( )
virtual

Destructor of the IAudioDevice.

Member Function Documentation

virtual DeviceType telux::audio::IAudioDevice::getType ( )
pure virtual

Gets the type of the audio device.

Returns
Type of the audio device
virtual DeviceDirection telux::audio::IAudioDevice::getDirection ( )
pure virtual

Gets the direction of the audio device.

Returns
Direction of the audio device

Typedef Documentation

using telux::audio::GetDevicesResponseCb = typedef std::function<void(std::vector< std::shared_ptr<IAudioDevice>> devices, telux::common::ErrorCode error)>

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

Parameters
[in]devicesList of the IAudioDevice devices
[in]errortelux::common::ErrorCode::SUCCESS if the list is fetched successfully, otherwise, an appropriate error code
using telux::audio::GetStreamTypesResponseCb = typedef std::function<void(std::vector<StreamType> streamTypes, telux::common::ErrorCode error)>

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

Parameters
[in]streamTypesList of the StreamType types
[in]errortelux::common::ErrorCode::SUCCESS if the list is fetched successfully, otherwise, an appropriate error code
using telux::audio::CreateStreamResponseCb = typedef std::function<void(std::shared_ptr<IAudioStream> &stream, telux::common::ErrorCode error)>

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.

Parameters
[in]streamAudio stream created or nullptr if creation failed
[in]errortelux::common::ErrorCode::SUCCESS if the stream is created successfully, otherwise, an appropriate error code
using telux::audio::CreateTranscoderResponseCb = typedef std::function<void(std::shared_ptr<ITranscoder> &transcoder, telux::common::ErrorCode error)>

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

Parameters
[in]transcoderITranscoder instance or nullptr if transcoder can't be setup
[in]errortelux::common::ErrorCode::SUCCESS if the transcoder is set up successfully, otherwise, an appropriate error code
using telux::audio::DeleteStreamResponseCb = typedef std::function<void(telux::common::ErrorCode error)>

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

Parameters
[in]errortelux::common::ErrorCode::SUCCESS if the stream is deleted, otherwise, an appropriate error code
using telux::audio::GetCalInitStatusResponseCb = typedef std::function<void(CalibrationInitStatus calInitStatus, telux::common::ErrorCode error)>

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

Parameters
[in]calInitStatusCalibrationInitStatus::INIT_SUCCESS if the ACDB is initialized successfully, CalibrationInitStatus::INIT_FAILED if initialization failed
[in]errortelux::common::ErrorCode::SUCCESS if the status is is fetched successfully, otherwise, an appropriate error code

Enumeration Type Documentation

Represents an audio device. Each device is mapped to its corresponding platform specific audio device type. Below table provides default mapping of devices on a QTI's reference platform.

Applicable for SA515M, SA415M, SA410M, SA2150P based software products:

Telsdk device type Direction Mapped HAL device
DEVICE_TYPE_NONE N/A AUDIO_DEVICE_NONE
DEVICE_TYPE_SPEAKER RX AUDIO_DEVICE_OUT_SPEAKER
DEVICE_TYPE_SPEAKER_2 RX AUDIO_DEVICE_OUT_EARPIECE
DEVICE_TYPE_SPEAKER_3 RX AUDIO_DEVICE_OUT_WIRED_HEADSET
DEVICE_TYPE_BT_SCO_SPEAKER RX AUDIO_DEVICE_NONE
DEVICE_TYPE_PROXY_SPEAKER RX AUDIO_DEVICE_OUT_PROXY
DEVICE_TYPE_MIC TX AUDIO_DEVICE_IN_BACK_MIC
DEVICE_TYPE_MIC_2 TX AUDIO_DEVICE_IN_BUILTIN_MIC
DEVICE_TYPE_MIC_3 TX AUDIO_DEVICE_IN_WIRED_HEADSET
DEVICE_TYPE_BT_SCO_MIC TX AUDIO_DEVICE_NONE
DEVICE_TYPE_PROXY_MIC TX AUDIO_DEVICE_IN_PROXY

Applicable for SA525M based software products:

Telsdk device type Direction Mapped PAL device
DEVICE_TYPE_NONE N/A PAL_DEVICE_NONE
DEVICE_TYPE_SPEAKER RX PAL_DEVICE_OUT_SPEAKER
DEVICE_TYPE_SPEAKER_2 RX PAL_DEVICE_OUT_HANDSET
DEVICE_TYPE_SPEAKER_3 RX PAL_DEVICE_OUT_WIRED_HEADSET
DEVICE_TYPE_BT_SCO_SPEAKER RX PAL_DEVICE_OUT_BLUETOOTH_SCO
DEVICE_TYPE_PROXY_SPEAKER RX PAL_DEVICE_OUT_PROXY
DEVICE_TYPE_MIC TX PAL_DEVICE_IN_SPEAKER_MIC
DEVICE_TYPE_MIC_2 TX PAL_DEVICE_IN_HANDSET_MIC
DEVICE_TYPE_MIC_3 TX PAL_DEVICE_IN_WIRED_HEADSET
DEVICE_TYPE_BT_SCO_MIC TX PAL_DEVICE_IN_BLUETOOTH_SCO_HEADSET
DEVICE_TYPE_PROXY_MIC TX PAL_DEVICE_IN_PROXY

Enumerator
DEVICE_TYPE_NONE 

Default device (invalid)

DEVICE_TYPE_SPEAKER 

Sink device as per above mapping

DEVICE_TYPE_SPEAKER_2 

Sink device as per above mapping

DEVICE_TYPE_SPEAKER_3 

Sink device as per above mapping

DEVICE_TYPE_BT_SCO_SPEAKER 

Bluetooth sink device for voice call

DEVICE_TYPE_PROXY_SPEAKER 

Virtual sink device as per above mapping

DEVICE_TYPE_MIC 

Source device as per above mapping

DEVICE_TYPE_MIC_2 

Source device as per above mapping

DEVICE_TYPE_MIC_3 

Source device as per above mapping

DEVICE_TYPE_BT_SCO_MIC 

Bluetooth source device for voice call

DEVICE_TYPE_PROXY_MIC 

Virtual mic connected over ethernet

Defines the direction of an audio device.

Enumerator
NONE 

Default direction (invalid)

RX 

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

TX 

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

Defines the type of the audio stream and the type's purpose.

Enumerator
NONE 

Default type (invalid)

VOICE_CALL 

Used for audio over a cellular network

PLAY 

Used for playing audio, for example playing music and notifications

CAPTURE 

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

LOOPBACK 

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

TONE_GENERATOR 

Used for single tone and DTMF tone generation

Defines the direction of an audio stream.

Enumerator
NONE 

Default direction (invalid)

RX 

Specifies that the audio data will flow towards a sink device

TX 

Specifies that the audio data originates from a source device

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

Enumerator
UNKNOWN 

Default format (invalid)

TRANSPORT_INTERFACE_FORMAT 

Unsupported

FILE_STORAGE_FORMAT 

Specifies that the audio content from AMR* format file has been parsed and only actual audio content is sent for playback

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

Enumerator
DISABLE 

Disables ECNR

ENABLE 

Enables ECNR

Represents the state of the platform calibration for audio.

Enumerator
UNKNOWN 

Default state

INIT_SUCCESS 

Platform calibrated successfully

INIT_FAILED 

Platform calibration failed