author Ryan C. Gordon <>
Tue, 15 May 2018 01:04:11 -0400
changeset 11987 0c284754e25b
parent 9940 f2d5ed0d9686
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.
     1 <?xml version="1.0"?>
     2 <package >
     3   <metadata>
     4     <id>SDL2-WinRT</id>
     5     <version>2.0.4-Unofficial</version>
     6     <authors>Sam Lantinga</authors>
     7     <owners>David Ludwig</owners>
     8     <licenseUrl></licenseUrl>
     9     <projectUrl></projectUrl>
    10     <requireLicenseAcceptance>false</requireLicenseAcceptance>
    11     <description>Unofficial pre-release of LibSDL2, built for WinRT platforms</description>
    12     <copyright>Copyright 2015</copyright>
    13     <tags>SDL2 SDL LibSDL OpenGL C C++ nativepackage</tags>
    14   </metadata>
    15   <files>
    16     <file src="lib\**\*.dll" target="bin"/>
    17     <file src="lib\**\*.lib" target="bin"/>
    18     <file src="lib\**\*.pdb" target="bin"/>
    19     <file src="..\include\**\*.*" target="include"/>
    20     <file src="..\src\**\*.*" target="src"/>
    21     <file src="SDL2-WinRT.targets" target="build\native"/>
    22   </files>
    23 </package>