This project has moved and is read-only. For the latest updates, please go here.

Change Volume While Playing

Mar 21, 2015 at 9: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 22, 2015 at 12:17 AM
Edited Mar 22, 2015 at 12:18 AM
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 5:12 PM
Thank you!

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