disable crashing lattice mouse code, fix diffclock for audio render

This commit is contained in:
Stephen Birarda 2013-02-04 19:06:32 -08:00
parent 764ea3fd21
commit 08d0283586
2 changed files with 3 additions and 3 deletions

View file

@ -28,7 +28,7 @@ const float AMPLITUDE_RATIO_AT_90 = 0.5;
const short RING_BUFFER_FRAMES = 10; const short RING_BUFFER_FRAMES = 10;
const short RING_BUFFER_SIZE_SAMPLES = RING_BUFFER_FRAMES * BUFFER_LENGTH_SAMPLES; const short RING_BUFFER_SIZE_SAMPLES = RING_BUFFER_FRAMES * BUFFER_LENGTH_SAMPLES;
const short JITTER_BUFFER_LENGTH_MSECS = 50; const short JITTER_BUFFER_LENGTH_MSECS = 40;
const int SAMPLE_RATE = 22050; const int SAMPLE_RATE = 22050;
const short NUM_AUDIO_SOURCES = 2; const short NUM_AUDIO_SOURCES = 2;
@ -422,7 +422,7 @@ void Audio::render(int screenWidth, int screenHeight)
float remainingBuffer = 0; float remainingBuffer = 0;
timeval currentTime; timeval currentTime;
gettimeofday(&currentTime, NULL); gettimeofday(&currentTime, NULL);
float timeLeftInCurrentBuffer = diffclock(currentTime, data->lastCallback)/(1000.0*(float)BUFFER_LENGTH_SAMPLES/(float)SAMPLE_RATE) * frameWidth; float timeLeftInCurrentBuffer = diffclock(data->lastCallback, currentTime)/(1000.0*(float)BUFFER_LENGTH_SAMPLES/(float)SAMPLE_RATE) * frameWidth;
//float timeLeftInCurrentBuffer = diffclock(currentTime, data->lastCallback)/23.22 * frameWidth; //float timeLeftInCurrentBuffer = diffclock(currentTime, data->lastCallback)/23.22 * frameWidth;
remainingBuffer = data->ringBuffer->diffLastWriteNextOutput() / BUFFER_LENGTH_SAMPLES * frameWidth; remainingBuffer = data->ringBuffer->diffLastWriteNextOutput() / BUFFER_LENGTH_SAMPLES * frameWidth;

View file

@ -842,7 +842,7 @@ void mouseFunc( int button, int state, int x, int y )
mouse_x = x; mouse_x = x;
mouse_y = y; mouse_y = y;
mouse_pressed = 1; mouse_pressed = 1;
lattice.mouseClick((float)x/(float)WIDTH,(float)y/(float)HEIGHT); // lattice.mouseClick((float)x/(float)WIDTH,(float)y/(float)HEIGHT);
} }
if( button == GLUT_LEFT_BUTTON && state == GLUT_UP ) if( button == GLUT_LEFT_BUTTON && state == GLUT_UP )
{ {