README-SDL.txt
author Ryan C. Gordon <icculus@icculus.org>
Tue, 15 May 2018 01:04:11 -0400
changeset 11987 0c284754e25b
parent 10892 996c14d41c46
permissions -rw-r--r--
audio: converting int32 to/from float shouldn't use doubles.

The concern is that a massive int sample, like 0x7FFFFFFF, won't fit in a
float32, which doesn't have enough bits to hold a whole number this large,
just to divide it to get a value between 0 and 1.
Previously we would convert to double, to get more bits, do the division, and
cast back to a float, but this is expensive.

Casting to double is more accurate, but it's 2x to 3x slower. Shifting out
the least significant byte of an int32, so it'll definitely fit in a float,
and dividing by 0x7FFFFF is still accurate to about 5 decimal places, and the
difference doesn't appear to be perceptable.
gabomdq@9023
     1
gabomdq@9023
     2
Please distribute this file with the SDL runtime environment:
gabomdq@9023
     3
gabomdq@9023
     4
The Simple DirectMedia Layer (SDL for short) is a cross-platform library
icculus@10108
     5
designed to make it easy to write multi-media software, such as games
icculus@10108
     6
and emulators.
gabomdq@9023
     7
gabomdq@9023
     8
The Simple DirectMedia Layer library source code is available from:
icculus@10892
     9
https://www.libsdl.org/
gabomdq@9023
    10
gabomdq@9023
    11
This library is distributed under the terms of the zlib license:
gabomdq@9023
    12
http://www.zlib.net/zlib_license.html
gabomdq@9023
    13