Jump to content
  • Advertisement
Sign in to follow this  
daedalic

A Question About Ogg Decoding

This topic is 2780 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When you decode data from an ogg file, are you able to convert every N bytes of ogg data into exactly M bytes of pcm/raw data? Or is the result variable?

Share this post


Link to post
Share on other sites
Advertisement
Ogg/Vorbis supports both variable and fixed rates. In case of fixed rates you may indeed be able to deduce how much PCM-data N bytes of ogg-data would be. But why would you want to?

The Vorbis-library has a utility function ov_read, which allows you to request a number of bytes of PCM-data, and the library reads in just as much compressed data as it needs.

Share this post


Link to post
Share on other sites
Quote:
Original post by DaBono
Ogg/Vorbis supports both variable and fixed rates. In case of fixed rates you may indeed be able to deduce how much PCM-data N bytes of ogg-data would be. But why would you want to?


The idea is to have individual blocks of ogg data from multiple sounds converted into pcm data before being mixed into a single pcm buffer, which is then played. I need pcm blocks of a fixed size to mix them properly.

Share this post


Link to post
Share on other sites
Quote:
Original post by daedalic
The idea is to have individual blocks of ogg data from multiple sounds converted into pcm data before being mixed into a single pcm buffer, which is then played. I need pcm blocks of a fixed size to mix them properly.
Sure, but that doesn't mean you have to decompress exactly that much. Have a buffer for the unused results of each decompression; when you need more PCM data you pull a chunk off, and whenever there isn't enough data in the buffer for that you decompress OGG data until there is.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!