diff options
author | Chris Robinson <[email protected]> | 2010-11-27 00:51:21 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2010-11-27 00:51:21 -0800 |
commit | 61315d4dfb8f42d4b6fc74ba8cf8344653cd6598 (patch) | |
tree | 5ce753cfeeaf754ed7a9a00b85a74bd5e07ea575 /OpenAL32 | |
parent | 2a123a4760d853eb300c684a6e3fc14efa86fe57 (diff) |
Shorten a couple really long lines
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/alSource.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index 5244edb7..b0474a01 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -1873,15 +1873,19 @@ static ALvoid GetSourceOffset(ALsource *Source, ALenum name, ALdouble *offset, A if((OriginalFormat == AL_FORMAT_MONO_IMA4) || (OriginalFormat == AL_FORMAT_STEREO_IMA4)) { + ALuint FrameBlockSize = 65 * Bytes * Channels; + ALuint BlockSize = 36 * Channels; + // Round down to nearest ADPCM block - offset[0] = (ALdouble)((readPos / (65 * Bytes * Channels)) * 36 * Channels); - if(Source->state == AL_PLAYING) + offset[0] = (ALdouble)(readPos / FrameBlockSize * BlockSize); + if(Source->state != AL_PLAYING) + offset[1] = offset[0]; + else { // Round up to nearest ADPCM block - offset[1] = (ALdouble)(((writePos + (65 * Bytes * Channels) - 1) / (65 * Bytes * Channels)) * 36 * Channels); + offset[1] = (ALdouble)((writePos+FrameBlockSize-1) / + FrameBlockSize * BlockSize); } - else - offset[1] = offset[0]; } else if(OriginalFormat == AL_FORMAT_MONO_MULAW || OriginalFormat == AL_FORMAT_STEREO_MULAW || |