The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL_Delay causes coil noise
andoru


Joined: 23 Mar 2014
Posts: 12
I'm having some problems with an emulator that uses SDL (DosBox), it being the only application that causes coil noise (or screeching) from the CPU. Somebody from their forums suggested me to replace SDL_Delay with busyWait in the source code and it fixed the problem, but that causes the emulator to use 100% CPU. Is there any work around or any fix to SDL_Delay? (assuming that's what's causing the noise)
Dominus


Joined: 13 Oct 2009
Posts: 127
since I'm on the same forum, DOSBox is using SDL 1.2x not SDL2 if that matters.
andoru


Joined: 23 Mar 2014
Posts: 12
Whops, I forgot to mention that, I never use any app that uses SDL 2.X Razz
SDL_Delay causes coil noise
Daniel Gibson
Guest

Am 23.08.2014 17:44, schrieb andoru:
Quote:
I'm having some problems with an emulator that uses SDL (DosBox), it
being the only application that causes coil noise (or screeching) from
the CPU. Somebody from their forums suggested me to replace SDL_Delay
with busyWait in the source code and it fixed the problem, but that
causes the emulator to use 100% CPU. Is there any work around or any fix
to SDL_Delay? (assuming that's what's causing the noise)


Is it really from the CPU?
I got that from the GPU in a game with vsync disabled.
Try enabling vsync in the game or even enforcing it in the driver.

Good luck Wink

Cheers,
Daniel

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
andoru


Joined: 23 Mar 2014
Posts: 12
Well I know for certain the noise comes from the CPU due to the fact that in DosBox, you can set the amount of cycles it emulates (the more cycles, the more CPU intensive) and when I increase the amount of cycles, the coil noise lowers in pitch. And also what I said earlier: when using busyWait instead of SDL_Wait, there's no coil noise, but the CPU is used to 100% so I think it's the CPU that the noise comes from.
Unfortunately DosBox does not have a vsync feature, and I think it would impossible to implement it in the emulator. By driver do you mean a SDL video driver (DosBox doesn't use one) or do you mean the video card driver's settings? In the second case I'm using an integrated GPU and I'm on linux, so I have no way of setting any vsync settings Razz
So I couldn't test that.
SDL_Delay causes coil noise
Turo Lamminen
Guest

On Sun, 24 Aug 2014 22:01:29 +0000
"andoru" wrote:

Quote:
Well I know for certain the noise comes from the CPU due to the fact
that in DosBox, you can set the amount of cycles it emulates (the
more cycles, the more CPU intensive) and when I increase the amount
of cycles, the coil noise lowers in pitch. And also what I said
earlier: when using busyWait instead of SDL_Wait, there's no coil
noise, but the CPU is used to 100% so I think it's the CPU that the
noise comes from.
It could be caused by your CPU switching powersaving modes. Try
disabling it. On Linux this is cpufreq which can be controlled (at
least on my computer with Debian testing) with cpufreq-info and
cpufreq-set programs. There's probably also some GUI tool for it
depending on your desktop.

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
SDL_Delay causes coil noise
Simon Sandström
Guest

I think you are attacking the problem the wrong way. I would try to locate exactly what is causing the coil noise and replace those bad parts, or just accept that your computer generates coil noise at some specific CPU current draw/load. Anyway, I don't think this is a topic for the SDL Development List..

http://superuser.com/questions/19968/processor-noise-what-generates-it





Simon



2014-08-29 11:10 GMT+02:00 Turo Lamminen:
Quote:
On Sun, 24 Aug 2014 22:01:29 +0000
"andoru" wrote:

Quote:
Well I know for certain the noise comes from the CPU due to the fact
that in DosBox, you can set the amount of cycles it emulates (the
more cycles, the more CPU intensive) and when I increase the amount
of cycles, the coil noise lowers in pitch. And also what I said
earlier: when using busyWait instead of SDL_Wait, there's no coil
noise, but the CPU is used to 100% so I think it's the CPU that the
noise comes from.

It could be caused by your CPU switching powersaving modes. Try
disabling it. On Linux this is cpufreq which can be controlled (at
least on my computer with Debian testing) with cpufreq-info and
cpufreq-set programs. There's probably also some GUI tool for it
depending on your desktop.

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org