Mercurial > hg > beaglert
diff include/Scope.h @ 93:8c7f537d0a21
edited Scope.h with ifdefs to be compatible with udpio plugin
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Tue, 21 Jul 2015 21:18:45 +0100 |
parents | 53e57276ac1a |
children | 836052c86e1e |
line wrap: on
line diff
--- 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 <cmath> #include <UdpClient.h> -#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; n<numChannels; n++){ channel[n].doneOnTime=1; - channel[n].index=2; + channel[n].index=2; //leave space for the heading message (channel, timestamp) channel[n].timestamp=0; channel[n].currentBuffer=0; channel[n].toBeSent=false; +#ifdef BUILD_FOR_UDPRECEIVE_PLUGIN + channel[n].udpClient.setPort(9999+n); + channel[n].udpClient.setServer("192.168.7.1"); +#else channel[n].udpClient.setPort(9999); channel[n].udpClient.setServer("127.0.0.1"); +#endif /* BUILD_FOR_UDPRECEIVE_PLUGIN */ } } void setup(float _sampleRate); @@ -83,7 +88,10 @@ for(int n=0; n<gOscilloscopeInstance->numChannels; 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; } }