[sdlsound] Unclear on SDL_Sound SOUND_SAMPLEFLAG_EAGAIN

Jonas Kulla nyocurio at gmail.com
Tue Jan 7 02:33:40 EST 2014


2014/1/7 Ryan C. Gordon <icculus at icculus.org>

> On 01/07/2014 12:01 AM, Greg Toombs wrote:
>
>> Ok. So does that mean that, if a subsequent decode succeeds, it's safe
>> to use the whole buffer? In other words, if I see EAGAIN, how do I
>> interpret the returned byte count?
>>
>
> It's worth noting that this is a lot of explaining for a flag you might
> not need. Here's what the playsound_simple.c demo app does:
>
>     /* if there wasn't previously an error or EOF, read more. */
>     if ( ((sample->flags & SOUND_SAMPLEFLAG_ERROR) == 0) &&
>          ((sample->flags & SOUND_SAMPLEFLAG_EOF) == 0) )
>     {
>          data->decoded_bytes = Sound_Decode(sample);
>          data->decoded_ptr = sample->buffer;
>     } /* if */
>
> It doesn't check EAGAIN...it either got enough data or it didn't, or
> there's definitely no more data coming or it needs to keep checking.


Yeah, I also check for EAGAIN only if the returned byte count is 0.

Jonas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://icculus.org/pipermail/sdlsound/attachments/20140107/c7b8255b/attachment.html>


More information about the sdlsound mailing list