# HG changeset patch # User andrewm # Date 1437152020 -3600 # Node ID 53e57276ac1a246732b12272ac248d65b2b01890 # Parent f3251851c71874225bfef92357332ff34a0be5b5 Added Scope.h file diff -r f3251851c718 -r 53e57276ac1a include/Scope.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/Scope.h Fri Jul 17 17:53:40 2015 +0100 @@ -0,0 +1,90 @@ +//scope.cpp +#include +#include +#include +#include + +#define NETWORK_AUDIO_BUFFER_SIZE 2048 +struct networkAudio{ + int timestamp; + int currentBuffer; + int index; + float buffers[2][NETWORK_AUDIO_BUFFER_SIZE]; + int doneOnTime; + bool toBeSent; + UdpClient udpClient; +}; + +#define NUM_SCOPE_CHANNELS 6 + +static void SendScopeData(); + +class Scope { + int sampleCount; + float sampleRate; + AuxiliaryTask scopeTask; + public: + int numChannels; + networkAudio channel[NUM_SCOPE_CHANNELS]; + Scope(){ + numChannels = NUM_SCOPE_CHANNELS; + sampleCount = 0; + + 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].doneOnTime=1; + } + } +}