Using STB to load OGG files, decode vs open.

Started by MasterAbdoTGM50, February 05, 2017, 17:06:55

Previous topic - Next topic

MasterAbdoTGM50

Hi,

I've been reading on OpenAL and decided to finally use it so thanks a lot for the demos they helped a lot but getting to the question I notice that STBVorbis has 2 methods to load OGG files

1.decode: which loads the whole thing into a buffer
2.open: which requires an STBVoribisInfo object/struct and if I understood correctly doesn't load it completely but a frame by frame and I enqueue the loaded parts into the source playing the sound

Is there any difference between the two? and what are some benefits of using one over the other or are they just different ways to load the buffer for convenience?

Thanks alot for reading and sorry if my questions were misplaced

spasi

Indeed, using stb_vorbis_get_frame_* and stb_vorbis_get_samples_* lets you do stream decoding. Without decoding the entire file, or even having it entirely in memory.

See the Vorbis demo for an example of a simple music player.

MasterAbdoTGM50

So essentially it's only a question of whether I want the whole file buffered or do I wanna stream it

Thank you alot Spasi :D