WAVE playback bad
Ryan C. Gordon
icculus at clutteredmind.org
Thu Oct 4 15:12:51 EDT 2001
> I replied to sender instead of to mailing list again... >sigh<
(I seriously need to get better mailing list software here...)
> This may be old news, but SDL already has a SDL_RateSLOW() in
> SDL_audiocvt.c, in addition to SDL_RateMUL2() and SDL_RateDIV2().
> Unfortunately it's never used. According to the comment:
Even RateSLOW() isn't particularly good, but it IS better than nothing.
Due to the nature of SDL_sound, we can probably make use of it better than
SDL itself can, since we're less concerned about powers of two.
To fix this in SDL, the data that is farmed from the audio callback needs
to be buffered if there's a conversion needed, due to the programmer
forcing the audio device into an emulated mode.
if (extrabuffer isn't empty)
if (extrabuffer still isn't empty)
audio_callback(buffer); // get more data from application.
...this adds overhead, but fixes the problem. note that "Move what you can
to the audio device" can still be all the data, if the audio device
doesn't require buffers to be multiples of two in size.
More information about the sdlsound