philj56 / gbcc

Cross-platform Game Boy emulator written in C
https://gbcc.github.io
Other
47 stars 8 forks source link

Bug: Fails CGB_Sound, DMG_Sound, and OAM_Bug accuracy tests #38

Open ruvaldak opened 1 year ago

ruvaldak commented 1 year ago

GBCC fails the two sound tests as well as oam_bug test from Blargg's accuracy test ROMs. Oam_bug test just explodes, and sound accuracy is very poor for dmg, and somewhat poor for cgb. I've noticed GBCC definitely has some issues with sound already, so I assume that is known.

philj56 commented 1 year ago

Yeah, sound's very annoying to get right, and hasn't seen too much love at the moment.

The two sound tests that fail are both to do with the wave channel, and shouldn't really affect much (but obviously it's still a bug). OAM_bug fails all the tests that try to trigger it, because as far as I can remember I haven't attempted to emulate it.

At some point fairly soon, I'll switch from working on the android front end to fixing core emulation for a bit, as there's lots of stuff that needs improving there before I work on more advanced things. I think the most important one is properly separating the behaviour of different gameboy models, as it's currently kind of a weird DMG/GBC hybrid. The whole sound system could use an overhaul as well, but that's a pretty big job.

It should sound fine for most games though, I haven't noticed any particular issues. There are a few things that can affect it:

I've noticed GBCC definitely has some issues with sound already

Do you mean specific game problems or just generally low-quality audio, and do you have some concrete examples? Those would be helpful.

BTW I've moved this to the main repo as it's not just relevant to the Android front-end.

ruvaldak commented 1 year ago

Just generally lower quality - I've been playing Polished Crystal (a modification of pokemon crystal) lately and compared to emulators like Gambatte or Pizza GBC, it's sound seems to struggle occasionally, especially at sudden changes in sounds (that's the best I can explain it, it's hard to really put into words).

My phone is a Pixel 7, so it's plenty plenty fast, and yes, I do have low latency audio on. I'll try disabling vsync. I also play with Mono audio enabled ingame, could that cause issues?

philj56 commented 1 year ago

Ah ok. I don't think mono audio should make a difference.

Regarding generally lower quality, yeah that's not surprising. The way audio sampling is done currently is pretty naive, it's just enough to sound "fine", if you're only listening via phone speakers or such :stuck_out_tongue:

There are two things I can look into at some point which might help: