SDL icon indicating copy to clipboard operation
SDL copied to clipboard

Prefer floats in SDL_ClosestAudioFormats

Open 0x1F9F1 opened this issue 1 year ago • 3 comments

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?

0x1F9F1 avatar Apr 19 '24 00:04 0x1F9F1

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

@icculus, thoughts?

slouken avatar Apr 19 '24 14:04 slouken

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 avatar Apr 20 '24 03:04 icculus

OpenSLES needs to be fixed real quick

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

icculus avatar Apr 20 '24 14:04 icculus