Given an encoded buffer in C++, what would be the steps using oggvorbis structs to decode the already in-memory data?
OggVorbis_File cannot be used, because assets are within compressed archives.
I'm trying to research the necessary structs and methods, but I'm fairly new to audio encoding and decoding.
Any resources that can help further my reading are appreciated as well!
I should clarify, I intend to use the decoded data to stream into OpenAL.
Thanks.
Answering my own question.
This can be done by providing custom callbacks to vorbis.
Usage
A Special thanks to the Doom3 GPL source for most of the help with this, it can be viewed at : here
You also can don't reinvent the wheel and use
fmemopen
like this:Where
data
is pointer to memory beginning andlen
is length of your data. Then passmemfile
toov_open
like regularFILE
object.However, there is downside: this function seems linux-specific (but it can be found in arduino, so I'm a bit confused about its status), so you don't have it on other systems. But there is some implementations for them (check libconfuse for window or for apple OSes).