Compartilhar via


AudioTrack.SetStereoVolume(Single, Single) Method

Definition

Caution

deprecated

Sets the specified left and right output gain values on the AudioTrack.

[Android.Runtime.Register("setStereoVolume", "(FF)I", "GetSetStereoVolume_FFHandler")]
[System.Obsolete("deprecated")]
public virtual Android.Media.TrackStatus SetStereoVolume (float leftGain, float rightGain);
[<Android.Runtime.Register("setStereoVolume", "(FF)I", "GetSetStereoVolume_FFHandler")>]
[<System.Obsolete("deprecated")>]
abstract member SetStereoVolume : single * single -> Android.Media.TrackStatus
override this.SetStereoVolume : single * single -> Android.Media.TrackStatus

Parameters

leftGain
Single

output gain for the left channel.

rightGain
Single

output gain for the right channel

Returns

error code or success, see #SUCCESS, #ERROR_INVALID_OPERATION

Attributes

Remarks

Sets the specified left and right output gain values on the AudioTrack.

Gain values are clamped to the closed interval [0.0, max] where max is the value of #getMaxVolume. A value of 0.0 results in zero gain (silence), and a value of 1.0 means unity gain (signal unchanged). The default value is 1.0 meaning unity gain.

The word "volume" in the API name is historical; this is actually a linear gain.

This member is deprecated. Applications should use #setVolume instead, as it more gracefully scales down to mono, and up to multi-channel content beyond stereo.

Java documentation for android.media.AudioTrack.setStereoVolume(float, float).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to