diff include/Scope.h @ 272:733006bdbca2 prerelease

Added Scope.h and Scope.cpp
author Liam Donovan <l.b.donovan@qmul.ac.uk>
date Tue, 17 May 2016 16:17:48 +0100
parents
children faa5f58c71af
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/Scope.h	Tue May 17 16:17:48 2016 +0100
@@ -0,0 +1,86 @@
+/***** Scope.h *****/
+#ifndef __Scope_H_INCLUDED__
+#define __Scope_H_INCLUDED__ 
+
+#include <OSCServer.h>
+#include <OSCClient.h>
+#include <stdarg.h>
+
+#define OSC_RECIEVE_PORT 8675
+#define OSC_SEND_PORT 8676
+#define SCOPE_UDP_PORT 8677
+
+#define FRAMES_STORED 2
+
+class Scope{
+    public:
+        Scope();
+        
+        void setup(unsigned int numChannels, float sampleRate);
+        void log(float chn1, ...);
+        bool trigger();
+        
+    private:
+        OSCServer oscServer;
+        OSCClient oscClient;
+        UdpClient socket;
+        
+        void parseMessage(oscpkt::Message);
+        void start();
+        void stop();
+        void doTrigger();
+        void triggerNormal();
+        void triggerAuto();
+        void scheduleSendBufferTask();
+        void sendBuffer();
+        void customTrigger();
+        bool triggered();
+        
+        // settings
+        int numChannels;
+        float sampleRate;
+        int connected;
+        int frameWidth;
+        int triggerMode;
+        int triggerChannel;
+        int triggerDir;
+        float triggerLevel;
+        int xOffset;
+        int upSampling;
+        int downSampling;
+        float holdOff;
+        
+        int channelWidth;
+        int downSampleCount;
+        int holdOffSamples;
+        
+        // buffers
+        std::vector<float> buffer;
+        std::vector<float> outBuffer;
+        
+        // pointers
+        int writePointer;
+        int readPointer;
+        int triggerPointer;
+        int customTriggerPointer;
+        
+        // trigger status
+        bool triggerPrimed;
+        bool triggerCollecting;
+        bool triggerWaiting;
+        bool triggering;
+        int triggerCount;
+        int autoTriggerCount;
+        bool started;
+        bool customTriggered;
+        
+        // aux tasks
+        AuxiliaryTask scopeTriggerTask;
+        static void triggerTask(void*);
+        
+        AuxiliaryTask scopeSendBufferTask;
+        static void sendBufferTask(void*);
+        
+};
+
+#endif
\ No newline at end of file