Bagikan melalui


MediaPlayer.Volume Property

Gets or sets the media player volume.

Namespace: Microsoft.Xna.Framework.Media
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

Syntax

public static float Volume { get; set; }

Property Value

Media player volume, from 0.0f (silence) to 1.0f (full volume relative to the current device volume).

Remarks

Volume adjustment is based on a decibel, not multiplicative, scale. For example, when the device volume is half of maximum (about 7 in the Windows Phone user interface), setting Volume to 0.6f or less is silent or nearly so, not volume 4 as you would expect from a multiplicative adjustment.

Setting Volume to 0.0 subtracts 96 dB from the volume. Setting Volume to 1.0 subtracts 0 dB from the volume. Values in between 0.0f and 1.0f subtract dB from the volume proportionally.

See Also

Reference

MediaPlayer Class
MediaPlayer Members
Microsoft.Xna.Framework.Media Namespace

Platforms

Xbox 360, Windows 7, Windows Vista, Windows XP, Windows Phone