skylersaleh / SkyEmu

Game Boy Advance, Game Boy, Game Boy Color, and DS Emulator
http://skyemu.app
MIT License
824 stars 51 forks source link

Audio Issues with Channels 1-3 in Futari wa Precure - Ariennai! Yume no Sono wa Daimeikyuu #291

Open Kirby0Louise opened 1 year ago

Kirby0Louise commented 1 year ago

Issue:

Broken audio on channels 1-3 results in sounds played on them to be cut off far too early. Rather than the 1-2 second holds that should happen, SkyEmu plays the sounds for maybe a handful of frames at most (hard to tell exactly how long since there is no frame advance), giving "ultra staccato" audio for these channels. Verified intended behavior with other emulators (mGBA, VBA-M, no$gba, NanoBoyAdvance) as well as N3DS AGB_FIRM hardware.

Steps to Reproduce:

  1. Using emulator build "Branch 'dev' built on Oct 23, 2022, 09:42:53, Commit Hash 0560a8a4fe951a4f5a4a649d5c5d111cf3ce2e7b"
  2. Load Futari wa Precure - Ariennai! Yume no Sono wa Daimeikyuu (Japan)
  3. Wait for the title screen to load
  4. Observe broken audio on channels 1-3 (possibly also affects channel 4, but this game doesn't use Ch4 AFAIK?)
  5. Broken audio persists during the opening cutscene, level select, in level music and end of level sfx/music

My System:

Ryzen 6900HX Radeon 680M 32GB DDR5-4800 Windows 11 21H2

Let me know if my bug report is missing anything or other further testing is needed

Kirby0Louise commented 1 year ago

Issue still present in SkyEmu v3 (commit hash 0c13f0a1a5c3ec9ae464f8d03a34965a6ea48a37)

skylersaleh commented 1 year ago

I think this was just fixed by a change I pushed for v4.

Can you give it a shot?

https://github.com/skylersaleh/SkyEmu/pull/321

Kirby0Louise commented 1 year ago

Thanks. This fixes the opening cutscene, level select, in level music and (mostly) end of level sfx.

There is still a small issue with the sound when you finish a level. It's supposed to fade out the background music before playing the end of level sfx, but SkyEmu stutters the background music instead. mGBA, VBA-M, no$gba and N3DS AGB_FIRM all handle the fade correctly. NanoBoyAdvance is inconsistent, sometimes it behaves the same as SkyEmu, sometimes it's correct.

I'll do some more testing in a few days when time is available, but for now I've provided a save state to easily reproduce the bug, just hold right after loading to finish the level

precure bug.zip

Kirby0Louise commented 1 year ago

Tried on a faster PC, same audio stuttering. I think we can rule out lack of performance.

I've also discovered that any time the game attempts to fade out the PSG channels, SkyEmu will produce stutters. Another easy way to reproduce this is when pressing start at the title screen after the title shout (you must have a brand new save by deleting the .sav file). Once again, SkyEmu always produces stuttering, mGBA/no$gba/VBA-M/N3DS AGB_FIRM handle it correctly, and NanoBoyAdvance is inconsistent.

I will attempt to explore in a debugger what exactly the game is doing with regards to the audio system

Kirby0Louise commented 1 year ago

Is there a way to freeze audio registers to a specific value via this debugging overlay? I want to test some things out image