[SDL] Audio callback function is not called in time sometimes
Christophe Pallier
christophe at pallier.org
Tue Dec 4 06:11:35 PST 2007
All sorts of things can create latencies that will result in audio drop outs.
As you mentionned in your first post: task swiches, windows minimisation, etc...
To try and avoid this problem:
Disable the power saving functions.
If you can, kill all processes that are necessary.
If you want to have task switches, increase the sound buffer length.
Christophe Pallier
On 12/4/07, Mine <mine260309 at gmail.com> wrote:
> Anyone know about that?
> Here's some data about the delay of audio_callback function:
> 1) when it's playing normally, the interval between two audio_callback
> function is about 25~31 ticks in SDL (get from SDL_GetTicks );
> 2) when the sound is fitful, the interval between two audio_callback is
> totally variable from 40 to 80, or larger sometimes.
>
> My question is, how does this problem come? And how to resolve it if
> possible?
>
>
>
> On Nov 30, 2007 9:33 PM, Mine <mine260309 at gmail.com> wrote:
> > Hi All,
> > I'm developing a media player using SDL, and now I met the problem
> that the audio callback function is sometimes not called in time, and cause
> the audio a little fitful.
> > I did some investigation about this problem. I use such piece of code
> to open the audio device:
> > wanted_spec.xxx = xxx;
> > wanted_spec.callback = audio_callback; //audio_callback is my
> audio callback function
> > SDL_OpenAudio(&wanted_spec, &spec);
> > I put some log in audio_callback function, and find that when the
> phenomenon occurs the audio_callback function is not called in time, which
> cause a split of the audio. And continuously not in time called
> audio_callback causes the fitful sound.
> >
> > My OS is Windows XP, and generally this phenomenon occurs when
> there're task switches, like focus on other windows, minimum/maximum a
> window or something like that. And if there's no such task switch, the sound
> is smooth.
> > Do you know anything about that?
> > --
> > Mine
>
>
>
> --
> 俺たちが乗った列車は途中下車はできないんだ!
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>
>
--
Christophe Pallier (http://www.pallier.org)
More information about the SDL
mailing list