Mercurial > hg > beaglert
diff include/NetworkSend.h @ 129:cce58e6ec2a2 scope-refactoring
Added ifdefs USE_JUCE to NetworkSend. Juce part not added yet
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Mon, 24 Aug 2015 20:53:26 +0100 |
parents | c692827083e1 |
children | ff28e56e5b7e |
line wrap: on
line diff
--- a/include/NetworkSend.h Mon Aug 24 18:55:19 2015 +0100 +++ b/include/NetworkSend.h Mon Aug 24 20:53:26 2015 +0100 @@ -2,11 +2,14 @@ #ifndef SCOPE_H_ #define SCOPE_H_ +#ifdef USE_JUCE +#else #include <BeagleRT.h> #include <rtdk.h> #include <cmath> #include <UdpClient.h> #include <vector> +#endif /* USE_JUCE */ #define NETWORK_AUDIO_BUFFER_SIZE 302 @@ -20,30 +23,45 @@ static const int headerLength=2; }; +#ifdef USE_JUCE +class NetworkSend: public Thread { +#else class NetworkSend { - int sampleCount; - float sampleRate; +#endif /* USE_JUCE */ + int sampleCount; + float sampleRate; +#ifdef USE_JUCE + DatagramSocket udpClient; +#else UdpClient udpClient; static bool staticConstructed; - static void staticConstructor(); - static AuxiliaryTask sendDataTask; //TODO: allow different AuxiliaryTasks for different priorities (e.g.: audio vs scope) - static std::vector<NetworkSend *> objAddrs; - public: - NetworkBuffer channel; - NetworkSend(); - ~NetworkSend(); - void setup(float aSampleRate); - void setup(float aSampleRate, int aChannelNumber, int aPort, const char *aServer); - void sendData(); - void log(float value); - void setPort(int aPort); - void setServer(const char* aServer); - void setChannelNumber(int aChannelNumber); - int getChannelNumber(); - static int getNumInstances(); - static void sendAllData(); + static void staticConstructor(); + static AuxiliaryTask sendDataTask; //TODO: allow different AuxiliaryTasks for different priorities (e.g.: audio vs scope) + static std::vector<NetworkSend *> objAddrs; +#endif /* USE_JUCE */ + public: + NetworkBuffer channel; + NetworkSend(); + ~NetworkSend(); + void setup(float aSampleRate); + void setup(float aSampleRate, int aChannelNumber, int aPort, const char *aServer); + void sendData(); + void log(float value); + void setPort(int aPort); + void setServer(const char* aServer); + void setChannelNumber(int aChannelNumber); + int getChannelNumber(); +#ifdef USE_JUCE + void run(); +#else + static int getNumInstances(); + static void sendAllData(); + static void run(); +#endif /* USE_JUCE */ }; +#ifdef USE_JUCE +#else /** * An array of NetworkSend objects with some default parameters * @@ -64,4 +82,6 @@ void setPort(int channel, int port); int getNumChannels(); }; +#endif /* USE_JUCE */ + #endif /* SCOPE_H */