Merge remote-tracking branch 'origin/master'

This commit is contained in:
Philip Rosedale 2013-02-05 13:28:21 -08:00
commit 11a9abb4df
6 changed files with 16 additions and 14 deletions

View file

@ -233,7 +233,7 @@ void *receiveAudioViaUDP(void *args) {
if (LOG_SAMPLE_DELAY) { if (LOG_SAMPLE_DELAY) {
if (!firstSample) { if (!firstSample) {
// write time difference (in microseconds) between packet receipts to file // write time difference (in microseconds) between packet receipts to file
double timeDiff = diffclock(previousReceiveTime, currentReceiveTime); double timeDiff = diffclock(&previousReceiveTime, &currentReceiveTime);
logFile << timeDiff << std::endl; logFile << timeDiff << std::endl;
} }
} }
@ -242,7 +242,7 @@ void *receiveAudioViaUDP(void *args) {
if (firstSample) { if (firstSample) {
stdev.reset(); stdev.reset();
} else { } else {
stdev.addValue(diffclock(previousReceiveTime, currentReceiveTime)); stdev.addValue(diffclock(&previousReceiveTime, &currentReceiveTime));
if (stdev.getSamples() > 500) { if (stdev.getSamples() > 500) {
printf("Avg: %4.2f, Stdev: %4.2f\n", stdev.getAverage(), stdev.getStDev()); printf("Avg: %4.2f, Stdev: %4.2f\n", stdev.getAverage(), stdev.getStDev());
stdev.reset(); stdev.reset();

View file

@ -138,7 +138,7 @@ int network_receive(int handle, in_addr * from_addr, char * packet_data, int del
} }
// Then check if next to be sent is past due, send if so // Then check if next to be sent is past due, send if so
if ((next_to_receive != next_to_send) && if ((next_to_receive != next_to_send) &&
(diffclock(delay_time_received[next_to_send], check) > delay)) { (diffclock(&delay_time_received[next_to_send], &check) > delay)) {
int returned_bytes = delay_size_received[next_to_send]; int returned_bytes = delay_size_received[next_to_send];
memcpy(packet_data, memcpy(packet_data,
&delay_buffer[next_to_send*MAX_PACKET_SIZE], &delay_buffer[next_to_send*MAX_PACKET_SIZE],

View file

@ -137,10 +137,10 @@ void outstring(char * string, int length) {
std::cout << out << "\n"; std::cout << out << "\n";
} }
double diffclock(timeval clock1,timeval clock2) double diffclock(timeval *clock1,timeval *clock2)
{ {
double diffms = (clock2.tv_sec - clock1.tv_sec) * 1000.0; double diffms = (clock2->tv_sec - clock1->tv_sec) * 1000.0;
diffms += (clock2.tv_usec - clock1.tv_usec) / 1000.0; // us to ms diffms += (clock2->tv_usec - clock1->tv_usec) / 1000.0; // us to ms
return diffms; return diffms;
} }

View file

@ -22,7 +22,7 @@ void drawtext(int x, int y, float scale, float rotate, float thick, int mono, ch
float r=1.0, float g=1.0, float b=1.0); float r=1.0, float g=1.0, float b=1.0);
void drawvec3(int x, int y, float scale, float rotate, float thick, int mono, glm::vec3 vec, void drawvec3(int x, int y, float scale, float rotate, float thick, int mono, glm::vec3 vec,
float r=1.0, float g=1.0, float b=1.0); float r=1.0, float g=1.0, float b=1.0);
double diffclock(timeval clock1,timeval clock2); double diffclock(timeval *clock1,timeval *clock2);
class StDev { class StDev {
public: public:

View file

@ -217,9 +217,9 @@ float pointer_attenuation_quadratic[] = { 1.0f, 0.0f, 0.0f }; // for 2D view
void Timer(int extra) void Timer(int extra)
{ {
gettimeofday(&timer_end, NULL); gettimeofday(&timer_end, NULL);
FPS = (float)framecount / ((float)diffclock(timer_start,timer_end) / 1000.f); FPS = (float)framecount / ((float)diffclock(&timer_start, &timer_end) / 1000.f);
packets_per_second = (float)packetcount / ((float)diffclock(timer_start,timer_end) / 1000.f); packets_per_second = (float)packetcount / ((float)diffclock(&timer_start, &timer_end) / 1000.f);
bytes_per_second = (float)bytescount / ((float)diffclock(timer_start,timer_end) / 1000.f); bytes_per_second = (float)bytescount / ((float)diffclock(&timer_start, &timer_end) / 1000.f);
framecount = 0; framecount = 0;
packetcount = 0; packetcount = 0;
bytescount = 0; bytescount = 0;
@ -312,7 +312,7 @@ void init(void)
{ {
serialPort.readData(); serialPort.readData();
gettimeofday(&timer_end, NULL); gettimeofday(&timer_end, NULL);
if (diffclock(timer_start,timer_end) > 1000) done = 1; if (diffclock(&timer_start, &timer_end) > 1000) done = 1;
} }
gravity.x = serialPort.getValue(ACCEL_X); gravity.x = serialPort.getValue(ACCEL_X);
gravity.y = serialPort.getValue(ACCEL_Y); gravity.y = serialPort.getValue(ACCEL_Y);
@ -759,7 +759,7 @@ void read_network()
// //
timeval check; timeval check;
gettimeofday(&check, NULL); gettimeofday(&check, NULL);
ping_msecs = (float)diffclock(ping_start, check); ping_msecs = (float)diffclock(&ping_start, &check);
} else if (incoming_packet[0] == 'S') { } else if (incoming_packet[0] == 'S') {
// //
// Message from Spaceserver // Message from Spaceserver
@ -780,7 +780,7 @@ void idle(void)
gettimeofday(&check, NULL); gettimeofday(&check, NULL);
// Check and render display frame // Check and render display frame
if (diffclock(last_frame,check) > RENDER_FRAME_MSECS) if (diffclock(&last_frame, &check) > RENDER_FRAME_MSECS)
{ {
steps_per_frame++; steps_per_frame++;
// Simulation // Simulation
@ -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 )
{ {

View file

@ -963,6 +963,7 @@
GCC_OPTIMIZATION_LEVEL = 0; GCC_OPTIMIZATION_LEVEL = 0;
GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx10.7; SDKROOT = macosx10.7;
}; };
@ -975,6 +976,7 @@
GCC_C_LANGUAGE_STANDARD = gnu99; GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
SDKROOT = macosx10.7; SDKROOT = macosx10.7;
}; };
name = Release; name = Release;