diff options
author | Chris Robinson <[email protected]> | 2008-08-08 07:32:21 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2008-08-08 07:32:21 -0700 |
commit | ef59901e7c5b8813214fde6ee090d835c67277fd (patch) | |
tree | 24407563ad5ab63d8081844696e8d58b4f6a0eaf /Alc/ALu.c | |
parent | cfe620ccb5496f8e928cdba0c74fd26b5fd87f34 (diff) |
Set FPU mode to round toward zero for mixing
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r-- | Alc/ALu.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -650,9 +650,20 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma ALuint loop; ALint64 DataSize64,DataPos64; FILTER *Filter; + int fpuState; SuspendContext(ALContext); +#if defined(HAVE_FESETROUND) + fpuState = fegetround(); + fesetround(FE_TOWARDZERO); +#elif defined(HAVE__CONTROLFP) + fpuState = _controlfp(0, 0); + _controlfp(_RC_CHOP, _MCW_RC); +#else + (void)fpuState; +#endif + //Figure output format variables BlockAlign = aluChannelsFromFormat(format); BlockAlign *= aluBytesFromFormat(format); @@ -1206,5 +1217,11 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma size -= SamplesToDo; } +#if defined(HAVE_FESETROUND) + fesetround(fpuState); +#elif defined(HAVE__CONTROLFP) + _controlfp(fpuState, 0xfffff); +#endif + ProcessContext(ALContext); } |