# Audio stream

**Detailed Description**

This section contains APIs related to Audio Stream operation.

- *group* Telematics\_audio\_stream

    - Typedefs

- using ChannelTypeMask = int

    - Describes the arrangment of audio samples in a given audio frame through [ChannelType](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00018_1ga997df1a9f856ad14c118c4ebe6662321.html#a00018_1ga997df1a9f856ad14c118c4ebe6662321).

- using GetStreamDeviceResponseCb = std::function&lt;void(std::vector&lt;[DeviceType](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_manager.html#_CPPv410DeviceType)&gt; devices, telux::common::[ErrorCode](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00023_1ga84acdb74b7d34616b1ca497c7369810d.html#_CPPv4N5telux6common9ErrorCodeE) error)&gt;

    - Invoked to pass the list of the audio devices associated with the stream. Used in conjunction with [IAudioStream::getDevice()](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00267_1a5c7500aca778c50f3388235d83fb284c).

- Param devices:

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

- Param error:

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

- using GetStreamVolumeResponseCb = std::function&lt;void(StreamVolume volume, telux::common::[ErrorCode](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00023_1ga84acdb74b7d34616b1ca497c7369810d.html#_CPPv4N5telux6common9ErrorCodeE) error)&gt;

    - Invoked to pass the current volume level of the audio device. Used in conjunction with [IAudioStream::getVolume()](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00267_1a41f07fd317710d8e60fc06aa1ea13c36).

- Param volume:

    - **[in]** Details of the volume

- Param error:

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

- using GetStreamMuteResponseCb = std::function&lt;void(StreamMute mute, telux::common::[ErrorCode](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00023_1ga84acdb74b7d34616b1ca497c7369810d.html#_CPPv4N5telux6common9ErrorCodeE) error)&gt;

    - Invoked to pass the current mute state of the stream. Used in conjunction with [IAudioStream::getMute()](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00267_1af317a4d93acccefcb8f0fefded414bcb).

- Param mute:

    - **[in]** Details about the mute state

- Param error:

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

- using WriteResponseCb = std::function&lt;void(std::shared\_ptr&lt;IStreamBuffer&gt; buffer, uint32\_t bytesWritten, telux::common::[ErrorCode](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00023_1ga84acdb74b7d34616b1ca497c7369810d.html#_CPPv4N5telux6common9ErrorCodeE) error)&gt;

    - Used in conjunction with [IAudioPlayStream::write()](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00269_1a5fcebebd0e679767c8bd9f04eb751a23). 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()](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00263_1ac1bd2c56bfa545d246232b5bcee7bb06) before reusing it for the subsequent write operation.

- Param buffer:

    - **[in]** Buffer passed in the call to [IAudioPlayStream::write()](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00269_1a5fcebebd0e679767c8bd9f04eb751a23)

- Param error:

    - **[in]** telux::common::ErrorCode::SUCCESS if the playback was successful, otherwise, an appropriate error code

- using ReadResponseCb = std::function&lt;void(std::shared\_ptr&lt;IStreamBuffer&gt; buffer, telux::common::[ErrorCode](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00023_1ga84acdb74b7d34616b1ca497c7369810d.html#_CPPv4N5telux6common9ErrorCodeE) error)&gt;

    - Used in conjunction with [IAudioCaptureStream::read()](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00270_1a8d3a98151ff5ad9efbdc14c54ff6ce6f). Invoked to pass the captured audio samples. The [IAudioBuffer::getDataSize()](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00263_1a7d1a1fc87fad286621e891d81a903fa4) 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()](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00263_1ac1bd2c56bfa545d246232b5bcee7bb06).

- Param buffer:

    - **[in]** Buffer passed in the call to [IAudioCaptureStream::read()](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00270_1a8d3a98151ff5ad9efbdc14c54ff6ce6f)

- Param error:

    - **[in]** telux::common::ErrorCode::SUCCESS if the capture was successful, otherwise, an appropriate error code

Enums

- enum Direction

    - Used for an in-call playback/capture and HPCM use cases. Represents the direction of the audio data flow.

*Values:*

- enumerator RX

    - Indicates voice downlink path (cellular network to a device)

- enumerator TX

    - Indicates voice uplink path (device to a cellular network)

- enum ChannelType

    - 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.

*Values:*

- enumerator LEFT

    - Specifies the left channel

- enumerator RIGHT

    - Specifies the right channel

- enum AudioFormat

    - Specifies how audio data is represented (for example, endianness and number of bits) for storage or exchanging among various audio software and hardware layers.

*Values:*

- enumerator UNKNOWN

    - Default format (invalid)

- enumerator PCM\_16BIT\_SIGNED

    - PCM signed 16 bits

- enumerator AMRNB

    - Adaptive multirate narrow band format

- enumerator AMRWB

    - Adaptive multirate wide band format

- enumerator AMRWB\_PLUS

    - Extended adaptive multirate wide band format

- enum DtmfLowFreq

    - When generating a DTMF tone, defines the value of the low frequency component.

*Values:*

- enumerator FREQ\_697

    - 697 Hz

- enumerator FREQ\_770

    - 770 Hz

- enumerator FREQ\_852

    - 852 Hz

- enumerator FREQ\_941

    - 941 Hz

- enum DtmfHighFreq

    - When generating a DTMF tone, defines the value of the high frequency component.

*Values:*

- enumerator FREQ\_1209

    - 1209 Hz

- enumerator FREQ\_1336

    - 1336 Hz

- enumerator FREQ\_1477

    - 1477 Hz

- enumerator FREQ\_1633

    - 1633 Hz

- enum StopType

    - Defines the behavior for how a compressed audio format playback should be finished.

*Values:*

- enumerator FORCE\_STOP

    - Stop playing immediately and discard all pending audio samples

- enumerator STOP\_AFTER\_PLAY

    - Stop playing after all samples in the pipeline have been played

- struct ChannelVolume

    - Defines the volume levels for a given audio channel.

Public Members

- [ChannelType](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00018_1ga997df1a9f856ad14c118c4ebe6662321.html#_CPPv4N5telux5audio11ChannelTypeE) channelType

    - [ChannelType](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00018_1ga997df1a9f856ad14c118c4ebe6662321.html#a00018_1ga997df1a9f856ad14c118c4ebe6662321) to which the volume level is associated.

- float vol

    - Volume level — minimum 0.0 and maximum 1.0

- struct StreamVolume

    - Defines the volume levels for the audio device.

Public Members

- std::vector&lt;[ChannelVolume](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#_CPPv4N5telux5audio13ChannelVolumeE)&gt; volume

    - List of the volume levels per channel, specified by [ChannelVolume](https://docs.qualcomm.com/doc/80-PF458-8/topic/struct_a00254.html#a00254)

- [StreamDirection](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00001_1ga45750d84667c7d6ca639b6d1affa73ac.html#_CPPv4N5telux5audio15StreamDirectionE) dir

    - [StreamDirection](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00001_1ga45750d84667c7d6ca639b6d1affa73ac.html#a00001_1ga45750d84667c7d6ca639b6d1affa73ac) associated with the device

- struct StreamMute

    - Specifies the mute state of the audio device.

Public Members

- bool enable

    - True if the device is muted, False if the device is unmuted

- [StreamDirection](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00001_1ga45750d84667c7d6ca639b6d1affa73ac.html#_CPPv4N5telux5audio15StreamDirectionE) dir

    - [StreamDirection](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00001_1ga45750d84667c7d6ca639b6d1affa73ac.html#a00001_1ga45750d84667c7d6ca639b6d1affa73ac) associated with the device

- struct DtmfTone

    - Defines the characteristics of the DTMF tone.

Public Members

- [DtmfLowFreq](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00018_1ga3d1575abb45d48d2d3a17a6896785a60.html#_CPPv4N5telux5audio11DtmfLowFreqE) lowFreq

    - Lower frequency associated with the DTMF tone

- [DtmfHighFreq](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00018_1ga03860ae833a75d04636fbbfebc82ab3f.html#_CPPv4N5telux5audio12DtmfHighFreqE) highFreq

    - Higher frequency associated with the DTMF tone

- [StreamDirection](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00001_1ga45750d84667c7d6ca639b6d1affa73ac.html#_CPPv4N5telux5audio15StreamDirectionE) direction

    - [StreamDirection](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00001_1ga45750d84667c7d6ca639b6d1affa73ac.html#a00001_1ga45750d84667c7d6ca639b6d1affa73ac) associated with the stream

- class IVoiceListener : public telux::common::[ISDKListener](https://docs.qualcomm.com/doc/80-PF458-8/topic/class_a00046.html#_CPPv4N5telux6common12ISDKListenerE)

    - Listener for a DTMF tone detected event on a StreamType::VOICE\_CALL stream.

Public Functions

- inline virtual void onDtmfToneDetection([DtmfTone](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#_CPPv4N5telux5audio8DtmfToneE) dtmfTone)

    - Called when a DTMF tone is detected on a StreamType::VOICE\_CALL stream. Used in conjuction with [IAudioVoiceStream::registerListener()](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00268_1a99616ac21e7c434d3bc6615a4a129a69).

- Parameters:

    - **dtmfTone** – **[in]** Contains details of the tone detected

- inline virtual ~IVoiceListener()

    - Destructor of the [IVoiceListener](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00259).

- class IPlayListener : public virtual telux::common::[ISDKListener](https://docs.qualcomm.com/doc/80-PF458-8/topic/class_a00046.html#_CPPv4N5telux6common12ISDKListenerE)

    - Listener for events on a playback stream.

Public Functions

- inline virtual void onReadyForWrite()

    - Called when the audio pipeline is ready to accept the next buffer to play during compressed playback.

- inline virtual void onPlayStopped()

    - Called when the compressed playback has stopped. The stream should be deleted only after this has been called.

- inline virtual ~IPlayListener()

    - Destructor of [IPlayListener](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00260).

- class 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.

Subclassed by [telux::audio::IStreamBuffer](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00264)

Public Functions

- virtual size\_t getMinSize() = 0

    - 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.

- Returns:

    - Optimal size (in bytes)

- virtual size\_t getMaxSize() = 0

    - 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.

- Returns:

    - Maximum size (in bytes)

- virtual uint8\_t \*getRawBuffer() = 0

    - Gives the managed raw buffer. It is freed when [IAudioBuffer](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00263) 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.

- Returns:

    - Managed raw buffer

- virtual uint32\_t getDataSize() = 0

    - For the StreamType::CAPTURE stream, specifies how many bytes were read. Not used for the StreamType::PLAY stream.

- Returns:

    - Size of the valid data bytes in the raw buffer

- virtual void setDataSize(uint32\_t size) = 0

    - For the StreamType::PLAY stream, specifies how many bytes should be played. Not used for the StreamType::CAPTURE stream.

- Returns:

    - Size of the valid data bytes in the raw buffer

- virtual telux::common::[Status](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00023_1ga45eeeff7c2860e02ae447d588d3d6e4d.html#_CPPv4N5telux6common6StatusE) reset() = 0

    - Clears the contents of the managed raw buffer.

- Returns:

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

- inline virtual ~IAudioBuffer()

    - Destructor of the [IAudioBuffer](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00263).

- class IStreamBuffer : public virtual telux::audio::[IAudioBuffer](https://docs.qualcomm.com/doc/80-PF458-8/topic/class_a00263.html#_CPPv4N5telux5audio12IAudioBufferE)

    - Implements the [IAudioBuffer](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00263) interface to give contexual meaning to its methods based on the [StreamType](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00001_1gaffeef52c0dd4dd322ad83a9fdc31933f.html#a00001_1gaffeef52c0dd4dd322ad83a9fdc31933f) type associated with the stream, with which this buffer will be used.

Public Functions

- inline virtual ~IStreamBuffer()

    - Destructor of the [IStreamBuffer](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00264).

- class IAudioStream

    - Base class for all audio stream types. Contains the common properties and methods.

Subclassed by [telux::audio::IAudioCaptureStream](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00270), [telux::audio::IAudioLoopbackStream](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00271), [telux::audio::IAudioPlayStream](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00269), [telux::audio::IAudioToneGeneratorStream](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00272), [telux::audio::IAudioVoiceStream](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00268)

Public Functions

- virtual [StreamType](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00001_1gaffeef52c0dd4dd322ad83a9fdc31933f.html#_CPPv4N5telux5audio10StreamTypeE) getType() = 0

    - Gets the [StreamType](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00001_1gaffeef52c0dd4dd322ad83a9fdc31933f.html#a00001_1gaffeef52c0dd4dd322ad83a9fdc31933f) associated with the stream.

- Returns:

    - Type of the stream

- virtual telux::common::[Status](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00023_1ga45eeeff7c2860e02ae447d588d3d6e4d.html#_CPPv4N5telux6common6StatusE) setDevice(std::vector&lt;[DeviceType](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00001_1ga8f8ad92263d7024623b1c50df54582dc.html#_CPPv4N5telux5audio10DeviceTypeE)&gt; devices, telux::common::[ResponseCallback](https://docs.qualcomm.com/doc/80-PF458-8/topic/typedef_a00235_1a8f614f0a0eeca90c94dad1967ca93bcd.html#_CPPv4N5telux6common16ResponseCallbackE) callback = nullptr) = 0

    - 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()](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00268_1af47791c16e25202a37ecf504e3f5e2ca) to make the device effective.

- Parameters:

    - - **devices** – **[in]** List of the audio devices to use with the stream
- **callback** – **[in]** Optional, invoked to confirm if the device is associated

- Returns:

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

- virtual telux::common::[Status](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00023_1ga45eeeff7c2860e02ae447d588d3d6e4d.html#_CPPv4N5telux6common6StatusE) getDevice([GetStreamDeviceResponseCb](https://docs.qualcomm.com/doc/80-PF458-8/topic/typedef_a00018_1ga6350abd1812c3c249e9928e3bc08451c.html#_CPPv4N5telux5audio25GetStreamDeviceResponseCbE) callback = nullptr) = 0

    - Gets the list of the audio devices associated with the stream.

Applicable for StreamType::VOICE\_CALL, StreamType::PLAY, and StreamType::CAPTURE only.

- Parameters:

    - **callback** – **[in]** Mandatory, invoked to pass the associated device

- Returns:

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

- virtual telux::common::[Status](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00023_1ga45eeeff7c2860e02ae447d588d3d6e4d.html#_CPPv4N5telux6common6StatusE) setVolume([StreamVolume](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#_CPPv4N5telux5audio12StreamVolumeE) volume, telux::common::[ResponseCallback](https://docs.qualcomm.com/doc/80-PF458-8/topic/typedef_a00235_1a8f614f0a0eeca90c94dad1967ca93bcd.html#_CPPv4N5telux6common16ResponseCallbackE) callback = nullptr) = 0

    - Sets the volume level of the audio device.

For StreamType::VOICE\_CALL and StreamType::PLAY, direction must be StreamDirection::RX. For StreamType::CAPTURE, direction must be StreamDirection::TX.

If the stream was created with ChannelType::LEFT, ChannelType::LEFT must be specified in [StreamVolume](https://docs.qualcomm.com/doc/80-PF458-8/topic/struct_a00255.html#a00255). If the stream was created with ChannelType::RIGHT, ChannelType::RIGHT must be specified in [StreamVolume](https://docs.qualcomm.com/doc/80-PF458-8/topic/struct_a00255.html#a00255). If the stream contains both channels, both channels must be given in [StreamVolume](https://docs.qualcomm.com/doc/80-PF458-8/topic/struct_a00255.html#a00255).

Applicable for StreamType::VOICE\_CALL, StreamType::PLAY, and StreamType::CAPTURE only.

- Parameters:

    - - **volume** – **[in]** Specifies the volume level and the stream’s direction
- **callback** – **[in]** Optional, invoked to confirm if the volume level is set

- Returns:

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

- virtual telux::common::[Status](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00023_1ga45eeeff7c2860e02ae447d588d3d6e4d.html#_CPPv4N5telux6common6StatusE) getVolume([StreamDirection](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00001_1ga45750d84667c7d6ca639b6d1affa73ac.html#_CPPv4N5telux5audio15StreamDirectionE) dir, [GetStreamVolumeResponseCb](https://docs.qualcomm.com/doc/80-PF458-8/topic/typedef_a00018_1ga9a983b715026f99fba42aad4143e48bb.html#_CPPv4N5telux5audio25GetStreamVolumeResponseCbE) callback = nullptr) = 0

    - Gets the current volume level of the audio device.

For StreamType::VOICE\_CALL and StreamType::PLAY, direction must be StreamDirection::RX. For StreamType::CAPTURE, direction must be StreamDirection::TX.

If the stream was created with ChannelType::LEFT, ChannelType::LEFT must be specified in [StreamVolume](https://docs.qualcomm.com/doc/80-PF458-8/topic/struct_a00255.html#a00255). If the stream was created with ChannelType::RIGHT, ChannelType::RIGHT must be specified in [StreamVolume](https://docs.qualcomm.com/doc/80-PF458-8/topic/struct_a00255.html#a00255). If the stream contains both channels, both channels must be given in [StreamVolume](https://docs.qualcomm.com/doc/80-PF458-8/topic/struct_a00255.html#a00255).

Applicable for StreamType::VOICE\_CALL, StreamType::PLAY, and StreamType::CAPTURE only.

- Parameters:

    - - **dir** – **[in]** Direction of the stream associated with the device
- **callback** – **[in]** Mandatory, invoked to pass the volume read

- Returns:

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

- virtual telux::common::[Status](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00023_1ga45eeeff7c2860e02ae447d588d3d6e4d.html#_CPPv4N5telux6common6StatusE) setMute([StreamMute](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#_CPPv4N5telux5audio10StreamMuteE) mute, telux::common::[ResponseCallback](https://docs.qualcomm.com/doc/80-PF458-8/topic/typedef_a00235_1a8f614f0a0eeca90c94dad1967ca93bcd.html#_CPPv4N5telux6common16ResponseCallbackE) callback = nullptr) = 0

    - Mute or unmute the stream as specified by the [StreamMute](https://docs.qualcomm.com/doc/80-PF458-8/topic/struct_a00256.html#a00256) provided.

Applicable for StreamType::VOICE\_CALL, StreamType::PLAY, and StreamType::CAPTURE only.

For StreamType::VOICE\_CALL, the stream must be started using [IAudioVoiceStream::startAudio()](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00268_1af47791c16e25202a37ecf504e3f5e2ca) before setting the mute state.

- Parameters:

    - - **mute** – **[in]** Defines the stream is to be muted or unmuted
- **callback** – **[in]** Optional, invoked to confirm if the stream is muted/unmuted

- Returns:

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

- virtual telux::common::[Status](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00023_1ga45eeeff7c2860e02ae447d588d3d6e4d.html#_CPPv4N5telux6common6StatusE) getMute([StreamDirection](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00001_1ga45750d84667c7d6ca639b6d1affa73ac.html#_CPPv4N5telux5audio15StreamDirectionE) dir, [GetStreamMuteResponseCb](https://docs.qualcomm.com/doc/80-PF458-8/topic/typedef_a00018_1ga9c4fe155e707ba3de1021152a0a42b8e.html#_CPPv4N5telux5audio23GetStreamMuteResponseCbE) callback = nullptr) = 0

    - 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()](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00268_1af47791c16e25202a37ecf504e3f5e2ca) before reading the mute state.

- Parameters:

    - - **dir** – **[in]** Direction of the stream
- **callback** – **[in]** Mandatory, invoked to pass the mute state

- Returns:

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

- inline virtual ~IAudioStream()

    - Destructor of the [IAudioStream](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00267).

- class IAudioVoiceStream : public virtual telux::audio::[IAudioStream](https://docs.qualcomm.com/doc/80-PF458-8/topic/class_a00267.html#_CPPv4N5telux5audio12IAudioStreamE)

    - 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.

Public Functions

- virtual telux::common::[Status](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00023_1ga45eeeff7c2860e02ae447d588d3d6e4d.html#_CPPv4N5telux6common6StatusE) startAudio(telux::common::[ResponseCallback](https://docs.qualcomm.com/doc/80-PF458-8/topic/typedef_a00235_1a8f614f0a0eeca90c94dad1967ca93bcd.html#_CPPv4N5telux6common16ResponseCallbackE) callback = nullptr) = 0

    - Starts a voice call stream.

- Parameters:

    - **callback** – **[in]** Optional, invoked to confirm if the stream has started

- Returns:

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

- virtual telux::common::[Status](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00023_1ga45eeeff7c2860e02ae447d588d3d6e4d.html#_CPPv4N5telux6common6StatusE) stopAudio(telux::common::[ResponseCallback](https://docs.qualcomm.com/doc/80-PF458-8/topic/typedef_a00235_1a8f614f0a0eeca90c94dad1967ca93bcd.html#_CPPv4N5telux6common16ResponseCallbackE) callback = nullptr) = 0

    - Stops a voice call stream.

- Parameters:

    - **callback** – **[in]** Optional, invoked to confirm if the stream has stopped

- Returns:

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

- virtual telux::common::[Status](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00023_1ga45eeeff7c2860e02ae447d588d3d6e4d.html#_CPPv4N5telux6common6StatusE) playDtmfTone([DtmfTone](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#_CPPv4N5telux5audio8DtmfToneE) dtmfTone, uint16\_t duration, uint16\_t gain, telux::common::[ResponseCallback](https://docs.qualcomm.com/doc/80-PF458-8/topic/typedef_a00235_1a8f614f0a0eeca90c94dad1967ca93bcd.html#_CPPv4N5telux6common16ResponseCallbackE) callback = nullptr) = 0

    - Generates a DTMF tone on a local device (on RX path) associated with the active voice call stream.

- Parameters:

    - - **dtmfTone** – **[in]** Specifies the tone’s properties
- **duration** – **[in]** Duration (in milliseconds) for which the tone is played. Set it to [INFINITE\_TONE\_DURATION](https://docs.qualcomm.com/doc/80-PF458-8/topic/variable_a00234_1a11ec280ec31aa8e4b899d169a1371194.html#a00234_1a11ec280ec31aa8e4b899d169a1371194) to play indefinitely
- **gain** – **[in]** Volume level of the tone, valid value range is 0 to 4000
- **callback** – **[in]** Optional, invoked to confirm if the tone play has started

- Returns:

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

- virtual telux::common::[Status](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00023_1ga45eeeff7c2860e02ae447d588d3d6e4d.html#_CPPv4N5telux6common6StatusE) stopDtmfTone([StreamDirection](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00001_1ga45750d84667c7d6ca639b6d1affa73ac.html#_CPPv4N5telux5audio15StreamDirectionE) direction, telux::common::[ResponseCallback](https://docs.qualcomm.com/doc/80-PF458-8/topic/typedef_a00235_1a8f614f0a0eeca90c94dad1967ca93bcd.html#_CPPv4N5telux6common16ResponseCallbackE) callback = nullptr) = 0

    - If [IAudioVoiceStream::playDtmfTone()](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00268_1a42cd426a0573c00e8e9d4b6a059b6b24) was called with the duration set to [INFINITE\_DTMF\_DURATION](https://docs.qualcomm.com/doc/80-PF458-8/topic/variable_a00234_1adb58223e54107c11b80c2d8fb65f2629.html#a00234_1adb58223e54107c11b80c2d8fb65f2629), then this method stops playing the DTMF tone.

- Parameters:

    - - **direction** – **[in]** Direction of the stream
- **callback** – **[in]** Optional, invoked to confirm if the tone play has stopped

- Returns:

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

- virtual telux::common::[Status](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00023_1ga45eeeff7c2860e02ae447d588d3d6e4d.html#_CPPv4N5telux6common6StatusE) registerListener(std::weak\_ptr&lt;[IVoiceListener](https://docs.qualcomm.com/doc/80-PF458-8/topic/class_a00259.html#_CPPv4N5telux5audio14IVoiceListenerE)&gt; listener, telux::common::[ResponseCallback](https://docs.qualcomm.com/doc/80-PF458-8/topic/typedef_a00235_1a8f614f0a0eeca90c94dad1967ca93bcd.html#_CPPv4N5telux6common16ResponseCallbackE) callback = nullptr) = 0

    - Registers the given listener to get notified whenever a DTMF tone is detected on a voice call stream. Used in conjunction with [IVoiceListener::onDtmfToneDetection()](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00259_1a992a8a1743edfb32be0205bf4b748c27).

- Parameters:

    - - **listener** – **[in]** Receives the DTMF tone detected event
- **callback** – **[in]** Optional, invoked to confirm if the registration is successful

- Returns:

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

- virtual telux::common::[Status](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00023_1ga45eeeff7c2860e02ae447d588d3d6e4d.html#_CPPv4N5telux6common6StatusE) deRegisterListener(std::weak\_ptr&lt;[IVoiceListener](https://docs.qualcomm.com/doc/80-PF458-8/topic/class_a00259.html#_CPPv4N5telux5audio14IVoiceListenerE)&gt; listener) = 0

    - Unregisters the given listener registered with [IAudioVoiceStream::registerListener()](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00268_1a99616ac21e7c434d3bc6615a4a129a69).

- Parameters:

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

- Returns:

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

- inline virtual ~IAudioVoiceStream()

    - Destructor of the [IAudioVoiceStream](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00268).

- class IAudioPlayStream : public virtual telux::audio::[IAudioStream](https://docs.qualcomm.com/doc/80-PF458-8/topic/class_a00267.html#_CPPv4N5telux5audio12IAudioStreamE)

    - Represents the stream created with the StreamType::PLAY type. Provides the methods to play the audio.

Public Functions

- virtual std::shared\_ptr&lt;[IStreamBuffer](https://docs.qualcomm.com/doc/80-PF458-8/topic/class_a00264.html#_CPPv4N5telux5audio13IStreamBufferE)&gt; getStreamBuffer() = 0

    - Gets an audio buffer containing the audio samples to play.

- Returns:

    - [IStreamBuffer](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00264) instance or nullptr if memory allocation fails

- virtual telux::common::[Status](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00023_1ga45eeeff7c2860e02ae447d588d3d6e4d.html#_CPPv4N5telux6common6StatusE) write(std::shared\_ptr&lt;[IStreamBuffer](https://docs.qualcomm.com/doc/80-PF458-8/topic/class_a00264.html#_CPPv4N5telux5audio13IStreamBufferE)&gt; buffer, [WriteResponseCb](https://docs.qualcomm.com/doc/80-PF458-8/topic/typedef_a00018_1gab7dee5b45ff0db984db0b306ed6b5666.html#_CPPv4N5telux5audio15WriteResponseCbE) callback = nullptr) = 0

    - 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](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00018_1gab7dee5b45ff0db984db0b306ed6b5666).

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](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00018_1gab7dee5b45ff0db984db0b306ed6b5666) (indicating that the current buffer has been pushed in the pipeline for playback) and (b) [IPlayListener::onReadyForWrite()](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00260_1a268726234cb11caeead1969b69491955) has been invoked (indicating that the pipeline can accommodate the next buffer).

- Parameters:

    - - **buffer** – **[in]** Contains the audio data to play
- **callback** – **[in]** Optional, invoked to confirm if the data is played successfully

- Returns:

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

- virtual telux::common::[Status](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00023_1ga45eeeff7c2860e02ae447d588d3d6e4d.html#_CPPv4N5telux6common6StatusE) stopAudio([StopType](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00018_1gac674abb9ce476c798179c4f43be0bf0c.html#_CPPv4N5telux5audio8StopTypeE) stopType, telux::common::[ResponseCallback](https://docs.qualcomm.com/doc/80-PF458-8/topic/typedef_a00235_1a8f614f0a0eeca90c94dad1967ca93bcd.html#_CPPv4N5telux6common16ResponseCallbackE) callback = nullptr) = 0

    - Finishes the ongoing compressed playback in a way specified by the [StopType](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00018_1gac674abb9ce476c798179c4f43be0bf0c.html#a00018_1gac674abb9ce476c798179c4f43be0bf0c) provided.

- Parameters:

    - - **callback** – **[in]** Optional, invoked to confirm if the playback has finished
- **stopType** – **[in]** Defines how to finish playback

- Returns:

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

- virtual telux::common::[Status](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00023_1ga45eeeff7c2860e02ae447d588d3d6e4d.html#_CPPv4N5telux6common6StatusE) registerListener(std::weak\_ptr&lt;[IPlayListener](https://docs.qualcomm.com/doc/80-PF458-8/topic/class_a00260.html#_CPPv4N5telux5audio13IPlayListenerE)&gt; listener) = 0

    - 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](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00260) interface.

- Parameters:

    - **listener** – **[in]** Receives the playstream events

- Returns:

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

- virtual telux::common::[Status](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00023_1ga45eeeff7c2860e02ae447d588d3d6e4d.html#_CPPv4N5telux6common6StatusE) deRegisterListener(std::weak\_ptr&lt;[IPlayListener](https://docs.qualcomm.com/doc/80-PF458-8/topic/class_a00260.html#_CPPv4N5telux5audio13IPlayListenerE)&gt; listener) = 0

    - Unregisters the given listener registered with [IAudioPlayStream::registerListener()](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00269_1ae2ca4209bf18bd77aa7455cf4ddca9a5).

- Parameters:

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

- Returns:

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

- inline virtual ~IAudioPlayStream()

    - Destructor of the [IAudioPlayStream](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00269).

- class IAudioCaptureStream : public virtual telux::audio::[IAudioStream](https://docs.qualcomm.com/doc/80-PF458-8/topic/class_a00267.html#_CPPv4N5telux5audio12IAudioStreamE)

    - Represents the stream created with the StreamType::CAPTURE type. Provides the methods to read the captured audio.

Public Functions

- virtual std::shared\_ptr&lt;[IStreamBuffer](https://docs.qualcomm.com/doc/80-PF458-8/topic/class_a00264.html#_CPPv4N5telux5audio13IStreamBufferE)&gt; getStreamBuffer() = 0

    - Gets an audio buffer that will contain the audio data read.

- Returns:

    - [IStreamBuffer](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00264) instance or nullptr if memory allocation fails

- virtual telux::common::[Status](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00023_1ga45eeeff7c2860e02ae447d588d3d6e4d.html#_CPPv4N5telux6common6StatusE) read(std::shared\_ptr&lt;[IStreamBuffer](https://docs.qualcomm.com/doc/80-PF458-8/topic/class_a00264.html#_CPPv4N5telux5audio13IStreamBufferE)&gt; buffer, uint32\_t bytesToRead, [ReadResponseCb](https://docs.qualcomm.com/doc/80-PF458-8/topic/typedef_a00018_1ga4b35baea45e08f649d1ddc2a40fa1bc1.html#_CPPv4N5telux5audio14ReadResponseCbE) callback = nullptr) = 0

    - Read the audio data from the source device associated with this stream. Data captured will be received by the [ReadResponseCb](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00018_1ga4b35baea45e08f649d1ddc2a40fa1bc1) callback.

First read call starts the capture operation.

- Parameters:

    - - **buffer** – **[in]** Buffer in which data should be read
- **bytesToRead** – **[in]** Length of the data (in bytes) to read
- **callback** – **[in]** Mandatory, receives the captured data

- Returns:

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

- inline virtual ~IAudioCaptureStream()

    - Destructor of the [IAudioCaptureStream](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00270).

- class IAudioLoopbackStream : public virtual telux::audio::[IAudioStream](https://docs.qualcomm.com/doc/80-PF458-8/topic/class_a00267.html#_CPPv4N5telux5audio12IAudioStreamE)

    - Represents the stream created with the StreamType::LOOPBACK type. Provides the methods to start and stop the audio loopback operation.

Public Functions

- virtual telux::common::[Status](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00023_1ga45eeeff7c2860e02ae447d588d3d6e4d.html#_CPPv4N5telux6common6StatusE) startLoopback(telux::common::[ResponseCallback](https://docs.qualcomm.com/doc/80-PF458-8/topic/typedef_a00235_1a8f614f0a0eeca90c94dad1967ca93bcd.html#_CPPv4N5telux6common16ResponseCallbackE) callback = nullptr) = 0

    - Starts looping back the audio between the source and sink devices associated with this stream.

- Parameters:

    - **callback** – **[in]** Optional, invoked to confirm if the loopback has started

- Returns:

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

- virtual telux::common::[Status](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00023_1ga45eeeff7c2860e02ae447d588d3d6e4d.html#_CPPv4N5telux6common6StatusE) stopLoopback(telux::common::[ResponseCallback](https://docs.qualcomm.com/doc/80-PF458-8/topic/typedef_a00235_1a8f614f0a0eeca90c94dad1967ca93bcd.html#_CPPv4N5telux6common16ResponseCallbackE) callback = nullptr) = 0

    - Starts looping back the audio between the source and sink devices associated with this stream.

- Parameters:

    - **callback** – **[in]** Optional, invoked to confirm if the loopback has stopped

- Returns:

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

- inline virtual ~IAudioLoopbackStream()

    - Destructor of the [IAudioLoopbackStream](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00271).

- class IAudioToneGeneratorStream : public virtual telux::audio::[IAudioStream](https://docs.qualcomm.com/doc/80-PF458-8/topic/class_a00267.html#_CPPv4N5telux5audio12IAudioStreamE)

    - Represents the stream created with the StreamType::TONE\_GENERATOR type. Provides the methods to play an audio tone.

Public Functions

- virtual telux::common::[Status](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00023_1ga45eeeff7c2860e02ae447d588d3d6e4d.html#_CPPv4N5telux6common6StatusE) playTone(std::vector&lt;uint16\_t&gt; freq, uint16\_t duration, uint16\_t gain, telux::common::[ResponseCallback](https://docs.qualcomm.com/doc/80-PF458-8/topic/typedef_a00235_1a8f614f0a0eeca90c94dad1967ca93bcd.html#_CPPv4N5telux6common16ResponseCallbackE) callback = nullptr) = 0

    - Plays an audio tone with the given parameters.

- Parameters:

    - - **freq** – **[in]** Frequency of the tone. For single tone, freq[0] should be provided. For dual tone, both freq[0] and freq[1] should be provided.
- **duration** – **[in]** Duration (in milliseconds) for which the tone is played. Set it to [INFINITE\_TONE\_DURATION](https://docs.qualcomm.com/doc/80-PF458-8/topic/variable_a00234_1a11ec280ec31aa8e4b899d169a1371194.html#a00234_1a11ec280ec31aa8e4b899d169a1371194) to play indefinitely
- **gain** – **[in]** Defines the volume level of the tone, valid value range is 0 to 4000
- **callback** – **[in]** Optional, invoked to confirm if the tone play started

- Returns:

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

- virtual telux::common::[Status](https://docs.qualcomm.com/doc/80-PF458-8/topic/enum_a00023_1ga45eeeff7c2860e02ae447d588d3d6e4d.html#_CPPv4N5telux6common6StatusE) stopTone(telux::common::[ResponseCallback](https://docs.qualcomm.com/doc/80-PF458-8/topic/typedef_a00235_1a8f614f0a0eeca90c94dad1967ca93bcd.html#_CPPv4N5telux6common16ResponseCallbackE) callback = nullptr) = 0

    - If the [IAudioToneGeneratorStream::playTone()](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00272_1a30883aa07f08b37d7dcac00baa174846) was called with the [INFINITE\_TONE\_DURATION](https://docs.qualcomm.com/doc/80-PF458-8/topic/variable_a00234_1a11ec280ec31aa8e4b899d169a1371194.html#a00234_1a11ec280ec31aa8e4b899d169a1371194) duration, then this method stops playing the tone.

- Parameters:

    - **callback** – **[in]** Optional, invoked to confirm if the tone play has stopped

- Returns:

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

- inline virtual ~IAudioToneGeneratorStream()

    - Destructor of the [IAudioToneGeneratorStream](https://docs.qualcomm.com/doc/80-PF458-8/topic/audio_stream.html#a00272).

Last Published: May 20, 2026

[Previous Topic
telux::audio::IAudioDevice](https://docs.qualcomm.com/bundle/publicresource/80-PF458-8/topics/audio_manager.md) [Next Topic
Transcoder](https://docs.qualcomm.com/bundle/publicresource/80-PF458-8/topics/transcoder.md)