[vorbis] Streaming audio to the waveout device

volsung at mailsnare.net volsung at mailsnare.net
Fri Oct 17 13:04:32 PDT 2003



Quoting Agustin Cordes <acordes at elinpar.com>:
> Please excuse my ignorance but I'm having trouble with a very basic matter:
> I'm using vorbisfile to stream audio to the waveout device in Win32 (using
> waveOutWrite). I'm basically reading packets from an ogg file and streaming
> them using a simple buffering scheme. The thing is, this works great when
> the bitrate is more or less constant but the audio sounds garbled if there
> is a radical bitrate change. Which makes sense but I don't know how to
> handle this using vorbisfile! I know I must use ov_instant_bitrate() in some
> way. I'd really appreciate some help. 
> Thanks and excuse my newbie-ness!

Hi, I don't understand the problem you are describing.  If you are decoding
audio data with vorbisfile and sending it to the waveout device, then I don't
see how ov_instant_bitrate() would help you.  ov_instant_bitrate() will just
estimate the bitrate since the last time the function was called.  I don't see
how this information would help fix audio problems.

However, other possibilities that might cause intermittent garbled output:

* ov_read() frequently returns fewer PCM samples than you tell it to.  This is
not a bug, but rather by design.  (It stops decoding when you get to the end of
the current Vorbis packet.  The next call will decode another packet.)  Make
sure you are checking the return value from ov_read() to see how much audio was
written.

* Buffering might also be a problem.  A simple, single-threaded read/write
application can sometimes get into trouble if the audio playback device runs
out of audio to play while the program is blocked waiting for I/O (and thus not
decoding more audio).  The fix here is to redesign your application, so you
probably want to rule out all other bugs before considering this.

Can you describe in more detail what the garbled audio sounds like?  Are their
gaps?  Stuttering?  Noise?


---
Stan Seibert
--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.




More information about the Vorbis mailing list