This project has moved. For the latest updates, please go here.

Change Volume While Playing

Mar 21, 2015 at 8:34 PM
How? :)
afr = new AudioFileReader(open.FileName);
wod = new WaveOut();
I've tried changing the volume property on both. While changing the volume on the AudioFileReader works on the next play, changing it on the output device has no effect at all.
Mar 21, 2015 at 11:17 PM
Edited Mar 21, 2015 at 11:18 PM
You can use a VolumeSampleProvider to do this.

Here's an example from my project:
aReader = new AudioFileReader(file);
vsp = new VolumeSampleProvider(aReader.ToSampleProvider());
You can then set vsp.Volume while the song is playing.
Marked as answer by radiergummi on 3/22/2015 at 9:09 AM
Mar 22, 2015 at 4:12 PM
Thank you!

For everyone else, reading this sometime, the VolumeSampleProvider is located under: