Make AFCdecodebuffer static.

Also remove some #include UCode_Zelda_ADPCM.h I forgot.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3691 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
luigi2us 2009-07-06 12:20:01 +00:00
parent ca51636f5c
commit 85a3661afc
4 changed files with 31 additions and 22 deletions

View File

@ -21,7 +21,6 @@
#include "../Globals.h" #include "../Globals.h"
#include "UCodes.h" #include "UCodes.h"
#include "UCode_Zelda.h" #include "UCode_Zelda.h"
#include "UCode_Zelda_ADPCM.h"
#include "../MailHandler.h" #include "../MailHandler.h"
#include "../main.h" #include "../main.h"
@ -92,8 +91,19 @@ CUCode_Zelda::~CUCode_Zelda()
void CUCode_Zelda::Update(int cycles) void CUCode_Zelda::Update(int cycles)
{ {
if (!m_rMailHandler.IsEmpty()) // if (!m_rMailHandler.IsEmpty())
// g_dspInitialize.pGenerateDSPInterrupt();
if (m_bSyncCmdPending && (m_CurBuffer == m_NumBuffers) && (m_rMailHandler.IsEmpty()))
{
m_rMailHandler.PushMail(DSP_FRAME_END);
g_dspInitialize.pGenerateDSPInterrupt(); g_dspInitialize.pGenerateDSPInterrupt();
soundStream->GetMixer()->SetHLEReady(true);
DEBUG_LOG(DSPHLE, "Update the SoundThread to be in sync");
soundStream->Update(); //do it in this thread to avoid sync problems
m_bSyncCmdPending = false;
}
} }
void CUCode_Zelda::HandleMail(u32 _uMail) void CUCode_Zelda::HandleMail(u32 _uMail)
@ -143,14 +153,14 @@ void CUCode_Zelda::HandleMail(u32 _uMail)
if (m_CurBuffer == m_NumBuffers) if (m_CurBuffer == m_NumBuffers)
{ {
m_rMailHandler.PushMail(DSP_FRAME_END); //m_rMailHandler.PushMail(DSP_FRAME_END);
//g_dspInitialize.pGenerateDSPInterrupt(); //g_dspInitialize.pGenerateDSPInterrupt();
soundStream->GetMixer()->SetHLEReady(true); // soundStream->GetMixer()->SetHLEReady(true);
DEBUG_LOG(DSPHLE, "Update the SoundThread to be in sync"); // DEBUG_LOG(DSPHLE, "Update the SoundThread to be in sync");
soundStream->Update(); //do it in this thread to avoid sync problems // soundStream->Update(); //do it in this thread to avoid sync problems
m_bSyncCmdPending = false; //m_bSyncCmdPending = false;
} }
} }
} }

View File

@ -214,7 +214,7 @@ private:
void ExecuteList(); void ExecuteList();
// AFC decoder // AFC decoder
void AFCdecodebuffer(const s16 *coef, const char *input, signed short *out, short *histp, short *hist2p, int type); static void AFCdecodebuffer(const s16 *coef, const char *input, signed short *out, short *histp, short *hist2p, int type);
void ReadVoicePB(u32 _Addr, ZeldaVoicePB& PB); void ReadVoicePB(u32 _Addr, ZeldaVoicePB& PB);
void WritebackVoicePB(u32 _Addr, ZeldaVoicePB& PB); void WritebackVoicePB(u32 _Addr, ZeldaVoicePB& PB);

View File

@ -18,7 +18,6 @@
#include "../Globals.h" #include "../Globals.h"
#include "UCodes.h" #include "UCodes.h"
#include "UCode_Zelda.h" #include "UCode_Zelda.h"
#include "UCode_Zelda_ADPCM.h"
#include "../main.h" #include "../main.h"
#include "Mixer.h" #include "Mixer.h"

View File

