pelya/commandergenius

SDL mikmod music not working

protoman opened this issue · 7 comments

Using Amiga-Mod music, in a few devices, it seems there is a audio problem that causes a buzz.
Sadly I could not reproduce it on my devices, but a user sent my a video of the problem:
https://drive.google.com/open?id=13OLXUkIjNxveJie-Un5MABXBbjpB7jJ2

This started after I updated my local git with latest changes - I had a very old (+1 year) version locally.

pelya commented

OK, so I've tried to increase audio buffer size, first to 4096, then to 8192, also changed rate frequency, but nothing seems to work.
I still find if funny, because before I've updated the SDL version, it was working for those people. But maybe it is related to the NDK that I also had to update, or the ARM-64 build. There are several possibilities there :(

@pelya I finnally was able to get someone to test it for me, so I will try to get as much details as possible. The bug only affects music, not other sound effects (wav filed playing with Mix_PlayChannel). I am using NDK 20r, my code is available at https://github.com/protoman/rockbot, the sound lib is here: https://github.com/protoman/rockbot/blob/master/soundlib.cpp

First, I am using Amiga-MOD music format, I tried to just use an mp3 or ogg, but just using Mix_LoadMUS and Mix_PlayMusic with it, did not make it work, music went silent (sound effects still play fine), interestingly, the buzz sound does not happen in this case. I've asked the person to try changing the audio buffer size (I've added an option in SDL itself and on my game to change it), but the only thing it did was to change the pitch of the noise, it still does not play the music.

I've also tried to change the cfg flag's, CompatibilityHacksPreventAudioChopping, CompatibilityHacksAppIgnoresAudioBufferSize and CompatibilityHacksStaticInit. The one that made a little difference was CompatibilityHacksStaticInit, that made the music play just for a second or two, before the buzz returning.

Sadly, before I could do more testing, the person asked me to forfeit, so I won't keep further bothering him with APK files for testing. But maybe you can have a better guess with those clues.
Hope you are safe and good. Regards, Iuri.

@pelya I got someone else to help me. Tried to enable all hacks in the cfg at same time, but the game crashed with "repeated errors". Then, I used a OGG Vorbis file converted from my MOD ones, and the problem vanished.
I will add a hack into the Android port, so that it will use OGG instead of MOD, but it would be great if this problem is fixed someday :)

Can confirm that this happens with The Ur-Quan Masters MegaMod under arm64-v8a.

OGG files play perfectly fine but MOD tracker files give off a horrible sound.
Here is an example: https://streamable.com/wlbi68

I've tried screwing around with MikMod and only managed to make the game crash whenever .mod files were loaded.
Audio engine stuff is way out of my depth.

UPDATE:

Michael Martin (Main Dev for UQM) updated the built-in MikMod to 3.3.11.1 and that solved the corrupted audio issues when building arm64-v8a binaries.

I suspect the same would need to be done to the MikMod included in commandergenius.