l@272: /***** Scope.h *****/
l@272: #ifndef __Scope_H_INCLUDED__
l@272: #define __Scope_H_INCLUDED__ 
l@272: 
l@272: #include <OSCServer.h>
l@272: #include <OSCClient.h>
l@272: #include <stdarg.h>
l@272: 
l@272: #define OSC_RECIEVE_PORT 8675
l@272: #define OSC_SEND_PORT 8676
l@272: #define SCOPE_UDP_PORT 8677
l@272: 
l@272: #define FRAMES_STORED 2
l@272: 
l@272: class Scope{
l@272:     public:
l@272:         Scope();
l@272:         
l@272:         void setup(unsigned int numChannels, float sampleRate);
l@272:         void log(float chn1, ...);
l@272:         bool trigger();
l@272:         
l@272:     private:
l@272:         OSCServer oscServer;
l@272:         OSCClient oscClient;
l@272:         UdpClient socket;
l@272:         
l@272:         void parseMessage(oscpkt::Message);
l@272:         void start();
l@272:         void stop();
l@272:         void doTrigger();
l@272:         void triggerNormal();
l@272:         void triggerAuto();
l@272:         void scheduleSendBufferTask();
l@272:         void sendBuffer();
l@272:         void customTrigger();
l@272:         bool triggered();
l@272:         
l@272:         // settings
l@272:         int numChannels;
l@272:         float sampleRate;
l@272:         int connected;
l@272:         int frameWidth;
l@272:         int triggerMode;
l@272:         int triggerChannel;
l@272:         int triggerDir;
l@272:         float triggerLevel;
l@272:         int xOffset;
l@272:         int upSampling;
l@272:         int downSampling;
l@272:         float holdOff;
l@272:         
l@272:         int channelWidth;
l@272:         int downSampleCount;
l@272:         int holdOffSamples;
l@272:         
l@272:         // buffers
l@272:         std::vector<float> buffer;
l@272:         std::vector<float> outBuffer;
l@272:         
l@272:         // pointers
l@272:         int writePointer;
l@272:         int readPointer;
l@272:         int triggerPointer;
l@272:         int customTriggerPointer;
l@272:         
l@272:         // trigger status
l@272:         bool triggerPrimed;
l@272:         bool triggerCollecting;
l@272:         bool triggerWaiting;
l@272:         bool triggering;
l@272:         int triggerCount;
l@272:         int autoTriggerCount;
l@272:         bool started;
l@272:         bool customTriggered;
l@272:         
l@272:         // aux tasks
l@272:         AuxiliaryTask scopeTriggerTask;
l@272:         static void triggerTask(void*);
l@272:         
l@272:         AuxiliaryTask scopeSendBufferTask;
l@272:         static void sendBufferTask(void*);
l@272:         
l@272: };
l@272: 
l@272: #endif