AudioVolume

Overview

Related Modules:

Audio

Description:

Provides volume-related APIs for audio rendering or capturing, including functions to set the mute operation, volume, and gain.

Since:

1.0

Version:

1.0

Summary

Data Fields

Variable Name

Description

SetMute )(AudioHandle handle, bool mute)

int32_t( 

Sets the mute operation for the audio.

GetMute )(AudioHandle handle, bool mute)

int32_t( 

Obtains the mute operation set for the audio.

SetVolume )(AudioHandle handle, float volume)

int32_t( 

Sets the audio volume.

GetVolume )(AudioHandle handle, float volume)

int32_t( 

Obtains the audio volume.

GetGainThreshold )(AudioHandle handle, float min, float max)

int32_t( 

Obtains the range of the audio gain.

GetGain )(AudioHandle handle, float gain)

int32_t( 

Obtains the audio gain.

SetGain )(AudioHandle handle, float gain)

int32_t( 

Sets the audio gain.

Details

Field Documentation

GetGain

  1. int32_t(*AudioVolume::GetGain)([AudioHandle]($api-api-SmartVision-Devices-Audio.md#ga18675ddb073465fdeac33a897f675d79) handle, float *gain)

Description:

Obtains the audio gain.

Parameters:

Name

Description

handleIndicates the audio handle.
gainIndicates the pointer to the audio gain.

Returns:

Returns 0 if the audio gain is obtained; returns a negative value otherwise.

See also:

GetGainThreshold

GetGainThreshold

  1. int32_t(*AudioVolume::GetGainThreshold)([AudioHandle]($api-api-SmartVision-Devices-Audio.md#ga18675ddb073465fdeac33a897f675d79) handle, float *min, float *max)

Description:

Obtains the range of the audio gain.

The audio gain can be expressed in one of the following two ways (depending on the chip platform), corresponding to two types of value ranges:

Parameters:

Name

Description

handleIndicates the audio handle.
minIndicates the pointer to the minimum value of the range.
maxIndicates the pointer to the maximum value of the range.

Returns:

Returns 0 if the range is obtained; returns a negative value otherwise.

See also:

GetGain

GetMute

  1. int32_t(*AudioVolume::GetMute)([AudioHandle]($api-api-SmartVision-Devices-Audio.md#ga18675ddb073465fdeac33a897f675d79) handle, bool *mute)

Description:

Obtains the mute operation set for the audio.

Parameters:

Name

Description

handleIndicates the audio handle.
muteIndicates the pointer to the mute operation set for the audio. Value true means that the audio is muted, and false means the opposite.

Returns:

Returns 0 if the mute operation is obtained; returns a negative value otherwise.

See also:

SetMute

GetVolume

  1. int32_t(*AudioVolume::GetVolume)([AudioHandle]($api-api-SmartVision-Devices-Audio.md#ga18675ddb073465fdeac33a897f675d79) handle, float *volume)

Description:

Obtains the audio volume.

Parameters:

Name

Description

handleIndicates the audio handle.
volumeIndicates the pointer to the volume to obtain. The value ranges from 0.0 to 1.0.

Returns:

Returns 0 if the volume is obtained; returns a negative value otherwise.

See also:

SetVolume

SetGain

  1. int32_t(*AudioVolume::SetGain)([AudioHandle]($api-api-SmartVision-Devices-Audio.md#ga18675ddb073465fdeac33a897f675d79) handle, float gain)

Description:

Sets the audio gain.

Parameters:

Name

Description

handleIndicates the audio handle.
gainIndicates the audio gain to set.

Returns:

Returns 0 if the setting is successful; returns a negative value otherwise.

See also:

GetGainThreshold

SetMute

  1. int32_t(*AudioVolume::SetMute)([AudioHandle]($api-api-SmartVision-Devices-Audio.md#ga18675ddb073465fdeac33a897f675d79) handle, bool mute)

Description:

Sets the mute operation for the audio.

Parameters:

Name

Description

handleIndicates the audio handle.
muteSpecifies whether to mute the audio. Value true means to mute the audio, and false means the opposite.

Returns:

Returns 0 if the setting is successful; returns a negative value otherwise.

See also:

GetMute

SetVolume

  1. int32_t(*AudioVolume::SetVolume)([AudioHandle]($api-api-SmartVision-Devices-Audio.md#ga18675ddb073465fdeac33a897f675d79) handle, float volume)

Description:

Sets the audio volume.

The volume ranges from 0.0 to 1.0. If the volume level in an audio service ranges from 0 to 15, 0.0 indicates that the audio is muted, and 1.0 indicates the maximum volume level (15).

Parameters:

Name

Description

handleIndicates the audio handle.
volumeIndicates the volume to set. The value ranges from 0.0 to 1.0.

Returns:

Returns 0 if the setting is successful; returns a negative value otherwise.

See also:

GetVolume