author Sam Lantinga
Sat, 08 Jun 2019 18:22:18 -0700
changeset 12803 70d338e248c8
parent 10890 a2ec89f77e6b
permissions -rw-r--r--
Fixed bug 4294 - Audio: perform more validation on conversion request


There are many cases which are not able to be handled by SDL's audio conversion routines, including too low (negative) rate, too high rate (impossible to allocate).

This patch aims to report such issues early and handle others in a graceful manner. The "INT32_MAX / RESAMPLER_SAMPLES_PER_ZERO_CROSSING" value is the conservative approach in terms of what can _technically_ be supported, but its value is 4'194'303, or just shy of 4.2MHz. I highly doubt any sane person would use such rates, especially in SDL2, so I would like to drive this limit further down, but would need some assistance to do that, as doing so would have to introduce an arbitrary value. Are you OK with such approach? What would a good value be? Wikipedia ( lists 96kHz as the highest sampling rate in use, even if I quadruple it for a good measure, to 384kHz it's still an order of magnitude lower than 4MHz.
     2                          Simple DirectMedia Layer
     4                                   (SDL)
     6                                 Version 2.0
     8 ---
    11 Simple DirectMedia Layer is a cross-platform development library designed
    12 to provide low level access to audio, keyboard, mouse, joystick, and graphics
    13 hardware via OpenGL and Direct3D. It is used by video playback software,
    14 emulators, and popular games including Valve's award winning catalog
    15 and many Humble Bundle games.
    17 More extensive documentation is available in the docs directory, starting
    18 with
    20 Enjoy!
    21 	Sam Lantinga				(