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

WaveChannel32.Sample Event Not Firing

Oct 10, 2010 at 3:27 AM

Hello. :)

I'm trying to create a simple audio visualization and I'm having trouble.

Dim reader As New NAudio.Wave.Mp3FileReader(Me.OpenFileDialog.FileName)
waveStream = New BlockAlignReductionStream(WaveFormatConversionStream.CreatePcmStream(reader))
inputStream = New WaveChannel32(waveStream)
AddHandler inputStream.Sample, AddressOf OnSample
waveOut = New WaveOut()
waveOut.Init(waveStream)

I use that code when I open a file. It adds the handler for the Sample event, but it never gets called when I play a file. I hear audio, I just never get anything from the Sample event.

Any ideas?

Thanks.

Coordinator
Oct 10, 2010 at 1:46 PM

instead of waveOut.Init(waveStream), you need to use waveOut.Init(inputStream)

Mark

Oct 10, 2010 at 7:09 PM

Thank you!

-X Enterprises