Open JayFoxRox opened 5 years ago
Removing comment:
/* FIXME: The following should not be necessary. It's a hack.
*
* Normally, the GP mixes the MIXBINs, then DMAs the mixed result to
* the EP, which then encodes AC3 and DMAs to the ACI.
* So the final mixing of MIXBINs is typically done on GP.
*
* As we don't have the working DSP / DMA / ACI, we need our own
* mixing and output for now.
* In the future, this code can be removed. */
This PR adds routing options for the GP audio output.
In Xbox, audio flows from VP (playback) → GP (effects) → EP (encoding) → ACI (actual output).
However, only the VP → GP transfer is hardwired. The other transfers are performed manually though programmable code. Hence, we can't easily sniff the audio data.
But: We can still make assumptions what Xbox DirectSound will do (HLE style). While the GP code is game specific, it always has a similar structure and it always seems to use the same memory layout. The GP will DMA to scratch memory that is shared with the EP. So once the GP has ran, we just read the memory where we believe the GP must have written it.
This code will read this memory back and decode the samples. We also make assumptions about the format: 5.1, 24 bit.
This assumption should hold true for all Xbox DirectSound versions. - However, it doesn't hold true for the DirectSound variant used during the boot animation, because it runs a different GP-mainloop (as EP is disabled, GP must output to ACI directly; so this HLE hack doesn't see audio between GP / EP where expected).
The basic flow of the audio is (bold list items implemented in this PR), ordered chronologically:
Hardwired processing of VP
process_voice
framework implemented here, which provides the MIXBINs, but nothing else]Programmable processing of audio by GP (Game specific DSP Code for Xbox)
Programmable processing of audio by EP (Common DSP Code for Xbox)
(As the EP code is crashing in XQEMU, it's disabled; however, because the task common to all games, we can temporarily HLE it by doing its job on our own)
ACI / AC97
(As the EP is broken / disabled, no audio ever reaches this component. It doesn't matter because we have our temporary HLE output from GP)
TODO:
Split GP debug via HLE into separate PRIt's a commit already