This commit is contained in:
parent
8da2a6eb10
commit
d399ef263f
|
@ -322,7 +322,7 @@ inline double calc_rate(int timer)
|
|||
{
|
||||
return double(SOUND_CLOCK_TICKS) /
|
||||
double((0x10000 - (timer ? timer1Reload : timer0Reload)) *
|
||||
(timer ? timer1ClockReload : timer0ClockReload));
|
||||
1 << (timer ? timer1ClockReload : timer0ClockReload));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -356,6 +356,13 @@ static foo_interpolate_setup blah;
|
|||
|
||||
static int interpolation = 0;
|
||||
|
||||
void interp_reset(int ch)
|
||||
{
|
||||
setSoundFn();
|
||||
interp[ch]->reset();
|
||||
interp_rate();
|
||||
}
|
||||
|
||||
void interp_switch(int which)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
|
@ -363,8 +370,8 @@ void interp_switch(int which)
|
|||
delete interp[i];
|
||||
interp[i] = get_filter(which);
|
||||
}
|
||||
interp_rate();
|
||||
interpolation = which;
|
||||
interp_rate();
|
||||
}
|
||||
|
||||
|
||||
|
@ -374,12 +381,6 @@ void interp_rate()
|
|||
interp[1]->rate(calc_rate(soundDSBTimer));
|
||||
}
|
||||
|
||||
void interp_reset(int ch)
|
||||
{
|
||||
setSoundFn();
|
||||
interp[ch]->reset();
|
||||
interp_rate();
|
||||
}
|
||||
|
||||
|
||||
inline void interp_push(int ch, int sample)
|
||||
|
|
|
@ -146,7 +146,10 @@ class sample_buffer
|
|||
T * buffer;
|
||||
|
||||
public:
|
||||
sample_buffer() : ptr(0), filled(0), buffer(0) {}
|
||||
sample_buffer() : ptr(0), filled(0)
|
||||
{
|
||||
buffer = new T[buffer_size];
|
||||
}
|
||||
~sample_buffer()
|
||||
{
|
||||
if (buffer) delete [] buffer;
|
||||
|
@ -154,11 +157,6 @@ public:
|
|||
|
||||
void clear()
|
||||
{
|
||||
if (buffer)
|
||||
{
|
||||
delete [] buffer;
|
||||
buffer = 0;
|
||||
}
|
||||
ptr = filled = 0;
|
||||
}
|
||||
|
||||
|
@ -169,7 +167,6 @@ public:
|
|||
|
||||
inline void push_back(T sample)
|
||||
{
|
||||
if (!buffer) buffer = new T[buffer_size];
|
||||
buffer[ptr] = sample;
|
||||
if (++ptr >= buffer_size) ptr = 0;
|
||||
if (filled < buffer_size) filled++;
|
||||
|
@ -259,11 +256,7 @@ public:
|
|||
ret += smp(1) * position;
|
||||
ret >>= 15;
|
||||
|
||||
// wahoo, takes care of drifting
|
||||
if (samples.size() > 2)
|
||||
position+=lrate+16383;
|
||||
else
|
||||
position+=lrate;
|
||||
position+=lrate;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -329,11 +322,7 @@ public:
|
|||
if (ret > 32767) ret = 32767;
|
||||
else if (ret < -32768) ret = -32768;
|
||||
|
||||
// wahoo, takes care of drifting
|
||||
if (samples.size() > 8)
|
||||
position+=lrate+16383;
|
||||
else
|
||||
position+=lrate;
|
||||
position+=lrate;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -356,7 +345,10 @@ public:
|
|||
position = 0;
|
||||
}
|
||||
|
||||
~foo_fir() {}
|
||||
~foo_fir()
|
||||
{
|
||||
position=666;
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
|
@ -395,11 +387,7 @@ public:
|
|||
if (ret > 32767) ret = 32767;
|
||||
else if (ret < -32768) ret = -32768;
|
||||
|
||||
// wahoo, takes care of drifting
|
||||
if (samples.size() > 16)
|
||||
position+=lrate+16383;
|
||||
else
|
||||
position+=lrate;
|
||||
position+=lrate;
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -533,7 +533,9 @@ BOOL checkKey(LONG_PTR key)
|
|||
|
||||
if (dev == 0) {
|
||||
return KEYDOWN(pDevices[0].data,k);
|
||||
} else {
|
||||
} else if (dev >= numDevices) {
|
||||
return FALSE;
|
||||
} else {
|
||||
if (k < 16) {
|
||||
LONG_PTR axis = k >> 1;
|
||||
LONG value = pDevices[dev].axis[axis].center;
|
||||
|
@ -805,7 +807,7 @@ CString DirectInput::getKeyName(LONG_PTR key)
|
|||
if (d == 0) {
|
||||
pDevices[0].device->GetObjectInfo( &di, (DWORD)key, DIPH_BYOFFSET );
|
||||
winBuffer = di.tszName;
|
||||
} else {
|
||||
} else if (d < numDevices) {
|
||||
if (k < 16) {
|
||||
if (k < 4) {
|
||||
switch (k) {
|
||||
|
@ -852,6 +854,11 @@ CString DirectInput::getKeyName(LONG_PTR key)
|
|||
winBuffer.Format(winResLoadString(IDS_JOY_BUTTON),d,di.tszName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Joystick isn't plugged in. We can't decipher k, so just show its value.
|
||||
winBuffer.Format("Joy %d (%d)", d, k);
|
||||
}
|
||||
|
||||
return winBuffer;
|
||||
}
|
||||
|
|
|
@ -1008,11 +1008,13 @@ void systemDrawScreen()
|
|||
}
|
||||
|
||||
if(!soundBufferLow)
|
||||
{
|
||||
theApp.display->render();
|
||||
Sm60FPS_Sleep();
|
||||
}
|
||||
else
|
||||
soundBufferLow = false;
|
||||
|
||||
Sm60FPS_Sleep();
|
||||
}
|
||||
|
||||
void systemScreenCapture(int captureNumber)
|
||||
|
|
Loading…
Reference in New Issue