Telematics SDK - API Reference  v1.54.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
 Audio Manager is a primary interface for audio operations. It provide APIs to manage Streams ( like voice, play, record etc) and sound cards. More...
 
class  telux::audio::IAudioDevice
 Audio device and it's characteristics like Direction (Sink or Source), type. More...
 

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_MIC = 257 }
 
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

Frame format common parameters

struct telux::audio::AmrwbpParams

Frame format codec specific parameters

Data Fields

uint32_t bitWidth
 
AmrwbpFrameFormat frameFormat
 

Field Documentation

uint32_t telux::audio::AmrwbpParams::bitWidth

Bitwidth of Stream, Typical Values <16/24>.

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

Common Stream configuration parameters

Data Fields
StreamType type
int modemSubId
Deprecated
Represents modem Subscription ID, Default set to 1. Applicable only for Voice Call
SlotId slotId

Represents slotId, applicable for voice call only

uint32_t sampleRate

Sample Rate of Stream, Typical Values <8k/16k/32k/48k>

ChannelTypeMask channelTypeMask
AudioFormat format
vector< DeviceType > deviceTypes
vector< Direction > voicePaths

Represent voice path direction for in call audio. TX for Uplink and RX for Downlink.>

FormatParams * formatParams
EcnrMode ecnrMode

Represents ECNR mode for stream. It is applicable only to StreamType::VOICE_CALL

struct telux::audio::FormatInfo

Represents information about the audio format.

Data Fields
uint32_t sampleRate

Sample Rate of audio, Typical Values <8k/16k/32k/48k>

ChannelTypeMask mask

parameter for configuration of channel type

AudioFormat format

Represents audio format

FormatParams * params

Represents codec specific parameters, like Frame Format

class telux::audio::IAudioListener

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

Audio Manager is a primary interface for audio operations. It provide APIs to manage Streams ( like voice, play, record etc) and sound cards.

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

Member Function Documentation

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

Checks the status of audio subsystems and returns the result.

Returns
If true that means AudioManager is ready for performing audio operations.
Deprecated
Use getServiceStatus API
virtual telux::common::ServiceStatus telux::audio::IAudioManager::getServiceStatus ( )
pure virtual

This status indicates whether the object is in a usable state or not.

Returns
SERVICE_AVAILABLE - if audio manager is ready to use. SERVICE_UNAVAILABLE - if audio manager is temporarily unavailable to use. SERVICE_FAILED - if audio manager encountered an irrecoverable failure and can not be used.
virtual std::future<bool> telux::audio::IAudioManager::onSubsystemReady ( )
pure virtual

Wait for Audio subsystem to be ready.

Returns
A future that caller can wait on to be notified when audio subsystem is ready.
Deprecated
Use InitResponseCb callback in factory API getAudioManager.
virtual telux::common::Status telux::audio::IAudioManager::getDevices ( GetDevicesResponseCb  callback = nullptr)
pure virtual

Get the list of supported audio devices, which are currently supported in the audio subsystem

Parameters
[in]callbackcallback pointer to get the response of getDevices.
Returns
Status of request i.e. success or suitable status code.
virtual telux::common::Status telux::audio::IAudioManager::getStreamTypes ( GetStreamTypesResponseCb  callback = nullptr)
pure virtual

Get the list of supported audio streams types, which are currently supported in the audio subsystem

Parameters
[in]callbackcallback pointer to get the response of getStreamTypes.
Returns
Status of request i.e. success or suitable status code.
virtual telux::common::Status telux::audio::IAudioManager::createStream ( StreamConfig  streamConfig,
CreateStreamResponseCb  callback = nullptr 
)
pure virtual

Creates the stream for audio operation

On platforms with Access control enabled, Caller needs to have TELUX_AUDIO_VOICE or TELUX_AUDIO_PLAY or TELUX_AUDIO_CAPTURE or TELUX_AUDIO_FACTORY_TEST permission to invoke this API successfully.

Parameters
[in]streamConfigstream configuration.
[in]callbackcallback pointer to get the response of createStream.
Returns
Status of request i.e. success or suitable status code.
virtual telux::common::Status telux::audio::IAudioManager::createTranscoder ( FormatInfo  input,
FormatInfo  output,
CreateTranscoderResponseCb  callback 
)
pure virtual

Creates an instance of transcoder that can be used for transcoding operations. The supported transcoding is real time transcoding, which takes the playback time of file for completing the opearation. Each instance returned can be used for single transcoding operation. The instance can not be used for multiple transcoding operation.

On platforms with Access control enabled, Caller needs to have TELUX_AUDIO_TRANSCODE permission to invoke this API successfully.

Parameters
[in]inputconfiguration of input buffers that needs to be transcoded.
[in]outputconfiguration of transcoded output buffers.
[in]callbackcallback pointer to get the response of createTranscoder.
Returns
Status of request i.e. success or suitable status code.
virtual telux::common::Status telux::audio::IAudioManager::deleteStream ( std::shared_ptr< IAudioStream stream,
DeleteStreamResponseCb  callback = nullptr 
)
pure virtual

Deletes the specified stream which was created before

On platforms with Access control enabled, Caller needs to have TELUX_AUDIO_VOICE or TELUX_AUDIO_PLAY or TELUX_AUDIO_CAPTURE or TELUX_AUDIO_FACTORY_TEST permission to invoke this API successfully.

Parameters
[in]streamreference to stream to be deleted.
[in]callbackcallback pointer to get the response of deleteStream.
Returns
Status of request i.e. success or suitable status code.
virtual telux::common::Status telux::audio::IAudioManager::registerListener ( std::weak_ptr< IAudioListener listener)
pure virtual

