Replace the entire Gdx audio engine with 'gdx-miniaudio'#14119
Replace the entire Gdx audio engine with 'gdx-miniaudio'#14119SomeTroglodyte wants to merge 26 commits intoyairm210:masterfrom
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
…le when fully decoded in memory
|
Thanks for putting in the effort here. I was able to hear city ambience, listen to music, and get leader voices without issue. I would be curious to see if we could get this to work without adopting MiniAudio though. Haven't done the debugging around it yet myself, but I have a suspicion it's inconsistent audio frequencies. |
|
Hi! Thanks for considering gdx-miniaudio as a replacement for Few notes I have on this PR:
|
Ah, proves how blocked my brain is when it comes to legalese.
Yeah, some of the code this PR removes is a kludge for Android-specific fails under Gdx.audio. But as said, I haven't tested on roid at all - yet. I'm slightly hesitant in part because avd's have become so incredibly slow as compared to ~2 years ago. Means I let it simmer to build courage before plugging the cable into my actual private phone. Actually, that's laziness - I should have one or two or three S5's lying around, and there should be some not too old LOS for those.
Don't worry, I've got a list - mainly |
Matches my experience. This PR is early stage, known areas needing attention (optimizing engine sample rate being one of them), and still the very first Ctrl-F9 was stable and played everything... I really was quite baffled. But "without adopting MiniAudio" - you must be joking. That's the whole point! Under Gdx there's layers and people, and under this too. Gdx - a team that is active but seemingly hasn't looked at audio for quite a while and down below that - no activity for years. Here it's almost just one brain per layer, but those are active and obviously - to me - both (throth?) clever and thorough and cooperative. |
|
@RobLoach > audio frequencies You can now edit your GameSettings.json, add A perfect "no-resampling through the entire pipeline" won't be possible though, one - I don't even believe our standard sounds all have the same rate, though I remember once making an effort, two - mods, three - the native sample rate of the output devices varies widely. Not even two samsungs were the same last time I looked, long ago. |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
# Conflicts: # core/src/com/unciv/utils/Log.kt
|
Conflicts have been resolved. |
|
Edited original post: + flac + jar size, some outdated marked/removed |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
# Conflicts: # core/src/com/unciv/UncivGame.kt # core/src/com/unciv/logic/files/UncivFiles.kt # core/src/com/unciv/ui/popups/options/SoundTab.kt # core/src/com/unciv/ui/screens/worldscreen/mainmenu/WorldScreenMusicPopup.kt # desktop/src/com/unciv/app/desktop/DesktopLauncher.kt # desktop/src/com/unciv/app/desktop/DesktopLogBackend.kt
|
Conflicts have been resolved. |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
|
Another argument in favour: |
# Conflicts: # core/src/com/unciv/ui/audio/SoundPlayer.kt
|
Conflicts have been resolved. |
See https://libgdx.com/wiki/audio/audio for another endorsement |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
# Conflicts: # core/src/com/unciv/UncivGame.kt
|
Conflicts have been resolved. |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
# Conflicts: # core/src/com/unciv/logic/files/UncivFiles.kt
|
Conflicts have been resolved. |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
# Conflicts: # core/src/com/unciv/logic/files/IMediaFinder.kt # core/src/com/unciv/models/metadata/GameSettings.kt # core/src/com/unciv/ui/screens/worldscreen/mainmenu/WorldScreenMusicPopup.kt
|
Conflicts have been resolved. |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
This is an experiment, but so far it works.
Inspiration was #13932 (comment) where I found that Red & Black project wrapping MiniAudio - I plonked it in removing a lot of workaround crud - and lo and behold it seems to work very very well. The lib is still young and if we decide to go for it, they're open to calls for help/improvements.
Plus:
Minus:
ogg files andfiles loaded from jar don't report their length, mp3's from mods do just fine edit: and ogg too unless loaded in streaming mode - which I've turned off for them. Edit: actually irrelevant, as the music player doesn't offer jar assets.So - questions:
Is the more permissive license (Apache 2.0) of that library a blocker? I abhor legalese and my brain just shuts down with that crud, but would we need to add documentation to make that inclusion aggressor-proof?References: