libsdl-org / SDL

Simple Directmedia Layer
https://libsdl.org
zlib License
9.46k stars 1.76k forks source link

Prefer floats in SDL_ClosestAudioFormats #9581

Closed 0x1F9F1 closed 1 month ago

0x1F9F1 commented 5 months ago

Currently the format_list prefers using integer types, before using floats. Should it more aggresively prefer floats, given that's what all the mixing/resampling/conversions are done with?

slouken commented 5 months ago

Yes, the format list should probably be "exact match", "native float", "easiest conversion from native float" ... and maybe that's it?

@icculus, thoughts?

icculus commented 5 months ago

Most of the backend APIs either accept float or prefer it, so moving that first is probably good, as we're likely going to be working in floats no matter what the app or the backend wants.

OpenSLES needs to be fixed real quick, because it doesn't handle float at all but only checks if the data format is signed:

https://github.com/libsdl-org/SDL/blob/fb4c15319ec61d963975b47dd1ec21fae184bc04/src/audio/openslES/SDL_openslES.c#L435-L440

All the rest look okay.

icculus commented 5 months ago

OpenSLES needs to be fixed real quick

This isn't true after all, it handles it correctly outside that code snippet.