- Fixed a copy-and-paste error in win32/i_main.cpp for 64-bit mode.

- Tweaked OPL centering a little.


SVN r950 (trunk)
This commit is contained in:
Randy Heit 2008-04-30 00:44:45 +00:00
parent de85314234
commit 8040cdd4ff
3 changed files with 21 additions and 10 deletions

View file

@ -1,3 +1,7 @@
April 29, 2008
- Fixed a copy-and-paste error in win32/i_main.cpp for 64-bit mode.
- Tweaked OPL centering a little.
April 28, 2008 April 28, 2008
- Added dynamic recentering for the OPL synth. The chip has four basic - Added dynamic recentering for the OPL synth. The chip has four basic
waveforms, and three of them are non-negative. This can cause a tendency waveforms, and three of them are non-negative. This can cause a tendency

View file

@ -270,7 +270,7 @@ void OPLmusicBlock::OffsetSamples(float *buff, int count)
// data back to around the [-1.0, 1.0] range. // data back to around the [-1.0, 1.0] range.
double max = -1e10, min = 1e10, offset, step; double max = -1e10, min = 1e10, offset, step;
int i, ramp; int i, ramp, largest_at = 0;
// Find max and min values for this segment of the waveform. // Find max and min values for this segment of the waveform.
for (i = 0; i < count; ++i) for (i = 0; i < count; ++i)
@ -278,19 +278,18 @@ void OPLmusicBlock::OffsetSamples(float *buff, int count)
if (buff[i] > max) if (buff[i] > max)
{ {
max = buff[i]; max = buff[i];
largest_at = i;
} }
if (buff[i] < min) if (buff[i] < min)
{ {
min = buff[i]; min = buff[i];
largest_at = i;
} }
} }
// Don't slide if we don't have to, because doing so introduces noise. // Prefer to keep the offset at 0, even if it means a little clipping.
// However, if the amplitude is low, we do want to slide so that when if (LastOffset == 0 && min >= -1.1 && max <= 1.1)
// the song ends, the wave will be around 0 and not click when the song
// starts over.
if (min - LastOffset > -0.5 && max - LastOffset < 0.5 && max - min > 0.5)
{ {
offset = LastOffset; offset = 0;
} }
else else
{ {
@ -305,8 +304,16 @@ void OPLmusicBlock::OffsetSamples(float *buff, int count)
// Ramp the offset change so there aren't any abrupt clicks in the output. // Ramp the offset change so there aren't any abrupt clicks in the output.
// If the ramp is too short, it can sound scratchy. cblood2.mid is // If the ramp is too short, it can sound scratchy. cblood2.mid is
// particularly unforgiving of short ramps. // particularly unforgiving of short ramps.
ramp = MIN(512, count); if (count >= 512)
{
ramp = 512;
step = (offset - LastOffset) / 512; step = (offset - LastOffset) / 512;
}
else
{
ramp = MIN(count, MAX(196, largest_at));
step = (offset - LastOffset) / ramp;
}
offset = LastOffset; offset = LastOffset;
i = 0; i = 0;
if (step != 0) if (step != 0)

View file

@ -1111,7 +1111,7 @@ LONG WINAPI CatchAllExceptions (LPEXCEPTION_POINTERS info)
#ifndef _M_X64 #ifndef _M_X64
info->ContextRecord->Eip = (DWORD_PTR)SleepForever; info->ContextRecord->Eip = (DWORD_PTR)SleepForever;
#else #else
info->ContextRecord->Rip = (DWORD_PTR)ExitFatally; info->ContextRecord->Rip = (DWORD_PTR)SleepForever;
#endif #endif
QueueUserAPC (ExitFatally, MainThread, 0); QueueUserAPC (ExitFatally, MainThread, 0);
} }