2012-03-23 10:43:39 +00:00
|
|
|
struct APU : Thread, MMIO {
|
2015-11-21 07:36:48 +00:00
|
|
|
static auto Main() -> void;
|
|
|
|
auto main() -> void;
|
|
|
|
auto hipass(int16& sample, int64& bias) -> void;
|
|
|
|
auto power() -> void;
|
|
|
|
|
|
|
|
auto mmio_read(uint16 addr) -> uint8;
|
|
|
|
auto mmio_write(uint16 addr, uint8 data) -> void;
|
|
|
|
|
|
|
|
auto serialize(serializer&) -> void;
|
|
|
|
|
Update to v075r05 release.
byuu says:
Added Game Boy sound emulation, all four channels.
It's really, really, really bad. Plenty of bugs, I don't even know what
the fuck a high-pass filter is so that isn't there. Hermite resampling
from 4MHz down to 44KHz. But it's tolerable.
I don't understand what sweep is for at all, and I'm sure I have that
insane recursive reload behavior wrong.
This is pretty much my own design. I referenced blargg's gb snd emu,
blargg's older gb apu ref, Cydrak's APU core, that lousy gbdev wiki
article, the completely and utterly worthless pandocs, and received
nothing but bad and wrong information that just wasted my time from
But I managed to pull it off. It's also painfully slow, like 250fps on
my machine slow. Countless optimizations are possible.
2011-02-02 10:38:28 +00:00
|
|
|
#include "square1/square1.hpp"
|
|
|
|
#include "square2/square2.hpp"
|
2011-02-02 10:37:31 +00:00
|
|
|
#include "wave/wave.hpp"
|
|
|
|
#include "noise/noise.hpp"
|
|
|
|
#include "master/master.hpp"
|
2011-01-22 08:15:49 +00:00
|
|
|
|
2013-12-10 12:12:54 +00:00
|
|
|
uint12 sequencer_base;
|
Update to v075r06 release.
byuu says:
Removed the floating-point volume adjustments from the wave channel and
the left/right speaker mixers. Also, against my better judgment I'm
backing out of left/right computation when they are both turned off.
This basically makes non-stereo games run faster, but will make stereo
games appear to run slower. I don't like it when end-users experience
mystery slowdowns.
Anyway, it appears that the audio calculation is really fucking
demanding. Knocks FPS from 800 down to 300. I thought it might be libco,
so I took it out and it only went up to 305fps o.O
There is also some sort of problem with bsnes/Super Game Boy audio. The
latency is really great when you first start, but it seems to drift
apart over time until it is well over 500ms, and then it either pops or
fades back to very low, sub-50ms latency again. The way I handle mixing
is that the coprocessor audio samples go into a resampler to the native
SNES rate, and fed to an output buffer. SNES audio samples go there
untouched. When there is a sample in each, I add them together and
average the result (I still don't understand why we divide by two since
these are signed integers), and output it immediately. It's just-in-time
sampling, so as long as DSP v Coprocessor do not drift very far, it
should have very low latency. And I make the CPU sync DSP and
Coprocessor once per scanline, which is something like 15 samples or so.
2011-02-03 11:17:35 +00:00
|
|
|
uint3 sequencer_step;
|
Update to v075r05 release.
byuu says:
Added Game Boy sound emulation, all four channels.
It's really, really, really bad. Plenty of bugs, I don't even know what
the fuck a high-pass filter is so that isn't there. Hermite resampling
from 4MHz down to 44KHz. But it's tolerable.
I don't understand what sweep is for at all, and I'm sure I have that
insane recursive reload behavior wrong.
This is pretty much my own design. I referenced blargg's gb snd emu,
blargg's older gb apu ref, Cydrak's APU core, that lousy gbdev wiki
article, the completely and utterly worthless pandocs, and received
nothing but bad and wrong information that just wasted my time from
But I managed to pull it off. It's also painfully slow, like 250fps on
my machine slow. Countless optimizations are possible.
2011-02-02 10:38:28 +00:00
|
|
|
|
|
|
|
Square1 square1;
|
|
|
|
Square2 square2;
|
2011-02-02 10:37:31 +00:00
|
|
|
Wave wave;
|
|
|
|
Noise noise;
|
|
|
|
Master master;
|
2011-01-22 08:15:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern APU apu;
|