icculus / mojoAL

An SDL2-based implementation of OpenAL in a single C file.
https://icculus.org/mojoAL/
zlib License
158 stars 21 forks source link

Made source_get_offset return float to allow precise AL_SEC_OFFSET #1

Closed ivan-mogilko closed 3 years ago

ivan-mogilko commented 3 years ago

Hello. I'm not an expert in OpenAL, but using your library I found that calling alGetSourcef with AL_SEC_OFFSET returns only second-precise values, although according to specs it should be supporting fractional values too.

It looks like this small change is enough to fix it.

PS. _alGetSourceiv already converting the result value to int here, so that should stay correct: https://github.com/icculus/mojoAL/blob/44bb6799215238986d12ffa1d85ee49f24a2ccad/mojoal.c#L3742

icculus commented 3 years ago

Your fix is correct, and I just fixed this myself a few days ago (and hadn't merged it back to the main repository yet; I apologize that I caused a duplication of effort here).

That fix is in 9225d377719678415b0437e2c7a4955aeec386ad.

ivan-mogilko commented 3 years ago

Oh, good to know, no problem.