Telematics SDK - API Reference
v1.63.4
|
Data Structures | |
struct | telux::audio::ChannelVolume |
struct | telux::audio::StreamVolume |
struct | telux::audio::StreamMute |
struct | telux::audio::DtmfTone |
class | telux::audio::IVoiceListener |
class | telux::audio::IPlayListener |
class | telux::audio::IAudioBuffer |
class | telux::audio::IStreamBuffer |
class | telux::audio::IAudioStream |
class | telux::audio::IAudioVoiceStream |
class | telux::audio::IAudioPlayStream |
class | telux::audio::IAudioCaptureStream |
class | telux::audio::IAudioLoopbackStream |
class | telux::audio::IAudioToneGeneratorStream |
Typedefs | |
using | telux::audio::ChannelTypeMask = int |
using | telux::audio::GetStreamDeviceResponseCb = std::function< void(std::vector< DeviceType > devices, telux::common::ErrorCode error)> |
using | telux::audio::GetStreamVolumeResponseCb = std::function< void(StreamVolume volume, telux::common::ErrorCode error)> |
using | telux::audio::GetStreamMuteResponseCb = std::function< void(StreamMute mute, telux::common::ErrorCode error)> |
using | telux::audio::WriteResponseCb = std::function< void(std::shared_ptr< IStreamBuffer > buffer, uint32_t bytesWritten, telux::common::ErrorCode error)> |
using | telux::audio::ReadResponseCb = std::function< void(std::shared_ptr< IStreamBuffer > buffer, telux::common::ErrorCode error)> |
Enumerations | |
enum | telux::audio::Direction { telux::audio::Direction::RX = 1, telux::audio::Direction::TX = 2 } |
enum | telux::audio::ChannelType { telux::audio::LEFT = (1 << 0), telux::audio::RIGHT = (1 << 1) } |
enum | telux::audio::AudioFormat { telux::audio::AudioFormat::UNKNOWN = -1, telux::audio::AudioFormat::PCM_16BIT_SIGNED = 1, telux::audio::AudioFormat::AMRNB = 20, telux::audio::AudioFormat::AMRWB, telux::audio::AudioFormat::AMRWB_PLUS } |
enum | telux::audio::DtmfLowFreq { telux::audio::DtmfLowFreq::FREQ_697 = 697, telux::audio::DtmfLowFreq::FREQ_770 = 770, telux::audio::DtmfLowFreq::FREQ_852 = 852, telux::audio::DtmfLowFreq::FREQ_941 = 941 } |
enum | telux::audio::DtmfHighFreq { telux::audio::DtmfHighFreq::FREQ_1209 = 1209, telux::audio::DtmfHighFreq::FREQ_1336 = 1336, telux::audio::DtmfHighFreq::FREQ_1477 = 1477, telux::audio::DtmfHighFreq::FREQ_1633 = 1633 } |
enum | telux::audio::StopType { telux::audio::StopType::FORCE_STOP, telux::audio::StopType::STOP_AFTER_PLAY } |
This section contains APIs related to Audio Stream operation.
struct telux::audio::ChannelVolume |
Defines the volume levels for a given audio channel.
Data Fields | ||
---|---|---|
ChannelType | channelType |
ChannelType to which the volume level is associated. |
float | vol |
Volume level – minimum 0.0 and maximum 1.0 |
struct telux::audio::StreamVolume |
Defines the volume levels for the audio device.
Data Fields | ||
---|---|---|
vector< ChannelVolume > | volume |
List of the volume levels per channel, specified by ChannelVolume |
StreamDirection | dir |
StreamDirection associated with the device |
struct telux::audio::StreamMute |
Specifies the mute state of the audio device.
Data Fields | ||
---|---|---|
bool | enable |
True if the device is muted, False if the device is unmuted |
StreamDirection | dir |
StreamDirection associated with the device |
struct telux::audio::DtmfTone |
Defines the characteristics of the DTMF tone.
Data Fields | ||
---|---|---|
DtmfLowFreq | lowFreq |
Lower frequency associated with the DTMF tone |
DtmfHighFreq | highFreq |
Higher frequency associated with the DTMF tone |
StreamDirection | direction |
StreamDirection associated with the stream |
class telux::audio::IVoiceListener |
Listener for a DTMF tone detected event on a StreamType::VOICE_CALL stream.
Public Member Functions | |
virtual void | onDtmfToneDetection (DtmfTone dtmfTone) |
virtual | ~IVoiceListener () |
|
virtual |
Destructor of the IVoiceListener.
|
virtual |
Called when a DTMF tone is detected on a StreamType::VOICE_CALL stream. Used in conjuction with IAudioVoiceStream::registerListener().
[in] | dtmfTone | Contains details of the tone detected |
class telux::audio::IPlayListener |
Listener for events on a playback stream.
Public Member Functions | |
virtual void | onReadyForWrite () |
virtual void | onPlayStopped () |
virtual | ~IPlayListener () |
|
virtual |
Destructor of IPlayListener.
|
virtual |
Called when the audio pipeline is ready to accept the next buffer to play during compressed playback.
|
virtual |
Called when the compressed playback has stopped.
class telux::audio::IAudioBuffer |
Represents the buffer containing the audio data for playback when used with the StreamType::PLAY stream. Represents the audio data received when used with the StreamType::CAPTURE stream.
Public Member Functions | |
virtual size_t | getMinSize ()=0 |
virtual size_t | getMaxSize ()=0 |
virtual uint8_t * | getRawBuffer ()=0 |
virtual uint32_t | getDataSize ()=0 |
virtual void | setDataSize (uint32_t size)=0 |
virtual telux::common::Status | reset ()=0 |
virtual | ~IAudioBuffer () |
|
virtual |
Destructor of the IAudioBuffer.
|
pure virtual |
For the StreamType::PLAY stream, specifies the optimal number of bytes that must be sent for playback. For the StreamType::CAPTURE stream, specifies the optimal number of bytes that can be read.
|
pure virtual |
For the StreamType::PLAY stream, specifies the maximum number of bytes that can be sent for playback. For the StreamType::CAPTURE stream, specifies the maximum number of bytes that can be read.
|
pure virtual |
Gives the managed raw buffer. It is freed when IAudioBuffer is destructed. For the StreamType::PLAY stream, the actual audio samples should be copied into this raw buffer for playback. For the StreamType::CAPTURE stream, the actual audio contents are obtained from this buffer.
|
pure virtual |
For the StreamType::CAPTURE stream, specifies how many bytes were read. Not used for the StreamType::PLAY stream.
|
pure virtual |
For the StreamType::PLAY stream, specifies how many bytes should be played. Not used for the StreamType::CAPTURE stream.
|
pure virtual |
Clears the contents of the managed raw buffer.
class telux::audio::IStreamBuffer |
Implements the IAudioBuffer interface to give contexual meaning to its methods based on the StreamType type associated with the stream, with which this buffer will be used.
Public Member Functions | |
virtual | ~IStreamBuffer () |
Public Member Functions inherited from telux::audio::IAudioBuffer | |
virtual size_t | getMinSize ()=0 |
virtual size_t | getMaxSize ()=0 |
virtual uint8_t * | getRawBuffer ()=0 |
virtual uint32_t | getDataSize ()=0 |
virtual void | setDataSize (uint32_t size)=0 |
virtual telux::common::Status | reset ()=0 |
virtual | ~IAudioBuffer () |
|
virtual |
Destructor of the IStreamBuffer.
class telux::audio::IAudioStream |
Base class for all audio stream types. Contains the common properties and methods.
Public Member Functions | |
virtual StreamType | getType ()=0 |
virtual telux::common::Status | setDevice (std::vector< DeviceType > devices, telux::common::ResponseCallback callback=nullptr)=0 |
virtual telux::common::Status | getDevice (GetStreamDeviceResponseCb callback=nullptr)=0 |
virtual telux::common::Status | setVolume (StreamVolume volume, telux::common::ResponseCallback callback=nullptr)=0 |
virtual telux::common::Status | getVolume (StreamDirection dir, GetStreamVolumeResponseCb callback=nullptr)=0 |
virtual telux::common::Status | setMute (StreamMute mute, telux::common::ResponseCallback callback=nullptr)=0 |
virtual telux::common::Status | getMute (StreamDirection dir, GetStreamMuteResponseCb callback=nullptr)=0 |
virtual | ~IAudioStream () |
|
virtual |
Destructor of the IAudioStream.
|
pure virtual |
Gets the StreamType associated with the stream.
|
pure virtual |
Associates the given audio device with the stream.
Applicable for StreamType::VOICE_CALL, StreamType::PLAY, and StreamType::CAPTURE only.
For StreamType::VOICE_CALL, the stream must be started using IAudioVoiceStream::startAudio() to make the device effective.
[in] | devices | List of the audio devices to use with the stream |
[in] | callback | Optional, invoked to confirm if the device is associated |
|
pure virtual |
Gets the list of the audio devices associated with the stream.
Applicable for StreamType::VOICE_CALL, StreamType::PLAY, and StreamType::CAPTURE only.
[in] | callback | Mandatory, invoked to pass the associated device |
|
pure virtual |
Sets the volume level of the audio device.
For StreamType::VOICE_CALL, direction must be StreamDirection::RX.
Applicable for StreamType::VOICE_CALL, StreamType::PLAY, and StreamType::CAPTURE only.
Direction of the stream is ignored.
[in] | volume | Specifies the volume level and the stream's direction |
[in] | callback | Optional, invoked to confirm if the volume level is set |
|
pure virtual |
Gets the current volume level of the audio device.
For StreamType::VOICE_CALL, direction must be StreamDirection::RX.
Applicable for StreamType::VOICE_CALL, StreamType::PLAY, and StreamType::CAPTURE only.
Direction of the stream is ignored.
[in] | dir | Direction of the stream associated with the device |
[in] | callback | Mandatory, invoked to pass the volume read |
|
pure virtual |
Mute or unmute the stream as specified by the StreamMute provided.
Applicable for StreamType::VOICE_CALL, StreamType::PLAY, and StreamType::CAPTURE only.
For StreamType::VOICE_CALL, the stream must be started using IAudioVoiceStream::startAudio() before setting the mute state.
Direction of the stream is ignored.
[in] | mute | Defines the stream is to be muted or unmuted |
[in] | callback | Optional, invoked to confirm if the stream is muted/unmuted |
|
pure virtual |
Gets the current mute state of the audio stream.
Applicable for StreamType::VOICE_CALL, StreamType::PLAY, and StreamType::CAPTURE only.
For StreamType::VOICE_CALL, the stream must be started using IAudioVoiceStream::startAudio() before reading the mute state.
Direction of the stream is ignored.
[in] | dir | Direction of the stream |
[in] | callback | Mandatory, invoked to pass the mute state |
class telux::audio::IAudioVoiceStream |
Represents the stream created with the StreamType::VOICE_CALL type. Provides methods to establish a voice call on a cellular network, and play and detect DTMF tones.
|
virtual |
Destructor of the IAudioVoiceStream.
|
pure virtual |
Starts a voice call stream.
[in] | callback | Optional, invoked to confirm if the stream has started |
|
pure virtual |
Stops a voice call stream.
[in] | callback | Optional, invoked to confirm if the stream has stopped |
|
pure virtual |
Generates a DTMF tone on a local device (on RX path) associated with the active voice call stream.
[in] | dtmfTone | Specifies the tone's properties |
[in] | duration | Duration (in milliseconds) for which the tone is played. Set it to INFINITE_TONE_DURATION to play indefinitely |
[in] | gain | Volume level of the tone, valid value range is 0 to 4000 |
[in] | callback | Optional, invoked to confirm if the tone play has started |
|
pure virtual |
If IAudioVoiceStream::playDtmfTone() was called with the duration set to INFINITE_DTMF_DURATION, then this method stops playing the DTMF tone.
[in] | direction | Direction of the stream |
[in] | callback | Optional, invoked to confirm if the tone play has stopped |
|
pure virtual |
Registers the given listener to get notified whenever a DTMF tone is detected on a voice call stream. Used in conjunction with IVoiceListener::onDtmfToneDetection().
[in] | listener | Receives the DTMF tone detected event |
[in] | callback | Optional, invoked to confirm if the registration is successful |
|
pure virtual |
Unregisters the given listener registered with IAudioVoiceStream::registerListener().
[in] | listener | Listener to unregister |
class telux::audio::IAudioPlayStream |
Represents the stream created with the StreamType::PLAY type. Provides the methods to play the audio.
|
virtual |
Destructor of the IAudioPlayStream.
|
pure virtual |
Gets an audio buffer containing the audio samples to play.
|
pure virtual |
Sends the audio data for playback. First write starts the playback operation.
For uncompressed playback (for example, AudioFormat::PCM_16BIT_SIGNED), the next buffer can be sent the moment telux::common::ErrorCode::SUCCESS is received by WriteResponseCb.
For compressed playback (for example, AudioFormat::AMR*), the next buffer should be sent only after both; (a) telux::common::ErrorCode::SUCCESS is received by WriteResponseCb (indicating that the current buffer has been pushed in the pipeline for playback) and (b) IPlayListener::onReadyForWrite() has been invoked (indicating that the pipeline can accommodate the next buffer).
[in] | buffer | Contains the audio data to play |
[in] | callback | Optional, invoked to confirm if the data is played successfully |
|
pure virtual |
Finishes the ongoing compressed playback in a way specified by the StopType provided.
[in] | callback | Optional, invoked to confirm if the playback has finished |
[in] | stopType | Defines how to finish playback |
|
pure virtual |
Registers the given listener to receive events; (a) pipeline is ready to accept the next buffer for compressed playback (b) compressed playback has stopped. Events are received by the listener implementing the IPlayListener interface.
[in] | listener | Receives the playstream events |
|
pure virtual |
Unregisters the given listener registered with IAudioPlayStream::registerListener().
[in] | listener | Listener to unregister |
class telux::audio::IAudioCaptureStream |
Represents the stream created with the StreamType::CAPTURE type. Provides the methods to read the captured audio.
|
virtual |
Destructor of the IAudioCaptureStream.
|
pure virtual |
Gets an audio buffer that will contain the audio data read.
|
pure virtual |
Read the audio data from the source device associated with this stream. Data captured will be received by the ReadResponseCb callback.
First read call starts the capture operation.
[in] | buffer | Buffer in which data should be read |
[in] | bytesToRead | Length of the data (in bytes) to read |
[in] | callback | Mandatory, receives the captured data |
class telux::audio::IAudioLoopbackStream |
Represents the stream created with the StreamType::LOOPBACK type. Provides the methods to start and stop the audio loopback operation.
|
virtual |
Destructor of the IAudioLoopbackStream.
|
pure virtual |
Starts looping back the audio between the source and sink devices associated with this stream.
[in] | callback | Optional, invoked to confirm if the loopback has started |
|
pure virtual |
Starts looping back the audio between the source and sink devices associated with this stream.
[in] | callback | Optional, invoked to confirm if the loopback has stopped |
class telux::audio::IAudioToneGeneratorStream |
Represents the stream created with the StreamType::TONE_GENERATOR type. Provides the methods to play an audio tone.
|
virtual |
Destructor of the IAudioToneGeneratorStream.
|
pure virtual |
Plays an audio tone with the given parameters.
[in] | freq | Frequency of the tone. For single tone, freq[0] should be provided. For dual tone, both freq[0] and freq[1] should be provided. |
[in] | duration | Duration (in milliseconds) for which the tone is played. Set it to INFINITE_TONE_DURATION to play indefinitely |
[in] | gain | Defines the volume level of the tone, valid value range is 0 to 4000 |
[in] | callback | Optional, invoked to confirm if the tone play started |
|
pure virtual |
If the IAudioToneGeneratorStream::playTone() was called with the INFINITE_TONE_DURATION duration, then this method stops playing the tone.
[in] | callback | Optional, invoked to confirm if the tone play has stopped |
using telux::audio::ChannelTypeMask = typedef int |
Describes the arrangment of audio samples in a given audio frame through ChannelType.
using telux::audio::GetStreamDeviceResponseCb = typedef std::function<void(std::vector<DeviceType> devices, telux::common::ErrorCode error)> |
Invoked to pass the list of the audio devices associated with the stream. Used in conjunction with IAudioStream::getDevice().
[in] | devices | List of the devices |
[in] | error | telux::common::ErrorCode::SUCCESS if the device list is is sent successfully, otherwise, an appropriate error code |
using telux::audio::GetStreamVolumeResponseCb = typedef std::function<void(StreamVolume volume, telux::common::ErrorCode error)> |
Invoked to pass the current volume level of the audio device. Used in conjunction with IAudioStream::getVolume().
[in] | volume | Details of the volume |
[in] | error | telux::common::ErrorCode::SUCCESS if the volume level is read successfully, otherwise, an appropriate error code |
using telux::audio::GetStreamMuteResponseCb = typedef std::function<void(StreamMute mute, telux::common::ErrorCode error)> |
Invoked to pass the current mute state of the stream. Used in conjunction with IAudioStream::getMute().
[in] | mute | Details about the mute state |
[in] | error | telux::common::ErrorCode::SUCCESS if the mute state is read successfully, otherwise, an appropriate error code |
using telux::audio::WriteResponseCb = typedef std::function<void(std::shared_ptr<IStreamBuffer> buffer, uint32_t bytesWritten, telux::common::ErrorCode error)> |
Used in conjunction with IAudioPlayStream::write(). Invoked to pass the audio data length (in bytes) played from the given buffer.
Application can clear the contents of the buffer by calling IAudioBuffer::reset() before reusing it for the subsequent write operation.
[in] | buffer | Buffer passed in the call to IAudioPlayStream::write() |
[in] | error | telux::common::ErrorCode::SUCCESS if the playback was successful, otherwise, an appropriate error code |
using telux::audio::ReadResponseCb = typedef std::function<void(std::shared_ptr<IStreamBuffer> buffer, telux::common::ErrorCode error)> |
Used in conjunction with IAudioCaptureStream::read(). Invoked to pass the captured audio samples. The IAudioBuffer::getDataSize() gives the length of the data (in bytes).
After the samples have been processed by the application, it can clear the contents of the buffer by calling IAudioBuffer::reset().
[in] | buffer | Buffer passed in the call to IAudioCaptureStream::read() |
[in] | error | telux::common::ErrorCode::SUCCESS if the capture was successful, otherwise, an appropriate error code |
|
strong |
Adds positional perspective to the audio data in a given audio frame. For example, in a 2-speaker audio system, ChannelType::LEFT may represent audio played on speaker-1 while ChannelType::RIGHT represents audio played on speaker-2.
Enumerator | |
---|---|
LEFT |
Specifies the left channel |
RIGHT |
Specifies the right channel |
|
strong |
Specifies how audio data is represented (for example, endianness and number of bits) for storage or exchanging among various audio software and hardware layers.
|
strong |
|
strong |
|
strong |