Scope.h
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_RECEIVE_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 
25  void setup(unsigned int numChannels, float sampleRate);
26 
34  void log(float chn1, ...);
35 
41  void log(float* values);
42  bool trigger();
43 
44  private:
45  OSCServer oscServer;
46  OSCClient oscClient;
47  UdpClient socket;
48 
49  void parseMessage(oscpkt::Message);
50  void start();
51  void stop();
52  void doTrigger();
53  void triggerNormal();
54  void triggerAuto();
55  void scheduleSendBufferTask();
56  void sendBuffer();
57  void customTrigger();
58  bool triggered();
59 
60  // settings
61  int numChannels;
62  float sampleRate;
63  int connected;
64  int frameWidth;
65  int triggerMode;
66  int triggerChannel;
67  int triggerDir;
68  float triggerLevel;
69  int xOffset;
70  int upSampling;
71  int downSampling;
72  float holdOff;
73 
74  int channelWidth;
75  int downSampleCount;
76  int holdOffSamples;
77 
78  // buffers
79  std::vector<float> buffer;
80  std::vector<float> outBuffer;
81 
82  // pointers
83  int writePointer;
84  int readPointer;
85  int triggerPointer;
86  int customTriggerPointer;
87 
88  // trigger status
89  bool triggerPrimed;
90  bool triggerCollecting;
91  bool triggerWaiting;
92  bool triggering;
93  int triggerCount;
94  int autoTriggerCount;
95  bool started;
96  bool customTriggered;
97 
98  // aux tasks
99  AuxiliaryTask scopeTriggerTask;
100  static void triggerTask(void*);
101 
102  AuxiliaryTask scopeSendBufferTask;
103  static void sendBufferTask(void*);
104 
105 };
106 
107 #endif
void setup(unsigned int numChannels, float sampleRate)
void log(float chn1,...)
Definition: OSCClient.h:23
Definition: OSCServer.h:13
Definition: UdpClient.h:21
void * AuxiliaryTask
Definition: Bela.h:289
Definition: Scope.h:15