sawass sawass

sawass sawass

  • NA
  • 36
  • 23.7k

Stop brodcastig in 3 external soundcard

Jun 6 2011 6:08 PM
Hello,
I want to stop the broadcasting of a sound wave in looping.I've used this method but to no avail:

private void btnStop_Click(object sender, EventArgs e)
{
if (output != null)
{
if (output.PlaybackState == NAudio.Wave.PlaybackState.Playing)
{
output.Stop();

}
}


}

I use the play function follows:
 public void PlaySoundInDevice(int deviceNumber, string fileName)
        {
            if (outputDevices.ContainsKey(deviceNumber))
            {
                outputDevices[deviceNumber].WaveOut.Dispose();
                outputDevices[deviceNumber].WaveStream.Dispose();
            }
            
                var waveOut = new WaveOut();
                waveOut.DeviceNumber = deviceNumber;
                WaveStream waveReader = new WaveFileReader(fileName);
                LoopStream loop = new LoopStream(waveReader);
                waveOut = new WaveOut();
                waveOut.Init(loop);
                waveOut.Play();
                // hold onto the WaveOut and  WaveStream so we can dispose them later
                outputDevices[deviceNumber] = new PlaybackSession { WaveOut = waveOut, WaveStream = waveReader };}
Ihave 3 external soundcard and the wave out of the 3 sond card

Is anybody can help me please and thank you in advance.