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

WaveOutThreadSafe

Jan 5, 2011 at 7:00 PM

I am trying to play a wav file using your thread safe version of WaveOut, but I get nothing out.  Attempting the same thing using standard WaveOut works fine.  Here my test code:

 

            WaveFileReader waveMusic = new WaveFileReader(@"..\..\wave\tests\music.WAV");


            if (WaveOutThreadSafe.DeviceCount <= 0)
            {
                throw new ArgumentException("No audio device found");
            }

            WaveOutThreadSafe waveOut = new WaveOutThreadSafe(0, 100);
            waveOut.Init(waveMusic);
            waveOut.Play();

            Thread.Sleep(10000);
            waveOut.Stop();
            waveOut.Dispose();
            waveMusic.Close();
            waveMusic.Dispose();

Any insight would be greatly appreciated.

Diane

Jan 6, 2011 at 1:41 PM

Got it working.  There's a bug in the WaveOutThreadSafe.Init method.  The call to enqueue should use waveProvider rather than waveStream.

Coordinator
Jan 6, 2011 at 1:43 PM

glad you got it working. To be honest, the WaveOutThreadSafe class was an experiment to get round a driver issue, and is not often used by anyone.

Mark

Jan 6, 2011 at 2:01 PM

One other bug I found in WaveOutThreadSafe.  ThreadProc Init case should typecast waveOutAction.Data to IWaveProvider rather than WaveStream.

Jan 6, 2011 at 2:13 PM

I will be writing data out from a processing thread as I receive it in real-time, so the thread safe version is my only option. Do you know of any other bugs with the class?

Thanks,

Diane

From: markheath [email removed]
Sent: Thursday, January 06, 2011 8:43 AM
To: Glasgow, Diane
Subject: Re: WaveOutThreadSafe [naudio:240610]

From: markheath

glad you got it working. To be honest, the WaveOutThreadSafe class was an experiment to get round a driver issue, and is not often used by anyone.

Mark

Coordinator
Jan 6, 2011 at 3:11 PM

WaveOutThreadSafe was written long before IWaveProvider existed, so I'm not surprised it has a few issues.

Mark