pelya / commandergenius

Port of SDL library and several games to the Android OS.
http://libsdl-android.sourceforge.net/
GNU Lesser General Public License v2.1
531 stars 248 forks source link

SDL mikmod music not working #113

Open protoman opened 4 years ago

protoman commented 4 years ago

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 4 years ago

Sounds like your audio buffer is too small. During app start you can click 'Change device config' and increase audio buffer in SDL menu. You'd still better try to increase it inside your app code.

On Sat, 21 Mar 2020, 22:58 Iuri Fiedoruk, notifications@github.com wrote:

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.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/113, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABF5QB7EJ4AWPQJWFPHBP3RIUS5TANCNFSM4LRBMXTQ .

protoman commented 4 years ago

Do you know the command I can call from my code to set the audio buffer size? I found some code for buffer in SDL_andoidaudio.c, but not a direct set for the audio spec.

Iuri Fiedoruk, Software Developer

On Mon, Mar 23, 2020 at 10:55 AM Sergii Pylypenko notifications@github.com wrote:

Sounds like your audio buffer is too small. During app start you can click 'Change device config' and increase audio buffer in SDL menu. You'd still better try to increase it inside your app code.

On Sat, 21 Mar 2020, 22:58 Iuri Fiedoruk, notifications@github.com wrote:

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.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/113, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AABF5QB7EJ4AWPQJWFPHBP3RIUS5TANCNFSM4LRBMXTQ

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/113#issuecomment-602605050, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ6XRGKQ23TFXPUKQPUOYDRI5S3VANCNFSM4LRBMXTQ .

protoman commented 4 years ago

Oh sorry. I saw now that I can do that on Mix_OpenAudio. Thanks. I will test it.

Iuri Fiedoruk, Software Developer

On Mon, Mar 23, 2020 at 11:28 AM Iuri Fiedoruk protoman@upperland.net wrote:

Do you know the command I can call from my code to set the audio buffer size? I found some code for buffer in SDL_andoidaudio.c, but not a direct set for the audio spec.

Iuri Fiedoruk, Software Developer

On Mon, Mar 23, 2020 at 10:55 AM Sergii Pylypenko < notifications@github.com> wrote:

Sounds like your audio buffer is too small. During app start you can click 'Change device config' and increase audio buffer in SDL menu. You'd still better try to increase it inside your app code.

On Sat, 21 Mar 2020, 22:58 Iuri Fiedoruk, notifications@github.com wrote:

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.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/113, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AABF5QB7EJ4AWPQJWFPHBP3RIUS5TANCNFSM4LRBMXTQ

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/113#issuecomment-602605050, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ6XRGKQ23TFXPUKQPUOYDRI5S3VANCNFSM4LRBMXTQ .

protoman commented 4 years ago

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 :(

protoman commented 4 years ago

@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.

protoman commented 4 years ago

@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 :)

Serosis commented 2 years ago

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.