Audio Emulation

From Dolphin Emulator Wiki
Revision as of 21:00, 15 March 2012 by Faefdsedf (talk | contribs) (Dumping guide needs to be completed. Anyone?)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Explanation

The DSP is an additional processor, running in parallell with the PowerPC. It's located in the GPU of the GC/Wii, and cannot access main RAM directly, however it can use DMA copies to read/write all RAM. It has an "accelerator" module that lets it decode ADPCM audio directly from ARAM. On the Wii, it can apparently read audio from all of RAM, perhaps also on the Gamecube but I have not tested this.

The smallest unit of internal memory addressable by the DSP is a 16-bit word. It has no concept of standard 8-bit bytes - everything is done in 16-bit units. Sometimes they are signed, sometimes not - it depends on the usage.

In summary, the DSP lives in a pretty small memory space. It's kind of like an SPE in the PS3, in that it can only read and write to the outside worlds by issuing DMA requests, but much less powerful of course. The SPEs don't have separate instruction and data memories either.

The DSP core has 32 16-bit registers, however they are not at all general purpose like on the PowerPC. Instead, they have very rigid roles. There are several "multi-registers" built out of these smaller 16-bit registers, for example the two 40-bit accumulators, and two 32-bit ones. All multiply instructions output their result to the 40-bit "prod" register. The top register of a 40-bit multiregister is really 8-bit but is read as sign extended to 16-bit by most instructions that can read any register.

The advantage of the specific roles is that the instruction encoding can be extremely compact. Most instructions that deal with accumulators only have a single bit for deciding which accumulator to affect, for example.

Main differences between DSP emulated versions

  • LLE (Low Level Emulation): Emulate the hardware behaviour as closely as possible. In case of the DSP, that means running every single instruction just like on the hardware. This contrasts with HLE:
  • HLE (High Level Emulation): If the large scale behaviour of code running on a device like the DSP is known, we can simply write equivalent C++ code and run that instead of actually trying to run instructions on an emulated DSP. This is how audio has been done in Dolphin thus far, but the limitation is that it can only simulate the "AX" ucode. Advantage is speed, the main drawback is that accuracy is generally not very good and it's easy to miss feature when reimplementing something you don't really know how it works.

How to dump a Wii DSP files

http://forums.dolphin-emulator.com/showthread.php?tid=3823

A little confusing, but some text can help:

  • Download the attached file on that thread
  • Use a Wii DOL Launcher (SD Cards apps)
  • Execute the Dolphin DSPSpy file

You should get both "dsp_rom.bin" (8Kb) and "dsp_coef.bin"(4Kb) (Size may change).

Store them at the folder "./Sys/GC"