Register a listener to get notified when service status changes.

Parameters
[in]listenerPointer of IServiceListener object that processes the notification
Returns
Status of registerListener i.e success or suitable status code.
virtual telux::common::Status telux::audio::IAudioManager::deRegisterListener ( std::weak_ptr< IAudioListener listener)
pure virtual

Remove a previously registered listener.

Parameters
[in]listenerPreviously registered IServiceListener that needs to be removed
Returns
Status of deRegisterListener, success or suitable status code
virtual telux::common::Status telux::audio::IAudioManager::getCalibrationInitStatus ( GetCalInitStatusResponseCb  callback)
pure virtual

Get calibration status. Returns whether audio subsystem was able to successfully initialize calibration in system. Calibration init status is available after the initialization of the audio subsystem or after re-intialization of audio subsytem in case of sub system restart is triggered.

Parameters
[in]callbackcallback pointer to get the response of getCalibrationInitStatus.
Returns
Status of getCalibrationInitStatus, success or suitable status code.
class telux::audio::IAudioDevice

Audio device and it's characteristics like Direction (Sink or Source), type.

Public Member Functions

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

Constructor & Destructor Documentation

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

Member Function Documentation

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

Get the type of Device (i.e SPEAKER, MIC etc)

Returns
DeviceType
virtual DeviceDirection telux::audio::IAudioDevice::getDirection ( )
pure virtual

Provide direction of device whether is Sink for audio data ( RX i.e. speaker, etc) or Source for audio data ( TX i.e. mic, etc)

Returns
DeviceDirection

Typedef Documentation

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

This function is called with the response to getDevices API.

The callback can be invoked from multiple different threads. The implementation should be thread safe.

Parameters
[in]devicesDevices list.
[in]errorReturn code which indicates whether the operation succeeded or not. ErrorCode
using telux::audio::GetStreamTypesResponseCb = typedef std::function<void(std::vector<StreamType> streamTypes, telux::common::ErrorCode error)>

This function is called with the response to getStreamTypes API.

The callback can be invoked from multiple different threads. The implementation should be thread safe.

Parameters
[in]streamTypesStream type list.
[in]errorReturn code which indicates whether the operation succeeded or not. ErrorCode
using telux::audio::CreateStreamResponseCb = typedef std::function<void(std::shared_ptr<IAudioStream> &stream, telux::common::ErrorCode error)>

This function is called with the response to createStream API.

The callback can be invoked from multiple different threads. The implementation should be thread safe.

Parameters
[in]streamInterface pointer of Stream created. VOICE_CALL - Provides IAudioVoiceStream pointer PLAY - Provides IAudioPlayStream pointer CAPTURE - Provides IAudioCaptureStream pointer
[in]errorReturn code which indicates whether the operation succeeded or not. ErrorCode
using telux::audio::CreateTranscoderResponseCb = typedef std::function<void( std::shared_ptr<ITranscoder> &transcoder, telux::common::ErrorCode error)>

This function is called with the response to createTranscoder API.

The callback can be invoked from multiple different threads. The implementation should be thread safe.

Parameters
[in]transcoderInterface pointer of transcoder.
[in]errorReturn code which indicates whether the operation succeeded or not. ErrorCode
using telux::audio::DeleteStreamResponseCb = typedef std::function<void(telux::common::ErrorCode error)>

This function is called with the response to deleteStream API.

The callback can be invoked from multiple different threads. The implementation should be thread safe.

Parameters
[in]errorReturn code which indicates whether the operation succeeded or not. ErrorCode
using telux::audio::GetCalInitStatusResponseCb = typedef std::function<void(CalibrationInitStatus calInitStatus, telux::common::ErrorCode error)>

This function is called with the response to getCalibrationInitStatus API.

The callback can be invoked from multiple different threads. The implementation should be thread safe.

Parameters
[in]calInitStatusState of calibration initialization.
[in]errorReturn code which indicates whether the operation succeeded or not. ErrorCode

Enumeration Type Documentation

Represent type of device like SPEAKER, MIC, etc.

Enumerator
DEVICE_TYPE_NONE 
DEVICE_TYPE_SPEAKER 
DEVICE_TYPE_MIC 

Represent Device Direction RX (Sink), Tx (Source)

Enumerator
NONE 
RX 
TX 

Represent Stream Type

Enumerator
NONE 
VOICE_CALL 

Voice Call, Provides Audio Session for an active Voice

PLAY 

Plaback, Provides Audio Playback Session

CAPTURE 

Capture, Provides Audio Capture/Record Session

LOOPBACK 

Loopback, Provides loopback between source and sink devices

TONE_GENERATOR 

Tone Generator, Generates tone on sink device

Represent Stream Direction

Enumerator
NONE 
RX 

Represents Session Directed towards Sink Device

TX 

Represents Session Directed from Source Device

Representative of type of frame structure. Typical transport interface or file storage.

Enumerator
UNKNOWN 

Unknown format

TRANSPORT_INTERFACE_FORMAT 
FILE_STORAGE_FORMAT 

Enable/Disable ECNR(Echo Cancellation and Noise Reduction) on the audio stream. When enabling this the audio stream should be associated with devices that are capable of doing ECNR. It is only applicable to StreamType::VOICE_CALL.

Enumerator
DISABLE 

To disable the ECNR mode

ENABLE 

To enable the ECNR mode. Applicable only to StreamType::VOICE_CALL

Represents state of Audio calibration initialization in system. API gives status that tells whether the calibration initialized by audio sub system.

Enumerator
UNKNOWN 

calibration initialization status is unknown

INIT_SUCCESS 

calibration initialized successfully

INIT_FAILED 

calibration initialization failed