@ -18,7 +18,6 @@
#include "../Globals.h" #include "../Globals.h"
#include "UCodes.h" #include "UCodes.h"
#include "UCode_Zelda.h" #include "UCode_Zelda.h"
#include "UCode_Zelda_ADPCM.h"
#include "../main.h" #include "../main.h"
#include "Mixer.h" #include "Mixer.h"
@ -60,8 +59,8 @@ void CUCode_Zelda::RenderVoice_PCM16(ZeldaVoicePB &PB, s32* _Buffer, int _Size)
u32 _ratio = (((PB.RatioInt * 80) + PB.CurSampleFrac) << 4) & 0xFFFF0000; u32 _ratio = (((PB.RatioInt * 80) + PB.CurSampleFrac) << 4) & 0xFFFF0000;
u64 ratio = (u64)(((_ratio / 80) << 16) * ratioFactor); u64 ratio = (u64)(((_ratio / 80) << 16) * ratioFactor);
u32 pos[2] = {0, 0}; u32 inpos[2] = {0, 0};
int i = 0; int outpos = 0;
if (PB.KeyOff != 0) if (PB.KeyOff != 0)
return; return;
@ -90,7 +89,7 @@ _lRestart:
PB.RestartPos = PB.LoopStartPos; PB.RestartPos = PB.LoopStartPos;
PB.RemLength = PB.Length - PB.RestartPos; PB.RemLength = PB.Length - PB.RestartPos;
PB.CurAddr = PB.StartAddr + (PB.RestartPos << 1); PB.CurAddr = PB.StartAddr + (PB.RestartPos << 1);
pos[1] = 0; pos[0] = 0; inpos[1] = 0; inpos[0] = 0;
} }
} }
@ -100,29 +99,29 @@ _lRestart:
else else
source = (s16*)(g_dspInitialize.pGetARAMPointer() + PB.CurAddr); source = (s16*)(g_dspInitialize.pGetARAMPointer() + PB.CurAddr);
for (; i < _Size;) for (; outpos < _Size;)
{ {
s16 sample = Common::swap16(source[pos[1]]); s16 sample = Common::swap16(source[inpos[1]]);
_Buffer[i++] = (s32)sample; _Buffer[outpos++] = (s32)sample;
(*(u64*)&pos) += ratio; (*(u64*)&inpos) += ratio;
if ((pos[1] + ((PB.CurAddr - PB.StartAddr) >> 1)) >= PB.Length) if ((inpos[1] + ((PB.CurAddr - PB.StartAddr) >> 1)) >= PB.Length)
{ {
PB.ReachedEnd = 1; PB.ReachedEnd = 1;
goto _lRestart; goto _lRestart;
} }
} }
if (PB.RemLength < pos[1]) if (PB.RemLength < inpos[1])
{ {
PB.RemLength = 0; PB.RemLength = 0;
PB.ReachedEnd = 1; PB.ReachedEnd = 1;
} }
else else
PB.RemLength -= pos[1]; PB.RemLength -= inpos[1];
PB.CurAddr += pos[1] << 1; PB.CurAddr += inpos[1] << 1;
// There should be a position fraction as well. // There should be a position fraction as well.
} }
@ -272,7 +271,7 @@ restart:
// end of block (Zelda 03b2) // end of block (Zelda 03b2)
} }
//u32 last_remlength = 0;
// Researching what's actually inside the mysterious 0x21 case // Researching what's actually inside the mysterious 0x21 case
void CUCode_Zelda::RenderVoice_Raw(ZeldaVoicePB &PB, s32* _Buffer, int _Size) void CUCode_Zelda::RenderVoice_Raw(ZeldaVoicePB &PB, s32* _Buffer, int _Size)
{ {
@ -414,6 +413,7 @@ void CUCode_Zelda::RenderAddVoice(ZeldaVoicePB &PB, s32* _LeftBuffer, s32* _Righ
case 0x0010: // PCM16 - normal PCM 16-bit audio. case 0x0010: // PCM16 - normal PCM 16-bit audio.
RenderVoice_PCM16(PB, m_TempBuffer, _Size); RenderVoice_PCM16(PB, m_TempBuffer, _Size);
//last_remlength = PB.RemLength;
break; break;