-
Notifications
You must be signed in to change notification settings - Fork 251
swan: New sound core #2401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
swan: New sound core #2401
Conversation
Now outputs 24000 Hz digital samples, matching real hardware (as opposed to 3072000 Hz samples). It has also been rewritten from scratch to match recent research and make the code significantly more readable.
Don't worry, seems like VGM export is totally broken anyway. |
Ah! In that case, I'll wait for further feedback. |
Works great now! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good, but I'll suggest keeping the old core just in case... (I can do this for you so don't worry)
If you're willing to make both cores available, that's perfectly fine by me. However, I don't think the old core exposes internal speaker output, so that functionality won't work on it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merging!
Merged #2401 into master. Sadly, GitHub has failed to detect merge... |
I've come across a recent push to optimize Furnace's sound drivers with
acquireDirect()
. I've also spent months researching the WonderSwan console and noticed that Furnace's sound core uses the old implementation from Mednafen, which does not incorporate recent discoveries. In particular, it was found that the WonderSwan has a fully digital output pipeline of 16-bit 24000 Hz stereo samples (the headphone adapter has its own DAC onboard!), and not an analog (here: 3072000 Hz) output like other sound chips typical of its era.As such, I've rewritten the WonderSwan sound driver to, in a hopefully clean and readable manner, implement the sound system as is currently understood. It also provides a very preliminary hook for Hyper Voice support (which can pretty much be used as a direct headphone-only 16-bit 24000 Hz stereo DAC channel; one can use sound DMA to drive it, but Furnace doesn't really appear to concern itself with emulating DMA limitations at this time).
I've reverted the
acquireDirect
change and some of the optimizations as I question their usefulness (relative to code clarity) when processing a few hundred samples per call as opposed to a few dozen thousand; I'm ready to change it back or optimize it further in case benchmarks show that was a bad call.I've also taken the opportunity to add support for the WonderSwan's internal speaker output. It's 8-bit mono as opposed to 16-bit stereo, and requires manually controlling the loudness for optimum performance. By default, I've set it to minimum loudness (let's call it 100%), which should be ideal for most tracks, but may lead to quiet audio on real hardware if only one channel is playing at a time. Some artists may wish to use the newly added
Headphone output
toggle in the chip manager, and adjust with the newly proposed20xx
effect if so.TODO:
It appears one of the changes breaks VGM export, and I'm really not sure which one yet...Apparently not any of mine - it was an upstream issue.Feedback, benchmark and testing welcome!