Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Streaming with ohLibSpotify and NAudio
05-02-2014, 05:48 PM
Post: #3
RE: Streaming with ohLibSpotify and NAudio
Hi,

During playback, your MusicDeliveryCallback will be called over and over again. You need to create a single BufferedAudioProvider and feed the audio to it each time your MusicDeliveryCallback is invoked. Your example here will play silence because:

1. It creates a new BufferedWaveProvider on every invocation, but only the first one is ever attached to the WaveOut device.
2. As far as I can tell, you write samples into the BufferedWaveProvider and then immediately read them out again. You should be writing them in and letting the wave device read them out.

In addition, I should note that num_frames tells you the number of frames, not the number of bytes. When you declare arrays and use Marshal.Copy, you need to multiply this number by the number of channels and the bytes per sample.

I'm sorry I don't have more time to look into this, but as noted above, I've moved on from the project and have a new employer. Hopefully this information should point you in the right direction. Good luck.

Regards,

Andrew (Weeble).
Visit this user's website Find all posts by this user


Messages In This Thread
RE: Streaming with ohLibSpotify and NAudio - andreww - 05-02-2014 05:48 PM

Forum Jump: