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

NotifyingSampleProvider with a BufferedWaveProvider

Aug 20, 2012 at 5:41 PM

Hi,

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_waveOut.Init(m_waveProvider);
m_waveOut.Play();

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 7:48 PM

Hi,

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

Thanks for your help.

Freedon

Coordinator
Aug 28, 2012 at 6:19 AM

hi, glad you got it working in the end