SDL Digest, Vol 2, Issue 49

Hi Ryan,

Short of stepping through it in a debugger and watching what function
got called when the FPU control register changed, I can’t really guess.
Does DirectSound change it, too? You might be using that in SDL, even
with windib.

Also, you can always forcibly change it back in your own app with
something like _controlfp() or an asm block, once you figure out the
point where it’s getting changed.

–ryan.

Great advice, I’ll step through the code with a debugger and see when
the FPU flags get changed.

Two questions:

  1. Which audio drivers are available for Windows?
  2. Is the FPU control register something I can change just by reading
    it, and’ing or or’ing with a mask and writing back the new value?

Thanks again,

Andre

  1. Which audio drivers are available for Windows?

“dsound” and “waveout”, which roughly correlate to SDL’s “directx” and
"windib" video drivers.

  1. Is the FPU control register something I can change just by reading
    it, and’ing or or’ing with a mask and writing back the new value?

Yes, but probably not in Lua directly. There’s an x86/amd64 assembly
instruction for reading and writing that register (and, from C, there’s
usually a non-standard function called _controlfp() or something similar
to do the same).

If you can’t figure out what’s changing the control word, or you can’t
stop it from changing it, forcing it back yourself will probably Just Work.

–ryan.