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

NotifyingSampleProvider with a BufferedWaveProvider

Aug 20, 2012 at 6:41 PM


I'm pretty sure this is a stupid question, but I can't seem to found out the answer anywhere on the forum.

I've a network stream that I buffer with the BufferedWaveProvider.

In another thread I fill the BufferedWaveProvider with AddSamples, but the Sample event is never called by my NotifyingSampleProvider.

Here is the code I'm using.

m_muLawChatCodec = new MuLawChatCodec();
m_waveOut = new WaveOut();

m_waveProvider = new BufferedWaveProvider(m_muLawChatCodec.RecordFormat);

m_sampleChannel = new SampleChannel(m_waveProvider);
m_notifyingSampleProvider = new NotifyingSampleProvider(m_sampleChannel);
m_notifyingSampleProvider.Sample += new EventHandler<SampleEventArgs>(sampleStream_Sample);

//In the thread:
byte[] decoded = m_muLawChatCodec.Decode(frame, 0, frameLenght);
m_waveProvider.AddSamples(decoded, 0, decoded.Length);

What am I doing wrong?

Thanks for your help.


Aug 20, 2012 at 8:48 PM


I've found the problem, everything should have been done prior to the m_waveOut.Init(m_waveProvider);

Thanks for your help.


Aug 28, 2012 at 7:19 AM

hi, glad you got it working in the end