[Openal-devel] NEWBIE: Playing OggVorbis files without queued
buffers
Chris Robinson
chris.kcat at gmail.com
Sat Mar 7 07:34:18 PST 2009
On Saturday 07 March 2009 7:20:00 am vexator wrote:
> Ah, so the size of the buffer was hard-coded in the sample. I didn't
> realize. But isn't there a simpler way to find out how big the buffer has
> to be? Can I, from the data provided by the OggVorbis lib, calculate the
> exact length of the file and from that the needed buffer size? I'm new to
> audio programming, so I'm not sure how to do it.
It looks like ov_pcm_total can get the number of pcm sample frames (multiplied
by 2*channels for the number of bytes). Though, I assume this would only work
on seekable complete files, which isn't necessarily guaranteed to be true if
it's user-replaceable. Non-seekable files would likely return 0 or negative
for the size, so you would need to do the method I described earlier for them.
More information about the Openal-devel
mailing list