summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorXTra.KrazzY <XTra.KrazzY@gmail.com>2009-07-01 15:54:52 +0000
committerXTra.KrazzY <XTra.KrazzY@gmail.com>2009-07-01 15:54:52 +0000
commit71556f77f630bc331a9fdd3ee945833a56cf48ed (patch)
treebe0e500408b3cbdc8f0b59c2b7a1eaf508fe9775 /Source
parentadf9d8d9390d850ad2ab51ae0a64d58572875538 (diff)
Highly experimental synth for zelda ucode.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3629 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source')
-rw-r--r--Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda.h4
-rw-r--r--Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda_Synth.cpp46
-rw-r--r--Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda_Voice.cpp23
3 files changed, 67 insertions, 6 deletions
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda.h b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda.h
index 75bd653389..0d6a4c6e3b 100644
--- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda.h
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda.h
@@ -174,6 +174,10 @@ private:
void MixAddVoice_PCM16(ZeldaVoicePB& PB, s32* _Buffer, int _Size);
void MixAddVoice_AFC(ZeldaVoicePB& PB, s32* _Buffer, int _Size);
void MixAddVoice(ZeldaVoicePB& PB, s32* _LeftBuffer, s32* _RightBuffer, int _Size);
+
+
+ void MixAddSynth_Constant(ZeldaVoicePB &PB, s32* _Buffer, int _Size);
+ void MixAddSynth_Waveform(ZeldaVoicePB &PB, s32* _Buffer, int _Size);
};
#endif
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda_Synth.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda_Synth.cpp
new file mode 100644
index 0000000000..2989b4ae2c
--- /dev/null
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda_Synth.cpp
@@ -0,0 +1,46 @@
+// Copyright (C) 2003-2009 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+
+#include "../Globals.h"
+#include "UCodes.h"
+#include "UCode_Zelda.h"
+#include "UCode_Zelda_ADPCM.h"
+
+#include "../main.h"
+#include "Mixer.h"
+
+void CUCode_Zelda::MixAddSynth_Waveform(ZeldaVoicePB &PB, s32* _Buffer, int _Size)
+{
+ int mask = PB.Format ? 3 : 1;
+
+ for (int i = 0; i < _Size; i++)
+ {
+ s16 sample = (i & mask) ? 0xc000 : 0x4000;
+
+ _Buffer[i++] = (s32)sample;
+ }
+}
+
+
+void CUCode_Zelda::MixAddSynth_Constant(ZeldaVoicePB &PB, s32* _Buffer, int _Size)
+{
+ for (int i = 0; i < _Size; i++)
+ _Buffer[i++] = (s32)PB.RatioInt;
+}
+
+
+
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda_Voice.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda_Voice.cpp
index 4bf09b4313..dd874708ee 100644
--- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda_Voice.cpp
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda_Voice.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2008 Dolphin Project.
+// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -281,6 +281,22 @@ void CUCode_Zelda::MixAddVoice(ZeldaVoicePB &PB, s32* _LeftBuffer, s32* _RightBu
{
switch (PB.Format)
{
+
+ // Synthesized sounds
+ case 0x0000:
+ case 0x0001: // Used for "Denied" sound in Zelda
+ //MixAddSynth_Waveform(PB, m_TempBuffer, _Size);
+ break;
+
+ case 0x0006:
+ //MixAddSynth_Waveform(PB, m_TempBuffer, _Size);
+ break;
+
+ // These are more "synth" formats - square wave, saw wave etc.
+ case 0x0002:
+ return;
+
+
// AFC formats
case 0x0005: // AFC with extra low bitrate (32:5 compression). Not yet seen.
WARN_LOG(DSPHLE, "5 byte AFC - does it work?");
@@ -292,11 +308,6 @@ void CUCode_Zelda::MixAddVoice(ZeldaVoicePB &PB, s32* _LeftBuffer, s32* _RightBu
MixAddVoice_PCM16(PB, m_TempBuffer, _Size);
break;
- // These are "synth" formats - square wave, saw wave etc.
- case 0x0000:
- case 0x0001: // Used for "Denied" sound in Zelda
- case 0x0002:
- return;
case 0x0008: // Likely PCM8 - normal PCM 8-bit audio. Used in Mario Kart DD.
case 0x0020: