fpu controlword altered on windows
Xavier Bouchoux <[email protected]> Fri, 01 Jul 2011 16:36:34 +0200
| Newsgroups | gmane.comp.lib.openal |
|---|---|
| Message-ID | <[email protected]> |
Hi chris!
I discovered a bug in the windows version. The fpu state of the program
was altered when making openal calls.
something like this patch is needed:
Alc/ALu.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 7cddb5a..2e3f81d 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -954,7 +954,8 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer,
ALsizei size)
fpuState = fegetround();
fesetround(FE_TOWARDZERO);
#elif defined(HAVE__CONTROLFP)
- fpuState = _controlfp(_RC_CHOP, _MCW_RC);
+ fpuState = _controlfp(0, 0);
+ (void)_controlfp(_RC_CHOP, _MCW_RC);
#else
(void)fpuState;
#endif
(It wasn't appearing before because the aluMixData() was always called
from a thread and switching thread saves/restores the flag.
But alcRenderSamplesSOFT(), on the other hand, calls it directly from
the application thread...)
Speaking of which, the ALC_SOFTX_loopback_device extension works pretty
well!
compared with the tentative version I once sent you, the implentation in
openAl is indeed much simpler.
From the application point of view: it's a bit less transparent than
just opening a device that does both capture and playback and calling
alcCaptureSamples(), a specific code path has to be written.
But on the other hand it's much clearer and robust:
On the whole I like it better..
The only oddity, I guess, is having to use specific enums
"AL_STEREO"+"AL_SHORT" instead of just reusing the same enum as the
fallback capture device code path, "AL_FORMAT_STEREO16" (which is
obviously less flexible, but more standard..)
Le 19/06/2011 03:39, Chris Robinson a écrit :
> The best option would be getting the game's developer to fix the app, but
> short of that I can add a hack to OpenAL Soft to check for an environment
> variable and return 0 when no context is available (similar to how it handles
> reversed Z for TrackMania, ).
(oh! oups... I wasn't aware of this. shame on me...
I'll fix it if we make a new patch, someday.)
_______________________________________________
Openal mailing list
[email protected]
http://opensource.creative.com/mailman/listinfo/openal