Mercurial > hg > beaglert
annotate include/Scope.h @ 511:633ade85e798 prerelease
Cleared build_pd_heavy
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Wed, 22 Jun 2016 04:53:06 +0100 |
parents | 506a319c08cf |
children |
rev | line source |
---|---|
l@272 | 1 /***** Scope.h *****/ |
l@272 | 2 #ifndef __Scope_H_INCLUDED__ |
l@272 | 3 #define __Scope_H_INCLUDED__ |
l@272 | 4 |
l@272 | 5 #include <OSCServer.h> |
l@272 | 6 #include <OSCClient.h> |
l@272 | 7 #include <stdarg.h> |
l@272 | 8 |
giuliomoro@475 | 9 #define OSC_RECEIVE_PORT 8675 |
l@272 | 10 #define OSC_SEND_PORT 8676 |
l@272 | 11 #define SCOPE_UDP_PORT 8677 |
l@272 | 12 |
l@272 | 13 #define FRAMES_STORED 2 |
l@272 | 14 |
l@272 | 15 class Scope{ |
l@272 | 16 public: |
l@272 | 17 Scope(); |
l@272 | 18 |
giuliomoro@485 | 19 /** |
giuliomoro@485 | 20 * Setup the Scope. |
giuliomoro@485 | 21 * |
giuliomoro@485 | 22 * @param numChannels number of channels in the scope. |
giuliomoro@485 | 23 * @param sampleRate sampleRate of the data passed in. |
giuliomoro@485 | 24 */ |
l@272 | 25 void setup(unsigned int numChannels, float sampleRate); |
giuliomoro@485 | 26 |
giuliomoro@485 | 27 /** |
giuliomoro@485 | 28 * Logs a frame of data to the scope. |
giuliomoro@485 | 29 * |
giuliomoro@485 | 30 * Pass one argument per channel (starting from the first), up to the |
giuliomoro@485 | 31 * number of channels of the object. |
giuliomoro@485 | 32 * Omitted values will be set to 0. |
giuliomoro@485 | 33 */ |
l@272 | 34 void log(float chn1, ...); |
giuliomoro@485 | 35 |
giuliomoro@485 | 36 /** |
giuliomoro@485 | 37 * Logs a frame of data to the scope. |
giuliomoro@485 | 38 * |
giuliomoro@485 | 39 * @param values a pointer to an array containing numChannels values. |
giuliomoro@485 | 40 */ |
giuliomoro@485 | 41 void log(float* values); |
l@272 | 42 bool trigger(); |
l@272 | 43 |
l@272 | 44 private: |
l@272 | 45 OSCServer oscServer; |
l@272 | 46 OSCClient oscClient; |
l@272 | 47 UdpClient socket; |
l@272 | 48 |
l@272 | 49 void parseMessage(oscpkt::Message); |
l@272 | 50 void start(); |
l@272 | 51 void stop(); |
l@272 | 52 void doTrigger(); |
l@272 | 53 void triggerNormal(); |
l@272 | 54 void triggerAuto(); |
l@272 | 55 void scheduleSendBufferTask(); |
l@272 | 56 void sendBuffer(); |
l@272 | 57 void customTrigger(); |
l@272 | 58 bool triggered(); |
l@272 | 59 |
l@272 | 60 // settings |
l@272 | 61 int numChannels; |
l@272 | 62 float sampleRate; |
l@272 | 63 int connected; |
l@272 | 64 int frameWidth; |
l@272 | 65 int triggerMode; |
l@272 | 66 int triggerChannel; |
l@272 | 67 int triggerDir; |
l@272 | 68 float triggerLevel; |
l@272 | 69 int xOffset; |
l@272 | 70 int upSampling; |
l@272 | 71 int downSampling; |
l@272 | 72 float holdOff; |
l@272 | 73 |
l@272 | 74 int channelWidth; |
l@272 | 75 int downSampleCount; |
l@272 | 76 int holdOffSamples; |
l@272 | 77 |
l@272 | 78 // buffers |
l@272 | 79 std::vector<float> buffer; |
l@272 | 80 std::vector<float> outBuffer; |
l@272 | 81 |
l@272 | 82 // pointers |
l@272 | 83 int writePointer; |
l@272 | 84 int readPointer; |
l@272 | 85 int triggerPointer; |
l@272 | 86 int customTriggerPointer; |
l@272 | 87 |
l@272 | 88 // trigger status |
l@272 | 89 bool triggerPrimed; |
l@272 | 90 bool triggerCollecting; |
l@272 | 91 bool triggerWaiting; |
l@272 | 92 bool triggering; |
l@272 | 93 int triggerCount; |
l@272 | 94 int autoTriggerCount; |
l@272 | 95 bool started; |
l@272 | 96 bool customTriggered; |
l@272 | 97 |
l@272 | 98 // aux tasks |
l@272 | 99 AuxiliaryTask scopeTriggerTask; |
l@272 | 100 static void triggerTask(void*); |
l@272 | 101 |
l@272 | 102 AuxiliaryTask scopeSendBufferTask; |
l@272 | 103 static void sendBufferTask(void*); |
l@272 | 104 |
l@272 | 105 }; |
l@272 | 106 |
giuliomoro@485 | 107 #endif |