forked from ChrisVeigl/BrainBay
-
Notifications
You must be signed in to change notification settings - Fork 1
/
base.h
177 lines (140 loc) · 4.51 KB
/
base.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
/* -----------------------------------------------------------------------------
BrainBay - Version 1.7, GPL 2003-2010
OpenSource Application for realtime BodySignalProcessing & HCI
with the OpenEEG hardware
Author: Chris Veigl, contact: chris@shifz.org
Co-Authors:
Jeremy Wilkerson (Modules: AND, OR, NOT, WAV, CORELLATION, EVALUATOR)
Lester John (Module MATLAB-transfer)
Credits: Jim Peters (digital filter works), Jeff Molofee (OpenGL-tutorial), John Roark (SkinDialog)
AllenD (COM-Port control), Aleksandar B. Samardz (Expression Evaluator Library)
the used non-standard Libraries are:
Multimedia and OpenGL: winmm.lib opengl32.lib glu32.lib vfw32.lib glaux.lib
SDL (Simple Direct Media Layer): SDL.lib SDL_net.lib SDL_sound.lib modplug.lib
OpenCV - Intels's Computer Vision Library: cv.lib cvcam.lib cxcore.lib highgui.lib
Matlab Engine (only in special Matlab Release): libeng.lib libmx.lib
Jim Peters's Filter Library: fidlib.lib (http://uazu.net)
Skinned Dialog by John Roark: skinstyle.lib (http://www.codeproject.com/dialog/skinstyle.asp)
GNU LibMatheval by Aleksandar B. Samardz: matheval.lib (http://www.gnu.org/software/libmatheval)
Project-Site: http://brainbay.lo-res.org
Link to the OpenEEG-Project: http://openeeg.sf.net
-------------------------------------------------------------------------------------
base.h: contains the declaration of the base - class
the base class provides properties like the position in the GUI,
the number of in- and outports and the pass_value() - function, which copies
a specified value to the in-ports of the linked objects
-----------------------------------------------------------------------------*/
// array bounds for objects and connections
#define MAX_CONNECTS 50
#define MAX_PORTS 32
#define MAX_EEG_CHANNELS 32
#define MAX_OBJECTS 150
// Signal value definitions
#define TRUE_VALUE 512
#define INVALID_VALUE -32767
// default sampling rate
#define DEF_PACKETSPERSECOND 256
// default refresh rates
#define DIALOG_UPDATETIME 50
#define DRAW_UPDATETIME 20
void report_error( char * Message );
extern class BASE_CL * objects[MAX_OBJECTS];
extern class BASE_CL * actobject;
extern class BASE_CL * copy_object;
extern int actport;
extern struct LINKStruct * actconnect;
typedef struct OUTPORTStruct
{
char out_name[20];
char out_desc[50];
float out_min;
float out_max;
char out_dim[10];
int get_range;
} OUTPORTStruct ;
typedef struct INPORTStruct
{
char in_name[20];
char in_desc[50];
float in_min;
float in_max;
char in_dim[10];
int get_range;
float value;
} INPORTStruct ;
typedef struct LINKStruct
{
int from_object;
int from_port;
int to_object;
int to_port;
float min;
float max;
char dimension[10];
char description[50];
int visited;
} LINKStruct ;
class BASE_CL
{
public:
int type;
size_t object_size;
int inports;
int outports;
int xPos;
int yPos;
int width;
int height;
char tag[30];
HWND displayWnd;
OUTPORTStruct out_ports[MAX_PORTS];
INPORTStruct in_ports[MAX_PORTS];
LINKStruct out[MAX_CONNECTS];
HWND hDlg;
BASE_CL (void)
{
int i;
width=0; height=0; displayWnd=NULL;
tag[0]=0;
for (i=0;i<MAX_PORTS;i++)
{
in_ports[i].in_name[0]=0;
strcpy(in_ports[i].in_desc,"none");
in_ports[i].in_min=-1.0f;
in_ports[i].in_max=1.0f;
strcpy(in_ports[i].in_dim,"none");
in_ports[i].get_range=1;
out_ports[i].out_name[0]=0;
strcpy(out_ports[i].out_desc,"none");
out_ports[i].out_min=-1.0f;
out_ports[i].out_max=1.0f;
strcpy(out_ports[i].out_dim,"none");
out_ports[i].get_range=0;
}
for (i=0;i<MAX_CONNECTS;i++)
{ out[i].min=-1.0f;
out[i].max=1.0f;
strcpy(out[i].dimension,"none");
strcpy(out[i].description,"none");
}
}
virtual ~BASE_CL (void) {}
virtual void work (void) {}
virtual void update_inports (void) {}
virtual void session_start (void) {}
virtual void session_stop (void) {}
virtual void session_reset (void) {}
virtual void session_pos (long pos) {}
virtual long session_length (void) { return 0; }
virtual void make_dialog (void) {}
virtual void load (HANDLE hFile) {}
virtual void save (HANDLE hFile) {}
virtual void incoming_data(int port, float value) {}
void pass_values (int port, float value)
{
LINKStruct * act_link;
for (act_link=&(out[0]);act_link->to_port!=-1;act_link++)
if (act_link->from_port==port)
objects[act_link->to_object]->incoming_data(act_link->to_port, value );
}
};