forked from lucasw/vimjay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
signals.h
137 lines (109 loc) · 2.32 KB
/
signals.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#ifndef __SIGNALS_H__
#define __SIGNALS_H__
#include <iostream>
#include <stdio.h>
#include <boost/thread.hpp>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
//#include <random>
#include <deque>
#include <map>
#include "nodes.h"
namespace bm {
class MiscSignal : public Signal
{
cv::RNG rng;
int state;
public:
MiscSignal(const std::string name);
virtual bool update();
virtual bool handleKey(int key);
};
/////////////////////////////////
class SigBuffer : public ImageNode
{
protected:
std::deque<float> sigs;
public:
SigBuffer(const std::string name);
virtual bool update();
virtual bool draw(cv::Point2f ui_offset);
float get(const float fr);
float get(int ind);
//bool writeSignals();
};
class Trig : public Node
{
public:
Trig(const std::string name);
virtual bool update();
//virtual bool handleKey(int key);
};
// Arbitrary inputs, TBD use multiple inheritance
class SigAdd : public Node
{
public:
SigAdd(const std::string name); // : Signal()
virtual bool update();
virtual bool handleKey(int key);
};
class SigGreater : public Signal
{
public:
SigGreater(const std::string name);
virtual bool update();
};
class Mean : public Signal
{
public:
Mean(const std::string name);
virtual bool update();
};
#ifdef NOT_YET_IMPLEMENTED
/////////////////////////////////
class SigFile : public SigBuffer
{
public:
SigFile(const std::string name) {}
std::string file;
bool loadBuffer();
virtual bool load(cv::FileNodeIterator nd);
virtual bool save(cv::FileStorage& fs);
};
///////////////////////////////////////////////////////////
class SigTap : public Signal
{
public:
SigTap(const std::string name);// : Signal()
virtual bool update();
virtual bool draw(cv::Point2f ui_offset);
};
class SigTapInd : public Tap
{
public:
SigTapInd(const std::string name) {}// : Signal()
virtual bool update();
virtual bool draw(cv::Point2f ui_offset);
};
class SigMultiply : public Signal
{
public:
Multiply(const std::string name);
virtual bool update();
};
// Double inputs
class SigAbsDiff : public Signal
{
public:
SigAbsDiff(const std::string name);
virtual bool update();
};
class SigFlip : public Signal
{
public:
SigFlip(const std::string name);
virtual bool update();
};
#endif
} // bm
#endif // MISC_NODES