Open JayFoxRox opened 7 years ago
DSP: asr56 was actually lsr56. The flags / status stuff should be reviewed
Also check where S and L are set for shift operations (can't find it in the code, but spec asks for this)
FIFO is implemented very poorly. It must use OFBASE0 / OFBASE1 / ... etc.
Unsolved.. needs work
//edit: Works fine in smashing drive.. [30000 - 40000 cycles for GP] around 5149f0d // probably GP not having enough cycles?
@RadWolfie It is more or less complete. I'm still writing a tool to dump the internal ADPCM tables of the soundcard and I'll try to get the decoder bit accurate. But this is the current output of this branch:
(Which pretty much uses the same decoder)
p:000b 0a8581 00000a (02 cyc) jclr #1,x:$ffffc5,p:$000a
Rebase onto #26 .
Related to #25 (but not compatible!)
FIXME: Move this to seperate PR
This code needs a lot of optimizations to produce realtime / enjoyable audio.
AC97 runs at a fixed samplerate of 48000 Hz and it's what the user hears. It must have the data at that rate. The data is only pushed at that rate if the APU (VP, GP and EP) runs at the proper speed.
The GP and EP each process 32 samples at a time. This means per GP / EP frame we have a budget of 32 / 48000 Hz = 666us.
So far, it looks like 60000 DSP instructions is barely enough to run a GP without effects. With the current DSP emulation the GP emulation alone takes about 5000us on my machine. Note that the EP or a fully loaded GP (many programmable sound effects at once) will be considerably more taxing - also this logic excludes any previous work by the VP.
I'm not sure why the DSP takes so long, it shouldn't do much more than setting up a couple of DMA transfers. If the DSP is really doing the amount of work it should we'll probably need a DSP JIT.
Eitherway, the GP and EP should be put on threads.
The VP also has to do some crazy amount of work. The ADPCM decoding should be optimized (it currently re-decodes the block beginning for each sample). Voices could also be generated on seperate threads or GPU.
Additionally our current threading runs at 10ms, so we miss the audio frames by a landslide. We can probably batch a couple of frames though.
FIXME: