Renamed 'spaceserver' references to 'domainserver'

This commit is contained in:
Philip Rosedale 2013-02-06 18:11:56 -08:00
parent fb4f2c3633
commit 421d850b76
9 changed files with 31 additions and 26 deletions

View file

@ -17,14 +17,15 @@ struct AgentList {
in_addr sin_addr;
Head head;
} agents[MAX_AGENTS];
int num_agents = 0;
//
// Process an incoming spaceserver packet telling you about other nearby agents
// Process an incoming domainserver packet telling you about other nearby agents
//
void update_agents(char * data, int length) {
std::string packet(data, length);
std::cout << " Update Agents, string: " << packet << "\n";
//std::cout << " Update Agents, string: " << packet << "\n";
size_t spot;
size_t start_spot = 0;
spot = packet.find_first_of (",", 0);

View file

@ -247,8 +247,8 @@ void *receiveAudioViaUDP(void *args) {
//printf(\n";
stdev.addValue(tDiff);
if (stdev.getSamples() > 500) {
sharedAudioData->jitter = stdev.getStDev();
printf("Avg: %4.2f, Stdev: %4.2f\n", stdev.getAverage(), sharedAudioData->jitter);
sharedAudioData->measuredJitter = stdev.getStDev();
printf("Avg: %4.2f, Stdev: %4.2f\n", stdev.getAverage(), sharedAudioData->measuredJitter);
stdev.reset();
}
}
@ -465,7 +465,7 @@ void Audio::render(int screenWidth, int screenHeight)
// Show a Cyan bar with the most recently measured jitter stdev
int jitterPels = (float) data->jitter/ ((1000.0*(float)BUFFER_LENGTH_SAMPLES/(float)SAMPLE_RATE)) * (float)frameWidth;
int jitterPels = (float) data->measuredJitter/ ((1000.0*(float)BUFFER_LENGTH_SAMPLES/(float)SAMPLE_RATE)) * (float)frameWidth;
glColor3f(0,1,1);
glBegin(GL_QUADS);
@ -475,7 +475,7 @@ void Audio::render(int screenWidth, int screenHeight)
glVertex2f(startX + jitterPels - 2, bottomY + 2);
glEnd();
sprintf(out,"%3.1f\n", data->jitter);
sprintf(out,"%3.1f\n", data->measuredJitter);
drawtext(startX + jitterPels - 5, topY-10, 0.08, 0, 1, 0, out, 0,1,1);
sprintf(out, "%3.1fms\n", JITTER_BUFFER_LENGTH_MSECS);

View file

@ -27,7 +27,9 @@ AudioData::AudioData(int numberOfSources, int bufferLength) {
averagedLatency = 0.0;
lastCallback.tv_usec = 0;
wasStarved = 0;
jitter = 0;
measuredJitter = 0;
jitterBuffer = 0;
}
AudioData::~AudioData() {

View file

@ -28,7 +28,8 @@ class AudioData {
timeval lastCallback;
float averagedLatency;
float jitter;
float measuredJitter;
float jitterBuffer;
int wasStarved;
AudioData(int bufferLength);

View file

@ -19,7 +19,7 @@ int delay_size_received[MAX_DELAY_PACKETS];
int next_to_receive = 0;
int next_to_send = 0;
sockaddr_in address, dest_address, spaceserver_address, from;
sockaddr_in address, dest_address, domainserver_address, from;
socklen_t fromLength = sizeof( from );
int network_init()
@ -65,9 +65,9 @@ int network_init()
dest_address.sin_addr.s_addr = inet_addr(DESTINATION_IP);
dest_address.sin_port = htons( (unsigned short) UDP_PORT );
spaceserver_address.sin_family = AF_INET;
spaceserver_address.sin_addr.s_addr = inet_addr(SPACESERVER_IP);
spaceserver_address.sin_port = htons( (unsigned short) SPACESERVER_PORT );
domainserver_address.sin_family = AF_INET;
domainserver_address.sin_addr.s_addr = inet_addr(DOMAINSERVER_IP);
domainserver_address.sin_port = htons( (unsigned short) DOMAINSERVER_PORT );
from.sin_family = AF_INET;
//from.sin_addr.s_addr = htonl(ip_address);
@ -86,16 +86,16 @@ timeval network_send_ping(int handle) {
return check;
}
int notify_spaceserver(int handle, float x, float y, float z) {
int notify_domainserver(int handle, float x, float y, float z) {
char data[100];
sprintf(data, "%f,%f,%f", x, y, z);
//std::cout << "sending: " << data << "\n";
int packet_size = strlen(data);
int sent_bytes = sendto( handle, (const char*)data, packet_size,
0, (sockaddr*)&spaceserver_address, sizeof(sockaddr_in) );
0, (sockaddr*)&domainserver_address, sizeof(sockaddr_in) );
if ( sent_bytes != packet_size )
{
printf( "failed to send to spaceserver: return value = %d\n", sent_bytes );
printf( "failed to send to domainserver: return value = %d\n", sent_bytes );
return false;
}
return sent_bytes;

View file

@ -21,9 +21,9 @@ const int MAX_PACKET_SIZE = 1500;
const int UDP_PORT = 30001;
const char DESTINATION_IP[] = "127.0.0.1";
// Address and port of spaceserver process to advertise other agents
const char SPACESERVER_IP[] = "127.0.0.1";
const int SPACESERVER_PORT = 40000;
// Address and port of domainserver process to advertise other agents
const char DOMAINSERVER_IP[] = "127.0.0.1";
const int DOMAINSERVER_PORT = 40000;
// Randomly send a ping packet every N packets sent
const int PING_PACKET_COUNT = 20;
@ -32,6 +32,6 @@ int network_init();
int network_send(int handle, char * packet_data, int packet_size);
int network_receive(int handle, in_addr * from_addr, char * packet_data, int delay /*msecs*/);
timeval network_send_ping(int handle);
int notify_spaceserver(int handle, float x, float y, float z);
int notify_domainserver(int handle, float x, float y, float z);
#endif

View file

@ -230,8 +230,8 @@ void Timer(int extra)
glutTimerFunc(1000,Timer,0);
gettimeofday(&timer_start, NULL);
// Send a message to the spaceserver telling it we are ALIVE
notify_spaceserver(UDP_socket, location[0], location[1], location[2]);
// Send a message to the domainserver telling it we are ALIVE
notify_domainserver(UDP_socket, location[0], location[1], location[2]);
}
@ -783,7 +783,7 @@ void read_network()
ping_msecs = (float)diffclock(&ping_start, &check);
} else if (incoming_packet[0] == 'S') {
//
// Message from Spaceserver
// Message from domainserver
//
update_agents(&incoming_packet[1], bytes_recvd - 1);
} else if (incoming_packet[0] == 'H') {

View file

@ -916,7 +916,7 @@
"$(OTHER_CFLAGS)",
);
PRODUCT_NAME = interface;
SDKROOT = macosx10.7;
SDKROOT = macosx;
USER_HEADER_SEARCH_PATHS = "";
};
name = Debug;
@ -950,7 +950,7 @@
"$(OTHER_CFLAGS)",
);
PRODUCT_NAME = interface;
SDKROOT = macosx10.7;
SDKROOT = macosx;
USER_HEADER_SEARCH_PATHS = "";
};
name = Release;
@ -965,7 +965,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx10.7;
SDKROOT = macosx;
};
name = Debug;
};
@ -977,7 +977,7 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
SDKROOT = macosx10.7;
SDKROOT = macosx;
};
name = Release;
};

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0450"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"