Closed Ala-lala closed 5 years ago
Wish GitHub didn't get rid of the private messages.
Could throw it on the UQM forums.
Doing the copies ends up making each audio buffer fill take three times the work -- for the MixSDL and nosound cases we should "fix" such potential future bugs by also expanding the mixer objects.
The OpenAL case is interesting because at the time we'd written the support we had not contemplated that 64-bit OpenAL would be an option. The base code has not been tested against OpenAL Soft at all -- except by intrepid modders, anyway.
I expect to incorporate some but not all of this patch into the vanilla codebase.
Doing the copies ends up making each audio buffer fill take three times the work
Wait, what? I thought the audio_Object
s were essentially pointers, and the samples themselves were passed to BufferData
(which doesn't do any conversion). Am I wrong?
I'm basing this on the functions like nosound_Convert{To/From}AudioBuffer, which have a loop in them that does the copy; assuming that data is going through that in both directions that's two extra memcpy-like operations compared to the first. It's possible I'm less clear on the actual dataflow here, though; I don't really have any sharp memories of this code.
The OpenAL audio driver was assuming that the size of
audio_IntVal
andaudio_Object
were the same asALint
andALuint
. This is wrong on 64-bit builds, asaudio_IntVal
andaudio_Object
are defined asintptr_t
anduintptr_t
whileALint
andALuint
are defined asint
andunsigned int
. This caused a crash when playing any sound with OpenAL.The MixSDL and nosound drivers were making the same assumption with
mixer_IntVal
andmixer_Object
, but this wasn't currently an issue since they're also defined asintptr_t
. I've added the same code to them to ensure they still work ifaudio_IntVal
and_Object
ever become larger thanmixer_IntVal
and_Object
.(This also affects base UQM; if I could, I'd submit the patch to their bug tracker, but it's down.)