SDL performance issue?

NOTE: Cross-posted from Game Development forum, probably not the right place for this…

I’m having a performance issue with an app that uses SDL for audio only. I have a Sony Vaio VPCF1 laptop for the app development; Intel i5 480 (2.7GHz 2-core), 4GB RAM, NVIDIA GeForce M310, Win7 64-bit.

When I run the app with the laptop tethered to a power cord, the audio is flawless, my SDL callback is called at appropriate intervals.

When I run the app with the laptop on battery, the audio is choppy, my SDL callback is called at about half the rate as when the power cord is plugged in.

The behavior changes dynamically and immediately upon power cord insertion/removal (ie. I don’t have to stop/restart the app).

When on battery, the sound is choppy because the callback is still asking for only enough bytes of audio data to fill the next period, which isn’t enough because the next period is actually longer than it should be (due to the callback call frequency being halved).

I have verified the callback frequencies stated above with QueryPerformanceCounter.

I have looked all over my computer for settings that could affect this, and have disabled every power-save feature I can find, but no difference.

When running similar applications that do not use SDL I do not observe this behavior.

I don’t know if this is an issue with QueryPerformanceCounter or not [I have read there are concerns about that], but I also noticed that the variability of the period between SDL callback calls is nowhere near constant. If I want a 60Hz callback it varies from 60Hz by quite a bit, but never enough to cause audible glitches when the laptop is connected to a power cord.

Does anyone have any suggestions as to what could be wrong?

Sounds more like a driver issue than anything else; might be a setting in
device manager (if you’re using windows) or a sound setting in linux
(depending on the sound software you’re using).
Check those out, and if you find anything, do post it here.
-AlexOn Thu, Mar 31, 2011 at 2:51 PM, cpow <christopher_pow at hotmail.com> wrote:

NOTE: Cross-posted from Game Development forum, probably not the right
place for this…

I’m having a performance issue with an app that uses SDL for audio only. I
have a Sony Vaio VPCF1 laptop for the app development; Intel i5 480 (2.7GHz
2-core), 4GB RAM, NVIDIA GeForce M310, Win7 64-bit.

When I run the app with the laptop tethered to a power cord, the audio is
flawless, my SDL callback is called at appropriate intervals.

When I run the app with the laptop on battery, the audio is choppy, my SDL
callback is called at about half the rate as when the power cord is plugged
in.

The behavior changes dynamically and immediately upon power cord
insertion/removal (ie. I don’t have to stop/restart the app).

When on battery, the sound is choppy because the callback is still asking
for only enough bytes of audio data to fill the next period, which isn’t
enough because the next period is actually longer than it should be (due to
the callback call frequency being halved).

I have verified the callback frequencies stated above with
QueryPerformanceCounter.

I have looked all over my computer for settings that could affect this, and
have disabled every power-save feature I can find, but no difference.

When running similar applications that do not use SDL I do not observe this
behavior.

I don’t know if this is an issue with QueryPerformanceCounter or not [I have read there are concerns about that], but I also noticed that the
variability of the period between SDL callback calls is nowhere near
constant. If I want a 60Hz callback it varies from 60Hz by quite a bit, but
never enough to cause audible glitches when the laptop is connected to a
power cord.

Does anyone have any suggestions as to what could be wrong?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org