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

Change volume for DirectSoundOut

Aug 28, 2012 at 1:50 PM
Edited Aug 28, 2012 at 1:51 PM

I have an application where I need the ability to loop the audio stream from the input to the speakers.  I am currently doing this with WaveIn and DirectSoundOut. 

Everything here works except that the DirectSoundOut says that it does not support volume when I get down to that line of code. How can I change the volume of the audio being sent to the speakers? If it means I cannot use DirectSoundOut that is fine, but what would I use?

I'm setting up using the code below:

private void button1_Click(object sender, EventArgs e)
    if (waveIn == null)
        waveIn = new WaveIn();
        waveIn.WaveFormat = new NAudio.Wave.WaveFormat(sampleRate, bitsPerSample, channels);
        if (waveOut == null)
            WaveInProvider waveInProvider = new WaveInProvider(waveIn);
            waveOut = new DirectSoundOut();

        waveOut.Volume = volumeSlider1.Volume;

Sep 5, 2012 at 4:18 PM

Either use WaveOut/WaveOutEvent instead, or you would need to modify the levels of each sample (e.g. using VolumeWaveProvider16)