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