git-svn-id: http://svn.purei.org/purei/trunk@399 b36208d7-6611-0410-8bec-b1987f11c4a2

This commit is contained in:
jpd002 2008-10-31 22:01:01 +00:00
parent 054a6d17d9
commit f9ad68af6d
4 changed files with 32 additions and 31 deletions

View File

@ -136,6 +136,7 @@ void CSpu::Reset()
m_channelOn.f = 0;
m_channelReverb.f = 0;
m_reverbTicks = 0;
m_ctrl = 0;
m_reverbCurrAddr = 0;
m_reverbWorkAddr = 0;
@ -335,23 +336,26 @@ void CSpu::Render(int16* samples, unsigned int sampleCount, unsigned int sampleR
}
}
float sampleL = 0.333f * (GetReverbSample(GetReverbOffset(MIX_DEST_A0)) + GetReverbSample(GetReverbOffset(MIX_DEST_B0)));
float sampleR = 0.333f * (GetReverbSample(GetReverbOffset(MIX_DEST_A1)) + GetReverbSample(GetReverbOffset(MIX_DEST_B1)));
if(m_reverbWorkAddr != 0)
{
int16* output = samples + 0;
int32 resultSample = static_cast<int32>(sampleL) + static_cast<int32>(*output);
resultSample = max<int32>(resultSample, SHRT_MIN);
resultSample = min<int32>(resultSample, SHRT_MAX);
*output = static_cast<int16>(resultSample);
}
float sampleL = 0.333f * (GetReverbSample(GetReverbOffset(MIX_DEST_A0)) + GetReverbSample(GetReverbOffset(MIX_DEST_B0)));
float sampleR = 0.333f * (GetReverbSample(GetReverbOffset(MIX_DEST_A1)) + GetReverbSample(GetReverbOffset(MIX_DEST_B1)));
{
int16* output = samples + 1;
int32 resultSample = static_cast<int32>(sampleR) + static_cast<int32>(*output);
resultSample = max<int32>(resultSample, SHRT_MIN);
resultSample = min<int32>(resultSample, SHRT_MAX);
*output = static_cast<int16>(resultSample);
{
int16* output = samples + 0;
int32 resultSample = static_cast<int32>(sampleL) + static_cast<int32>(*output);
resultSample = max<int32>(resultSample, SHRT_MIN);
resultSample = min<int32>(resultSample, SHRT_MAX);
*output = static_cast<int16>(resultSample);
}
{
int16* output = samples + 1;
int32 resultSample = static_cast<int32>(sampleR) + static_cast<int32>(*output);
resultSample = max<int32>(resultSample, SHRT_MIN);
resultSample = min<int32>(resultSample, SHRT_MAX);
*output = static_cast<int16>(resultSample);
}
}
m_reverbTicks++;
@ -475,6 +479,7 @@ void CSpu::WriteRegister(uint32 address, uint16 value)
break;
case CH_ADDRESS:
m_channel[channel].address = value;
m_channel[channel].current = value * 8;
break;
case CH_ADSR_LEVEL:
m_channel[channel].adsrLevel <<= value;

View File

@ -119,9 +119,7 @@ uint32 CCore::ReadRegisterCore(unsigned int channelId, uint32 address, uint32 va
}
break;
}
#ifdef _DEBUG
LogRead(address);
#endif
return result;
}
@ -180,21 +178,19 @@ uint32 CCore::ReadRegisterChannel(unsigned int channelId, uint32 address, uint32
{
return 0;
}
#ifdef _DEBUG
LogChannelRead(channelId, address);
#endif
uint32 result = 0;
CSpu::CHANNEL& channel(m_spuBase.GetChannel(channelId));
switch(address)
{
case VA_NAX_HI:
return ((channel.current) >> (16 + 1)) & 0xFFFF;
result = ((channel.current) >> (16 + 1)) & 0xFFFF;
break;
case VA_NAX_LO:
return ((channel.current) >> 1) & 0xFFFF;
result = ((channel.current) >> 1) & 0xFFFF;
break;
}
return 0;
LogChannelRead(channelId, address, result);
return result;
}
uint32 CCore::WriteRegisterChannel(unsigned int channelId, uint32 address, uint32 value)
@ -338,18 +334,18 @@ void CCore::LogWrite(uint32 address, uint32 value)
}
}
void CCore::LogChannelRead(unsigned int channelId, uint32 address)
void CCore::LogChannelRead(unsigned int channelId, uint32 address, uint32 result)
{
const char* logName = m_logName.c_str();
switch(address)
{
case VA_NAX_HI:
CLog::GetInstance().Print(logName, "ch%0.2i: = VA_NAX_HI.\r\n",
channelId);
CLog::GetInstance().Print(logName, "ch%0.2i: = VA_NAX_HI = 0x%0.4X.\r\n",
channelId, result);
break;
case VA_NAX_LO:
CLog::GetInstance().Print(logName, "ch%0.2i: = VA_NAX_LO.\r\n",
channelId);
CLog::GetInstance().Print(logName, "ch%0.2i: = VA_NAX_LO = 0x%0.4X.\r\n",
channelId, result);
break;
default:
CLog::GetInstance().Print(logName, "ch%0.2i: Read an unknown register 0x%0.4X.\r\n",

View File

@ -90,7 +90,7 @@ namespace PS2
void LogRead(uint32);
void LogWrite(uint32, uint32);
void LogChannelRead(unsigned int, uint32);
void LogChannelRead(unsigned int, uint32, uint32);
void LogChannelWrite(unsigned int, uint32, uint32);
REGISTER_DISPATCH_INFO m_readDispatch;

View File

@ -119,7 +119,7 @@
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="&quot;C:\Program Files\OpenAL 1.1 SDK\include&quot;;C:\Projects\Rawr\Source;C:\Projects\zlib;C:\Components\boost_1_35_0\boost\tr1\tr1;C:\Components\boost_1_35_0;C:\Projects\Framework\include;C:\Projects\Rawr\tools\PsfPlayer2\Source"
PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_MSVC;_PSX;_NULL_SIFMAN"
PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_MSVC;_PSX;_NULL_SIFMAN;DEBUGGER_INCLUDED"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"