diff options
author | Chris Robinson <[email protected]> | 2008-11-11 17:59:55 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2008-11-11 17:59:55 -0800 |
commit | da684564eae03317a1b38184159f650fc963aa23 (patch) | |
tree | a7f22e91ddc2906b17c23f0d8d0e6a761bedf308 | |
parent | fc4c867f27ed6e4c4cee8f5a5228c2c9543e7ee9 (diff) |
Avoid unnecessary floating-point math
-rw-r--r-- | OpenAL32/alSource.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index aa2d5719..50217783 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -2106,15 +2106,12 @@ static ALboolean GetSourceOffset(ALsource *pSource, ALenum eName, ALfloat *pflOf if ((eOriginalFormat == AL_FORMAT_MONO_IMA4) || (eOriginalFormat == AL_FORMAT_STEREO_IMA4)) { - // Compression rate of the ADPCM supported is 3.6111 to 1 - readPos = (ALint)((ALfloat)readPos / 3.6111f); - writePos = (ALint)((ALfloat)writePos / 3.6111f); // Round down to nearest ADPCM block - pflOffset[0] = (ALfloat)((readPos / (36 * lChannels)) * 36 * lChannels); + pflOffset[0] = (ALfloat)((readPos / (65 * 2 * lChannels)) * 36 * lChannels); if(pSource->state == AL_PLAYING) { // Round up to nearest ADPCM block - pflOffset[1] = (ALfloat)(((writePos + (36 * lChannels) - 1) / (36 * lChannels)) * 36 * lChannels); + pflOffset[1] = (ALfloat)(((writePos + (65 * 2 * lChannels) - 1) / (65 * 2 * lChannels)) * 36 * lChannels); } else pflOffset[1] = pflOffset[0]; |