-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ws: APU emulation improvements (#1425)
* Significantly improved Hyper Voice implementation accuracy (verified, at least for Sound DMA writes, with a test ROM) * Implemented emulation of unused/undocumented debug ports (0x64-0x67, 0x69, 0x95-0x9B) * Improved cycle accuracy of APU channel handling * Added slightly faster "inaccurate" APU emulation mode (for most games, output should be essentially identical; debug ports will not match up, though)
- Loading branch information
1 parent
f0fd88f
commit 0c8eaf0
Showing
10 changed files
with
244 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
auto APU::Channel1::run() -> void { | ||
auto APU::Channel1::tick() -> void { | ||
if(--state.period == io.pitch) { | ||
state.period = 0; | ||
state.sampleOffset++; | ||
} | ||
} | ||
|
||
auto APU::Channel1::runOutput() -> void { | ||
auto APU::Channel1::output() -> void { | ||
if(apu.sequencerHeld()) return; | ||
auto sample = apu.sample(1, state.sampleOffset); | ||
output.left = sample * io.volumeLeft; | ||
output.right = sample * io.volumeRight; | ||
apu.io.output.left += sample * io.volumeLeft; | ||
apu.io.output.right += sample * io.volumeRight; | ||
} | ||
|
||
auto APU::Channel1::power() -> void { | ||
io = {}; | ||
state = {}; | ||
output = {}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
auto APU::Channel2::run() -> void { | ||
if (!io.voice) { | ||
auto APU::Channel2::tick() -> void { | ||
if(!io.voice) { | ||
if(--state.period == io.pitch) { | ||
state.period = 0; | ||
state.sampleOffset++; | ||
} | ||
} | ||
} | ||
|
||
auto APU::Channel2::runOutput() -> void { | ||
auto APU::Channel2::output() -> void { | ||
if(apu.sequencerHeld()) return; | ||
if(io.voice) { | ||
n8 volume = io.volumeLeft << 4 | io.volumeRight << 0; | ||
output.left = io.voiceEnableLeftFull ? volume : (n8)(io.voiceEnableLeftHalf ? (volume >> 1) : 0); | ||
output.right = io.voiceEnableRightFull ? volume : (n8)(io.voiceEnableRightHalf ? (volume >> 1) : 0); | ||
apu.io.output.left += io.voiceEnableLeftFull ? volume : (n8)(io.voiceEnableLeftHalf ? (volume >> 1) : 0); | ||
apu.io.output.right += io.voiceEnableRightFull ? volume : (n8)(io.voiceEnableRightHalf ? (volume >> 1) : 0); | ||
} else { | ||
auto sample = apu.sample(2, state.sampleOffset); | ||
output.left = sample * io.volumeLeft; | ||
output.right = sample * io.volumeRight; | ||
apu.io.output.left += sample * io.volumeLeft; | ||
apu.io.output.right += sample * io.volumeRight; | ||
} | ||
} | ||
|
||
auto APU::Channel2::power() -> void { | ||
io = {}; | ||
state = {}; | ||
output = {}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.