Small changes to DSP HLE. Still no sound in Wii AX. Blocks are turned on but something is wrong, it seems like cur_addr was not moving (in Top Spin 3), if I understand the log correctly.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1111 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson
2008-11-10 20:32:36 +00:00
parent 145d868585
commit fe19642762
13 changed files with 433 additions and 309 deletions

View File

@ -408,7 +408,7 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
// write logging data to debugger
if (m_frame)
{
CUCode_AX::Logging(_pBuffer, _iSize, 0);
CUCode_AX::Logging(_pBuffer, _iSize, 0, false);
}
// ---------------------------------------------------------------------------------------
@ -464,7 +464,7 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
// write logging data to debugger again after the update
if (m_frame)
{
CUCode_AX::Logging(_pBuffer, _iSize, 1);
CUCode_AX::Logging(_pBuffer, _iSize, 1, false);
}
}

View File

@ -23,7 +23,7 @@
enum
{
NUMBER_OF_PBS = 64
NUMBER_OF_PBS = 128
};
class CUCode_AX : public IUCode
@ -37,7 +37,9 @@ public:
void Update();
// Logging
void Logging(short* _pBuffer, int _iSize, int a);
//template<class ParamBlockType>
//void Logging(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs, int numberOfPBs);
void Logging(short* _pBuffer, int _iSize, int a, bool Wii);
void SaveLog_(bool Wii, const char* _fmt, ...);
void SaveMail(bool Wii, u32 _uMail);
void SaveLogFile(std::string f, int resizeTo, bool type, bool Wii);

View File

@ -135,7 +135,7 @@ struct AXParamBlock
u16 this_pb_lo;
u16 src_type; // Type of sample rate converter (none, ?, linear)
u16 unknown1;
u16 coef_select;
u16 mixer_control;
u16 running; // 1=RUN 0=STOP

View File

@ -50,7 +50,7 @@ CUCode_AXWii::CUCode_AXWii(CMailHandler& _rMailHandler)
templbuffer = new int[1024 * 1024];
temprbuffer = new int[1024 * 1024];
lCUCode_AX = new CUCode_AX(_rMailHandler);
lCUCode_AX = new CUCode_AX(_rMailHandler);
}
CUCode_AXWii::~CUCode_AXWii()
@ -76,24 +76,27 @@ int ReadOutPBsWii(u32 pbs_address, AXParamBlockWii* _pPBs, int _num)
{
int count = 0;
u32 blockAddr = pbs_address;
u32 pAddr = 0;
// reading and 'halfword' swap
for (int i = 0; i < _num; i++)
{
const short *pSrc = (const short *)g_dspInitialize.pGetMemoryPointer(blockAddr);
if (pSrc != NULL)
pAddr = blockAddr;
u32 nextBlock = (Common::swap16(pSrc[162]) << 16 | Common::swap16(pSrc[163]));
if (pSrc != NULL && nextBlock == blockAddr + 320) // new way to stop
{
short *pDest = (short *)&_pPBs[i];
for (size_t p = 0; p < sizeof(AXParamBlock) / 2; p++)
{
for (int p = 0; p < sizeof(AXParamBlockWii) / 2; p++)
{
pDest[p] = Common::swap16(pSrc[p]);
#if defined(_DEBUG) || defined(DEBUGFAST)
gLastBlock = blockAddr + p*2 + 2; // save last block location
#endif
}
blockAddr = (_pPBs[i].next_pb_hi << 16) | _pPBs[i].next_pb_lo;
count++;
count++;
}
else
break;
@ -113,7 +116,7 @@ void WriteBackPBsWii(u32 pbs_address, AXParamBlockWii* _pPBs, int _num)
short* pSrc = (short*)&_pPBs[i];
short* pDest = (short*)g_dspInitialize.pGetMemoryPointer(blockAddr);
for (size_t p = 0; p < sizeof(AXParamBlockWii) / 2; p++)
{
{
pDest[p] = Common::swap16(pSrc[p]);
}
@ -138,7 +141,7 @@ void CUCode_AXWii::MixAdd(short* _pBuffer, int _iSize)
// write logging data to debugger
if (m_frame)
{
lCUCode_AX->Logging(_pBuffer, _iSize, 0);
lCUCode_AX->Logging(_pBuffer, _iSize, 0, true);
}
// ---------------------------------------------------------------------------------------
@ -170,12 +173,11 @@ void CUCode_AXWii::MixAdd(short* _pBuffer, int _iSize)
// ------------
for (int i = 0; i < numberOfPBs; i++)
{
{
AXParamBlockWii& pb = PBs[i];
MixAddVoice(pb, templbuffer, temprbuffer, _iSize);
}
}
// write back out pbs
WriteBackPBsWii(m_addressPBs, PBs, numberOfPBs);
for (int i = 0; i < _iSize; i++)
@ -192,9 +194,9 @@ void CUCode_AXWii::MixAdd(short* _pBuffer, int _iSize)
}
// write logging data to debugger again after the update
//if (m_frame)
if (m_frame)
{
// CUCode_AXWii::Logging(_pBuffer, _iSize, 1);
lCUCode_AX->Logging(_pBuffer, _iSize, 1, true);
}
}

View File

@ -20,7 +20,7 @@
#include "UCode_AXStructs.h"
#define NUMBER_OF_PBS 64
#define NUMBER_OF_PBS 128
class CUCode_AXWii : public IUCode
{

View File

@ -67,10 +67,12 @@ inline u16 ADPCM_Vol(u16 vol, u16 delta, u16 mixer_control)
int x = vol;
if (delta && delta < 0x5000)
x += delta * 20 * 8; // unsure what the right step is
else if (delta && delta > 0x5000)
//x += 1 * 20 * 8;
else if (delta && delta > 05000)
//x -= (0x10000 - delta); // this is to small, it's often 1
x -= (0x10000 - delta) * 20 * 16; // if this was 20 * 8 the sounds in Fire Emblem and Paper Mario
// did not have time to go to zero before the were closed
//x -= 1 * 20 * 16;
// make lower limits
if (x < 0) x = 0;

View File

@ -187,10 +187,18 @@ inline void MixAddVoice(ParamBlockType &pb, int *templbuffer, int *temprbuffer,
}
} // end of the _iSize loop
// Update volume
if(m_frame->gVolume) // allow us to turn this off in the debugger
{
pb.mixer.volume_left = ADPCM_Vol(pb.mixer.volume_left, pb.mixer.unknown, pb.mixer_control);
pb.mixer.volume_right = ADPCM_Vol(pb.mixer.volume_right, pb.mixer.unknown2, pb.mixer_control);
}
pb.src.cur_addr_frac = (u16)frac;
pb.audio_addr.cur_addr_hi = samplePos >> 16;
pb.audio_addr.cur_addr_lo = (u16)samplePos;
}
} //if (pb.running)
}
#endif // _UCODE_AX_VOICE_H