Skip to content

[PC, mGBA 0.9.2] Audio clipping in Donkey Kong Country 3 (caused by misaligned 32-bit loading against SOUNDBIAS) #2307

@gocha

Description

@gocha

Expected Behavior

dkc3-expected

Waveform of the song "Chase".

Tip: You can access the in-game music player by entering "MUSIC" in the Cheats screen.

Current Behavior

dkc3-actual

The upper part of the waveform is unnaturally compressed.

  • Version: 0.9.2

Additional Context

From the I/O Viewer, I can see that the SOUNDBIAS is set to 0x4300. Changing the Bias value from 768 to 512 will eliminate the problem. The SOUNDBIAS is modified by the following code.

LDR    R0, =(REG_SOUNDBIAS+1)
LDR    R1, [R0]  ; Misaligned 32-bit load, mGBA reads a meaningless value 0x91439143
MOVS   R2, #0xC0
BICS   R1, R2    ; Clear the resolution
MOVS   R2, #0x40
ORRS   R1, R2    ; Set the resolution to 1
STRB   R1, [R0]  ; Therefore, 0x43 is stored

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions