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: