# HG changeset patch # User Giulio Moro # Date 1437509925 -3600 # Node ID 8c7f537d0a216d79762a2e019472ec56d4aea1d4 # Parent a55dcdcebdcdc57391e134688f4cd2aeae228f2f edited Scope.h with ifdefs to be compatible with udpio plugin diff -r a55dcdcebdcd -r 8c7f537d0a21 include/Scope.h --- a/include/Scope.h Tue Jul 21 17:17:37 2015 +0100 +++ b/include/Scope.h Tue Jul 21 21:18:45 2015 +0100 @@ -4,7 +4,7 @@ #include #include -#define NETWORK_AUDIO_BUFFER_SIZE 2048 +#define NETWORK_AUDIO_BUFFER_SIZE 400 struct networkAudio{ int timestamp; int currentBuffer; @@ -32,12 +32,17 @@ for(int n=0; nnumChannels; n++){ if(gOscilloscopeInstance->channel[n].toBeSent){ gOscilloscopeInstance->channel[n].toBeSent=false; - gOscilloscopeInstance->channel[n].udpClient.send(gOscilloscopeInstance->channel[n].buffers[!gOscilloscopeInstance->channel[n].currentBuffer],NETWORK_AUDIO_BUFFER_SIZE*sizeof(float)); + gOscilloscopeInstance->channel[n].udpClient.send( + gOscilloscopeInstance->channel[n].buffers[!gOscilloscopeInstance->channel[n].currentBuffer], + NETWORK_AUDIO_BUFFER_SIZE*sizeof(float) + ); gOscilloscopeInstance->channel[n].doneOnTime=1; } } diff -r a55dcdcebdcd -r 8c7f537d0a21 resources/network/udp-server.c --- a/resources/network/udp-server.c Tue Jul 21 17:17:37 2015 +0100 +++ b/resources/network/udp-server.c Tue Jul 21 21:18:45 2015 +0100 @@ -23,8 +23,11 @@ socklen_t fromlen; struct sockaddr_in server; struct sockaddr_in from; - char buf[1024]; - + float buf[2048]; + int i=0; + for(i=0; i<2048; i++){ + buf[i]=0; + } if (argc < 2) { fprintf(stderr, "ERROR, no port provided\n"); exit(0); @@ -41,10 +44,11 @@ error("binding"); fromlen = sizeof(struct sockaddr_in); while (1) { - n = recvfrom(sock,buf,1024,0,(struct sockaddr *)&from,&fromlen); + n = recvfrom(sock,buf,2048,0,(struct sockaddr *)&from,&fromlen); if (n < 0) error("recvfrom"); - write(1,"Received a datagram: ",21); - write(1,buf,n); + printf("Received a datagram of size %d: \n", n); + for(i=0; i