# Audio stream **Detailed Description** This section contains APIs related to Audio Stream operation. - *group* Telematics\_audio\_stream - Typedefs - using ChannelTypeMask = int - Describes the arrangement of audio samples in a given audio frame through [ChannelType](https://docs.qualcomm.com/doc/80-PF458-10/topic/enum_a00018_1ga997df1a9f856ad14c118c4ebe6662321.html#a00018_1ga997df1a9f856ad14c118c4ebe6662321). - using GetStreamDeviceResponseCb = std::function<void(std::vector<[DeviceType](https://docs.qualcomm.com/doc/80-PF458-10/topic/audio_manager.html#_CPPv410DeviceType)> devices, [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[ErrorCode](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common9ErrorCodeE) error)> - 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-10/topic/common.html#a00269_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<void(StreamVolume volume, [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[ErrorCode](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common9ErrorCodeE) error)> - Invoked to pass the current volume level of the audio device. Used in conjunction with [IAudioStream::getVolume()](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00269_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<void(StreamMute mute, [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[ErrorCode](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common9ErrorCodeE) error)> - Invoked to pass the current mute state of the stream. Used in conjunction with [IAudioStream::getMute()](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00269_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<void(std::shared\_ptr<IStreamBuffer> buffer, uint32\_t bytesWritten, [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[ErrorCode](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common9ErrorCodeE) error)> - Used in conjunction with [IAudioPlayStream::write()](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00271_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-10/topic/common.html#a00265_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-10/topic/common.html#a00271_1a5fcebebd0e679767c8bd9f04eb751a23) - Param error: - **[in]** telux::common::ErrorCode::SUCCESS if the playback was successful, otherwise, an appropriate error code - using ReadResponseCb = std::function<void(std::shared\_ptr<IStreamBuffer> buffer, [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[ErrorCode](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common9ErrorCodeE) error)> - Used in conjunction with [IAudioCaptureStream::read()](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00272_1a8d3a98151ff5ad9efbdc14c54ff6ce6f). Invoked to pass the captured audio samples. The [IAudioBuffer::getDataSize()](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00265_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-10/topic/common.html#a00265_1ac1bd2c56bfa545d246232b5bcee7bb06). - Param buffer: - **[in]** Buffer passed in the call to [IAudioCaptureStream::read()](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00272_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-10/topic/common.html#_CPPv4N5telux5audio11ChannelTypeE) channelType - [ChannelType](https://docs.qualcomm.com/doc/80-PF458-10/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<[ChannelVolume](https://docs.qualcomm.com/doc/80-PF458-10/topic/struct_a00256.html#_CPPv4N5telux5audio13ChannelVolumeE)> volume - List of the volume levels per channel, specified by [ChannelVolume](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00256) - [StreamDirection](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux5audio15StreamDirectionE) dir - [StreamDirection](https://docs.qualcomm.com/doc/80-PF458-10/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-10/topic/common.html#_CPPv4N5telux5audio15StreamDirectionE) dir - [StreamDirection](https://docs.qualcomm.com/doc/80-PF458-10/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-10/topic/common.html#_CPPv4N5telux5audio11DtmfLowFreqE) lowFreq - Lower frequency associated with the DTMF tone - [DtmfHighFreq](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux5audio12DtmfHighFreqE) highFreq - Higher frequency associated with the DTMF tone - [StreamDirection](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux5audio15StreamDirectionE) direction - [StreamDirection](https://docs.qualcomm.com/doc/80-PF458-10/topic/enum_a00001_1ga45750d84667c7d6ca639b6d1affa73ac.html#a00001_1ga45750d84667c7d6ca639b6d1affa73ac) associated with the stream - class IVoiceListener : public [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[ISDKListener](https://docs.qualcomm.com/doc/80-PF458-10/topic/class_a00047.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-10/topic/struct_a00259.html#_CPPv4N5telux5audio8DtmfToneE) dtmfTone) - Called when a DTMF tone is detected on a StreamType::VOICE\_CALL stream. Used in conjunction with [IAudioVoiceStream::registerListener()](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00270_1a99616ac21e7c434d3bc6615a4a129a69). - Parameters: - **dtmfTone** – **[in]** Contains details of the tone detected - inline virtual ~IVoiceListener() - Destructor of the [IVoiceListener](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00261). - class IPlayListener : public [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[ISDKListener](https://docs.qualcomm.com/doc/80-PF458-10/topic/class_a00047.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-10/topic/common.html#a00262). - 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-10/topic/common.html#a00266) 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-10/topic/common.html#a00265) 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](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[Status](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.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-10/topic/common.html#a00265). - class IStreamBuffer : public virtual [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[audio](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux5audioE)::[IAudioBuffer](https://docs.qualcomm.com/doc/80-PF458-10/topic/class_a00265.html#_CPPv4N5telux5audio12IAudioBufferE) - Implements the [IAudioBuffer](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00265) interface to give contextual meaning to its methods based on the [StreamType](https://docs.qualcomm.com/doc/80-PF458-10/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-10/topic/common.html#a00266). - 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-10/topic/common.html#a00272), [telux::audio::IAudioLoopbackStream](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00273), [telux::audio::IAudioPlayStream](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00271), [telux::audio::IAudioToneGeneratorStream](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00274), [telux::audio::IAudioVoiceStream](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00270) Public Functions - virtual [StreamType](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux5audio10StreamTypeE) getType() = 0 - Gets the [StreamType](https://docs.qualcomm.com/doc/80-PF458-10/topic/enum_a00001_1gaffeef52c0dd4dd322ad83a9fdc31933f.html#a00001_1gaffeef52c0dd4dd322ad83a9fdc31933f) associated with the stream. - Returns: - Type of the stream - virtual [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[Status](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common6StatusE) setDevice(std::vector<[DeviceType](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux5audio10DeviceTypeE)> devices, [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[ResponseCallback](https://docs.qualcomm.com/doc/80-PF458-10/topic/typedef_a00238_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-10/topic/common.html#a00270_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](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[Status](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common6StatusE) getDevice([GetStreamDeviceResponseCb](https://docs.qualcomm.com/doc/80-PF458-10/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](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[Status](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common6StatusE) setVolume([StreamVolume](https://docs.qualcomm.com/doc/80-PF458-10/topic/struct_a00257.html#_CPPv4N5telux5audio12StreamVolumeE) volume, [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[ResponseCallback](https://docs.qualcomm.com/doc/80-PF458-10/topic/typedef_a00238_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-10/topic/common.html#a00257). If the stream was created with ChannelType::RIGHT, ChannelType::RIGHT must be specified in [StreamVolume](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00257). If the stream contains both channels, both channels must be given in [StreamVolume](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00257). 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](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[Status](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common6StatusE) getVolume([StreamDirection](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux5audio15StreamDirectionE) dir, [GetStreamVolumeResponseCb](https://docs.qualcomm.com/doc/80-PF458-10/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-10/topic/common.html#a00257). If the stream was created with ChannelType::RIGHT, ChannelType::RIGHT must be specified in [StreamVolume](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00257). If the stream contains both channels, both channels must be given in [StreamVolume](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00257). 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](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[Status](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common6StatusE) setMute([StreamMute](https://docs.qualcomm.com/doc/80-PF458-10/topic/struct_a00258.html#_CPPv4N5telux5audio10StreamMuteE) mute, [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[ResponseCallback](https://docs.qualcomm.com/doc/80-PF458-10/topic/typedef_a00238_1a8f614f0a0eeca90c94dad1967ca93bcd.html#_CPPv4N5telux6common16ResponseCallbackE) callback = nullptr) = 0 - Mute or unmute the stream as specified by the [StreamMute](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00258) 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-10/topic/common.html#a00270_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](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[Status](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common6StatusE) getMute([StreamDirection](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux5audio15StreamDirectionE) dir, [GetStreamMuteResponseCb](https://docs.qualcomm.com/doc/80-PF458-10/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-10/topic/common.html#a00270_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-10/topic/common.html#a00269). - class IAudioVoiceStream : public virtual [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[audio](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux5audioE)::[IAudioStream](https://docs.qualcomm.com/doc/80-PF458-10/topic/class_a00269.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](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[Status](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common6StatusE) startAudio([telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[ResponseCallback](https://docs.qualcomm.com/doc/80-PF458-10/topic/typedef_a00238_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](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[Status](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common6StatusE) stopAudio([telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[ResponseCallback](https://docs.qualcomm.com/doc/80-PF458-10/topic/typedef_a00238_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](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[Status](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common6StatusE) playDtmfTone([DtmfTone](https://docs.qualcomm.com/doc/80-PF458-10/topic/struct_a00259.html#_CPPv4N5telux5audio8DtmfToneE) dtmfTone, uint32\_t duration, uint16\_t gain, [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[ResponseCallback](https://docs.qualcomm.com/doc/80-PF458-10/topic/typedef_a00238_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-10/topic/common.html#a00237_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](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[Status](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common6StatusE) stopDtmfTone([StreamDirection](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux5audio15StreamDirectionE) direction, [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[ResponseCallback](https://docs.qualcomm.com/doc/80-PF458-10/topic/typedef_a00238_1a8f614f0a0eeca90c94dad1967ca93bcd.html#_CPPv4N5telux6common16ResponseCallbackE) callback = nullptr) = 0 - If [IAudioVoiceStream::playDtmfTone()](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00270_1ac446f0ef3aa7e2a09b9cac8d9e74f8f1) was called with the duration set to [INFINITE\_DTMF\_DURATION](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00237_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](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[Status](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common6StatusE) registerListener(std::weak\_ptr<[IVoiceListener](https://docs.qualcomm.com/doc/80-PF458-10/topic/class_a00261.html#_CPPv4N5telux5audio14IVoiceListenerE)> listener, [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[ResponseCallback](https://docs.qualcomm.com/doc/80-PF458-10/topic/typedef_a00238_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-10/topic/common.html#a00261_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](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[Status](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common6StatusE) deRegisterListener(std::weak\_ptr<[IVoiceListener](https://docs.qualcomm.com/doc/80-PF458-10/topic/class_a00261.html#_CPPv4N5telux5audio14IVoiceListenerE)> listener) = 0 - Unregisters the given listener registered with [IAudioVoiceStream::registerListener()](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00270_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-10/topic/common.html#a00270). - class IAudioPlayStream : public virtual [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[audio](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux5audioE)::[IAudioStream](https://docs.qualcomm.com/doc/80-PF458-10/topic/class_a00269.html#_CPPv4N5telux5audio12IAudioStreamE) - Represents the stream created with the StreamType::PLAY type. Provides the methods to play the audio. Public Functions - virtual std::shared\_ptr<[IStreamBuffer](https://docs.qualcomm.com/doc/80-PF458-10/topic/class_a00266.html#_CPPv4N5telux5audio13IStreamBufferE)> getStreamBuffer() = 0 - Gets an audio buffer containing the audio samples to play. - Returns: - [IStreamBuffer](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00266) instance or nullptr if memory allocation fails - virtual [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[Status](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common6StatusE) write(std::shared\_ptr<[IStreamBuffer](https://docs.qualcomm.com/doc/80-PF458-10/topic/class_a00266.html#_CPPv4N5telux5audio13IStreamBufferE)> buffer, [WriteResponseCb](https://docs.qualcomm.com/doc/80-PF458-10/topic/typedef_a00018_1gad978334715a80679a55fc6774117242c.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-10/topic/common.html#a00018_1gad978334715a80679a55fc6774117242c). 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-10/topic/common.html#a00018_1gad978334715a80679a55fc6774117242c) (indicating that the current buffer has been pushed in the pipeline for playback) and (b) [IPlayListener::onReadyForWrite()](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00262_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](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[Status](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common6StatusE) stopAudio([StopType](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux5audio8StopTypeE) stopType, [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[ResponseCallback](https://docs.qualcomm.com/doc/80-PF458-10/topic/typedef_a00238_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-10/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](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[Status](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common6StatusE) registerListener(std::weak\_ptr<[IPlayListener](https://docs.qualcomm.com/doc/80-PF458-10/topic/class_a00262.html#_CPPv4N5telux5audio13IPlayListenerE)> 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-10/topic/common.html#a00262) 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](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[Status](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common6StatusE) deRegisterListener(std::weak\_ptr<[IPlayListener](https://docs.qualcomm.com/doc/80-PF458-10/topic/class_a00262.html#_CPPv4N5telux5audio13IPlayListenerE)> listener) = 0 - Unregisters the given listener registered with [IAudioPlayStream::registerListener()](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00271_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-10/topic/common.html#a00271). - class IAudioCaptureStream : public virtual [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[audio](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux5audioE)::[IAudioStream](https://docs.qualcomm.com/doc/80-PF458-10/topic/class_a00269.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<[IStreamBuffer](https://docs.qualcomm.com/doc/80-PF458-10/topic/class_a00266.html#_CPPv4N5telux5audio13IStreamBufferE)> getStreamBuffer() = 0 - Gets an audio buffer that will contain the audio data read. - Returns: - [IStreamBuffer](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00266) instance or nullptr if memory allocation fails - virtual [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[Status](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common6StatusE) read(std::shared\_ptr<[IStreamBuffer](https://docs.qualcomm.com/doc/80-PF458-10/topic/class_a00266.html#_CPPv4N5telux5audio13IStreamBufferE)> buffer, uint32\_t bytesToRead, [ReadResponseCb](https://docs.qualcomm.com/doc/80-PF458-10/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-10/topic/common.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-10/topic/common.html#a00272). - class IAudioLoopbackStream : public virtual [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[audio](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux5audioE)::[IAudioStream](https://docs.qualcomm.com/doc/80-PF458-10/topic/class_a00269.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](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[Status](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common6StatusE) startLoopback([telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[ResponseCallback](https://docs.qualcomm.com/doc/80-PF458-10/topic/typedef_a00238_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](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[Status](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common6StatusE) stopLoopback([telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[ResponseCallback](https://docs.qualcomm.com/doc/80-PF458-10/topic/typedef_a00238_1a8f614f0a0eeca90c94dad1967ca93bcd.html#_CPPv4N5telux6common16ResponseCallbackE) callback = nullptr) = 0 - Stops 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-10/topic/common.html#a00273). - class IAudioToneGeneratorStream : public virtual [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[audio](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux5audioE)::[IAudioStream](https://docs.qualcomm.com/doc/80-PF458-10/topic/class_a00269.html#_CPPv4N5telux5audio12IAudioStreamE) - Represents the stream created with the StreamType::TONE\_GENERATOR type. Provides the methods to play an audio tone. Public Functions - virtual [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[Status](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common6StatusE) playTone(std::vector<uint16\_t> freq, uint32\_t duration, uint16\_t gain, [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[ResponseCallback](https://docs.qualcomm.com/doc/80-PF458-10/topic/typedef_a00238_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-10/topic/common.html#a00237_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](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[Status](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common6StatusE) stopTone([telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[ResponseCallback](https://docs.qualcomm.com/doc/80-PF458-10/topic/typedef_a00238_1a8f614f0a0eeca90c94dad1967ca93bcd.html#_CPPv4N5telux6common16ResponseCallbackE) callback = nullptr) = 0 - If the [IAudioToneGeneratorStream::playTone()](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00274_1a3afdf890ff34dc8b73244cf0ccacc05b) was called with the [INFINITE\_TONE\_DURATION](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00237_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-10/topic/common.html#a00274). Last Published: Aug 05, 2026 [Previous Topic telux::audio::IAudioDevice](https://docs.qualcomm.com/bundle/publicresource/80-PF458-10/topics/audio_manager.md) [Next Topic Transcoder](https://docs.qualcomm.com/bundle/publicresource/80-PF458-10/topics/transcoder.md)