user2569038
user2569038

Reputation: 33

How to change the volume in System.Windows.Media.MediaPlayer()

I write the code below but I cannot change the volume of the sound. I changed "a.Volume = 5;" but this did not affect anything. How can I change the volume of the audio. Thanks

var a = new System.Windows.Media.MediaPlayer();

a.Open(new System.Uri(@"\a.wav”))

a.Volume = 5;

a.Play();

Upvotes: 2

Views: 5820

Answers (1)

Martheen
Martheen

Reputation: 5644

Volume properties accept a Double value between 0 (no sound) and 1 (maximum volume)

Upvotes: 4

Related Questions