Highly experimental synth for zelda ucode.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3629 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
XTra.KrazzY 2009-07-01 15:54:52 +00:00
parent adf9d8d939
commit 71556f77f6
3 changed files with 67 additions and 6 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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: