summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2014-12-20 04:11:10 +0100
committerPierre Bourdon <delroth@gmail.com>2015-08-14 16:01:29 +0200
commit34341af17d8cd46812f07d4b82044ff07fd3225c (patch)
tree54a1791e0596d0cf657c93f1319fe909f7452829 /Source/Core
parent91fade5e8940fe0cd5ad7d0707a9d557bb33d37c (diff)
Zelda HLE: Implement saw wave generation (sample source 0001).
Fixes issue 7961.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp
index a679f55149..5f99618a7d 100644
--- a/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp
+++ b/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp
@@ -476,8 +476,12 @@ struct ZeldaAudioRenderer::VPB
enum SamplesSourceType
{
- // Simple square wave at 50% amplitude and 16KHz.
+ // Simple square wave at 50% amplitude and frequency controlled via the
+ // resampling ratio.
SRC_SQUARE_WAVE = 0,
+ // Simple saw wave at 100% amplitude and frequency controlled via the
+ // resampling ratio.
+ SRC_SAW_WAVE = 1,
// Samples stored in ARAM at a rate of 16 samples/9 bytes, AFC encoded,
// at an arbitrary sample rate (resampling is applied).
SRC_AFC_HQ_FROM_ARAM = 9,
@@ -772,6 +776,18 @@ void ZeldaAudioRenderer::LoadInputSamples(MixingBuffer* buffer, VPB* vpb)
break;
}
+ case VPB::SRC_SAW_WAVE:
+ {
+ u32 pos = vpb->current_pos_frac;
+ for (size_t i = 0; i < buffer->size(); ++i)
+ {
+ (*buffer)[i] = pos & 0xFFFF;
+ pos += (vpb->resampling_ratio) >> 1;
+ }
+ vpb->current_pos_frac = pos & 0xFFFF;
+ break;
+ }
+
case VPB::SRC_AFC_HQ_FROM_ARAM:
DownloadAFCSamplesFromARAM(raw_input_samples.data() + 4, vpb,
NeededRawSamplesCount(*vpb));