Add SGB Audio support from Bizhawk #264
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an early draft, so just ignore the build script changes and some of the other junkus. I'm mostly interested in feedback on whether this is something that upstream might be interested in having.
The key details are:
snes_spcis used to emulate the audio hardwaresgb-cart-present.spcis used to provide the initial SPC stateSOU_TRN = 0x09is emulated by parsing the resulting packets andmemcpy()ing them into SPC RAM; the transfer process that would normally involve SNES code is not emulated.SOUND = 0x08is emulated by storing the expected port values and then updating them against the SPC port values at 60hzIt's not much, but it works and games sound fine (once audio output to the frontend is implemented; see below.)
Major missing pieces:
GB_sgb_renderblasting chunks of samples directly to the front end whileGB_apu_runblasts its own chunks of samples directly to the frontend as well, while the frontend then randomly drops chunks of samples because there are too many of them to match the video framerate. Bizhawk reconciles the timing of the streams together and usesblip_bufto resample everything, but I'm not sure how you want to proceed with that.