Mercurial > hg > beaglert
comparison 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 |
comparison
equal
deleted
inserted
replaced
271:fb9c28a4676b | 272:733006bdbca2 |
---|---|
1 /***** Scope.h *****/ | |
2 #ifndef __Scope_H_INCLUDED__ | |
3 #define __Scope_H_INCLUDED__ | |
4 | |
5 #include <OSCServer.h> | |
6 #include <OSCClient.h> | |
7 #include <stdarg.h> | |
8 | |
9 #define OSC_RECIEVE_PORT 8675 | |
10 #define OSC_SEND_PORT 8676 | |
11 #define SCOPE_UDP_PORT 8677 | |
12 | |
13 #define FRAMES_STORED 2 | |
14 | |
15 class Scope{ | |
16 public: | |
17 Scope(); | |
18 | |
19 void setup(unsigned int numChannels, float sampleRate); | |
20 void log(float chn1, ...); | |
21 bool trigger(); | |
22 | |
23 private: | |
24 OSCServer oscServer; | |
25 OSCClient oscClient; | |
26 UdpClient socket; | |
27 | |
28 void parseMessage(oscpkt::Message); | |
29 void start(); | |
30 void stop(); | |
31 void doTrigger(); | |
32 void triggerNormal(); | |
33 void triggerAuto(); | |
34 void scheduleSendBufferTask(); | |
35 void sendBuffer(); | |
36 void customTrigger(); | |
37 bool triggered(); | |
38 | |
39 // settings | |
40 int numChannels; | |
41 float sampleRate; | |
42 int connected; | |
43 int frameWidth; | |
44 int triggerMode; | |
45 int triggerChannel; | |
46 int triggerDir; | |
47 float triggerLevel; | |
48 int xOffset; | |
49 int upSampling; | |
50 int downSampling; | |
51 float holdOff; | |
52 | |
53 int channelWidth; | |
54 int downSampleCount; | |
55 int holdOffSamples; | |
56 | |
57 // buffers | |
58 std::vector<float> buffer; | |
59 std::vector<float> outBuffer; | |
60 | |
61 // pointers | |
62 int writePointer; | |
63 int readPointer; | |
64 int triggerPointer; | |
65 int customTriggerPointer; | |
66 | |
67 // trigger status | |
68 bool triggerPrimed; | |
69 bool triggerCollecting; | |
70 bool triggerWaiting; | |
71 bool triggering; | |
72 int triggerCount; | |
73 int autoTriggerCount; | |
74 bool started; | |
75 bool customTriggered; | |
76 | |
77 // aux tasks | |
78 AuxiliaryTask scopeTriggerTask; | |
79 static void triggerTask(void*); | |
80 | |
81 AuxiliaryTask scopeSendBufferTask; | |
82 static void sendBufferTask(void*); | |
83 | |
84 }; | |
85 | |
86 #endif |