Can the value of sample->buffer change?

Ryan C. Gordon icculus at
Sat Dec 1 12:27:03 EST 2001

> No, the decoder may change the size of sample->buffer through
> Sound_SetBufferSize() (at least Ryan hasn't yelled at me for doing so in
> the FLAC decoder even after I told him :-) and the reallocated buffer
> may very well end up on some other address than the original.

I was going to yell (  :)  ), but I figure it might as well be kept
flexible, especially since the pointer to sample needs to be kept around
for other purposes, which means that it's easy enough to deference it
without too much acrobatics.

Once a Sound_DecodeAll() is done, it has no reason to change anymore, if
you're going to take that route, Andreas.

The alternative for the FLAC decoder is to keep a second internal buffer,
decode into that, and then memcpy to the actual internal->buffer, keeping
track of overflow, but that sounds less sane to me.


More information about the sdlsound mailing list