I'm porting my ancient brick game Colibricks from carbon to cocoa to make it 64 bit.
I noticed that some of the sounds suddenly sound a lot duller than before, as if they were much further away. First I thought I was doing something wrong in the sound routines (alSource3f, alPlay,...) but I had copied that OpenAL code from an earlier iOS port which sounds fine.
To make sure there was nothing wrong with the sound files themselves, I played them in XCode. That's when I noticed something extremely weird: the sounds are OK when I first play them, but then sound dull when I play them again!
I tried in VLC: sounds OK every time.
Quicktime Player: OK the first time, dull the second and next times.
Safari: same as Quicktime Player, OK first time, dull next times. Refresh page: OK again first time, then dull again.
Chrome: OK every time.
Does anyone have any idea what's going on and how I can fix it?
You can download one of the sounds (a ping pong ball being hit by a paddle) from http://www.colibricks.com/Sound131.wav
Just point Safari to that link, click the play button, then click it again to hear the difference. Refresh the page and do it again: first OK, then dull.
The old Carbon version of the app (which I can't even compile anymore but still runs on Mojave) continues to sound fine. And so does the iOS version, even in the simulator on the mac.
It seems like it's some sort of a bug in the MacOS core audio or openAL routines, since third party apps with custom sound routines don't seem to suffer from the problem. Maybe I should use a different sound framework to avoid the issue?
Any help would be very much appreciated! I can't ship the game like this, it sounds dreadful compared to earlier versions.
(MacBook Pro 15 inch 2016, Mojave 10.14.5)