/
telex.h
303 lines (258 loc) · 7.8 KB
/
telex.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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
#ifndef _OPS_TELEX_H_
#define _OPS_TELEX_H_
#include "ops/op.h"
// operators
// TXo Operators
extern const tele_op_t op_TO_TR;
extern const tele_op_t op_TO_TR_TOG;
extern const tele_op_t op_TO_TR_PULSE;
extern const tele_op_t op_TO_TR_TIME;
extern const tele_op_t op_TO_TR_TIME_S;
extern const tele_op_t op_TO_TR_TIME_M;
extern const tele_op_t op_TO_TR_POL;
extern const tele_op_t op_TO_TR_PULSE_DIV;
extern const tele_op_t op_TO_TR_PULSE_MUTE;
extern const tele_op_t op_TO_TR_M_MUL;
extern const tele_op_t op_TO_M;
extern const tele_op_t op_TO_M_S;
extern const tele_op_t op_TO_M_M;
extern const tele_op_t op_TO_M_BPM;
extern const tele_op_t op_TO_M_ACT;
extern const tele_op_t op_TO_M_SYNC;
extern const tele_op_t op_TO_M_COUNT;
extern const tele_op_t op_TO_TR_M;
extern const tele_op_t op_TO_TR_M_S;
extern const tele_op_t op_TO_TR_M_M;
extern const tele_op_t op_TO_TR_M_BPM;
extern const tele_op_t op_TO_TR_M_ACT;
extern const tele_op_t op_TO_TR_M_SYNC;
extern const tele_op_t op_TO_TR_M_SYNC;
extern const tele_op_t op_TO_TR_WIDTH;
extern const tele_op_t op_TO_TR_M_COUNT;
extern const tele_op_t op_TO_KILL;
extern const tele_op_t op_TO_CV;
extern const tele_op_t op_TO_CV_SLEW;
extern const tele_op_t op_TO_CV_SLEW_S;
extern const tele_op_t op_TO_CV_SLEW_M;
extern const tele_op_t op_TO_CV_SET;
extern const tele_op_t op_TO_CV_OFF;
extern const tele_op_t op_TO_CV_QT;
extern const tele_op_t op_TO_CV_QT_SET;
extern const tele_op_t op_TO_CV_N;
extern const tele_op_t op_TO_CV_N_SET;
extern const tele_op_t op_TO_CV_SCALE;
extern const tele_op_t op_TO_CV_LOG;
extern const tele_op_t op_TO_OSC;
extern const tele_op_t op_TO_OSC_SET;
extern const tele_op_t op_TO_OSC_QT;
extern const tele_op_t op_TO_OSC_QT_SET;
extern const tele_op_t op_TO_OSC_FQ;
extern const tele_op_t op_TO_OSC_FQ_SET;
extern const tele_op_t op_TO_OSC_N;
extern const tele_op_t op_TO_OSC_N_SET;
extern const tele_op_t op_TO_OSC_LFO;
extern const tele_op_t op_TO_OSC_LFO_SET;
extern const tele_op_t op_TO_OSC_WAVE;
extern const tele_op_t op_TO_OSC_SYNC;
extern const tele_op_t op_TO_OSC_PHASE;
extern const tele_op_t op_TO_OSC_WIDTH;
extern const tele_op_t op_TO_OSC_RECT;
extern const tele_op_t op_TO_OSC_SLEW;
extern const tele_op_t op_TO_OSC_SLEW_S;
extern const tele_op_t op_TO_OSC_SLEW_M;
extern const tele_op_t op_TO_OSC_SCALE;
extern const tele_op_t op_TO_OSC_CYC;
extern const tele_op_t op_TO_OSC_CYC_S;
extern const tele_op_t op_TO_OSC_CYC_M;
extern const tele_op_t op_TO_OSC_CYC_SET;
extern const tele_op_t op_TO_OSC_CYC_S_SET;
extern const tele_op_t op_TO_OSC_CYC_M_SET;
extern const tele_op_t op_TO_OSC_CTR;
extern const tele_op_t op_TO_ENV_ACT;
extern const tele_op_t op_TO_ENV_ATT;
extern const tele_op_t op_TO_ENV_ATT_S;
extern const tele_op_t op_TO_ENV_ATT_M;
extern const tele_op_t op_TO_ENV_DEC;
extern const tele_op_t op_TO_ENV_DEC_S;
extern const tele_op_t op_TO_ENV_DEC_M;
extern const tele_op_t op_TO_ENV_TRIG;
extern const tele_op_t op_TO_ENV_EOR;
extern const tele_op_t op_TO_ENV_EOC;
extern const tele_op_t op_TO_ENV_LOOP;
extern const tele_op_t op_TO_CV_INIT;
extern const tele_op_t op_TO_TR_INIT;
extern const tele_op_t op_TO_INIT;
extern const tele_op_t op_TO_TR_P;
extern const tele_op_t op_TO_TR_P_DIV;
extern const tele_op_t op_TO_TR_P_MUTE;
extern const tele_op_t op_TO_TR_P_MUL;
extern const tele_op_t op_TO_ENV;
extern const tele_op_t op_TO_CV_CALIB;
extern const tele_op_t op_TO_CV_RESET;
// TXi Operators
extern const tele_op_t op_TI_PARAM;
extern const tele_op_t op_TI_PARAM_QT;
extern const tele_op_t op_TI_PARAM_N;
extern const tele_op_t op_TI_PARAM_SCALE;
extern const tele_op_t op_TI_PARAM_MAP;
extern const tele_op_t op_TI_IN;
extern const tele_op_t op_TI_IN_QT;
extern const tele_op_t op_TI_IN_N;
extern const tele_op_t op_TI_IN_SCALE;
extern const tele_op_t op_TI_IN_MAP;
extern const tele_op_t op_TI_PARAM_CALIB;
extern const tele_op_t op_TI_IN_CALIB;
extern const tele_op_t op_TI_STORE;
extern const tele_op_t op_TI_RESET;
extern const tele_op_t op_TI_PARAM_INIT;
extern const tele_op_t op_TI_IN_INIT;
extern const tele_op_t op_TI_INIT;
extern const tele_op_t op_TI_PRM;
extern const tele_op_t op_TI_PRM_QT;
extern const tele_op_t op_TI_PRM_N;
extern const tele_op_t op_TI_PRM_SCALE;
extern const tele_op_t op_TI_PRM_MAP;
extern const tele_op_t op_TI_PRM_CALIB;
extern const tele_op_t op_TI_PRM_INIT;
// helpers
void SendIt(uint8_t address, uint8_t command, uint8_t port, int16_t value,
bool set);
void TXSend(uint8_t model, uint8_t command, uint8_t output, int16_t value,
bool set);
void TXCmd(uint8_t model, uint8_t command, uint8_t output);
void TXSet(uint8_t model, uint8_t command, command_state_t *cs);
void ReceiveIt(uint8_t address, uint8_t port, command_state_t *cs);
int16_t ReceiveValue(uint8_t address, uint8_t port);
void TXDeviceSet(uint8_t model, uint8_t command, command_state_t *cs);
void TXReceive(uint8_t model, command_state_t *cs, uint8_t mode, bool shift);
uint8_t DeviceToOutput(int16_t device);
// temporary init functions
void INInit(uint8_t input);
void PRMInit(uint8_t input);
// constants
// TELEXo
#define TO 0x60
#define TO_0 0x60
#define TO_1 0x61
#define TO_2 0x62
#define TO_3 0x63
#define TO_4 0x64
#define TO_5 0x65
#define TO_6 0x66
#define TO_7 0x67
// TXo Commands
#define TO_TR 0x00
#define TO_TR_TOG 0x01
#define TO_TR_TIME 0x02
#define TO_TR_TIME_S 0x03
#define TO_TR_TIME_M 0x04
#define TO_TR_PULSE 0x05
#define TO_TR_POL 0x06
#define TO_TR_PULSE_DIV 0x07
#define TO_TR_M 0x08
#define TO_TR_M_S 0x09
#define TO_TR_M_M 0x0A
#define TO_TR_M_BPM 0x0B
#define TO_TR_M_ACT 0x0C
#define TO_TR_M_SYNC 0x0D
#define TO_TR_WIDTH 0x0E
#define TO_TR_M_COUNT 0x0F
#define TO_CV 0x10
#define TO_CV_SET 0x11
#define TO_CV_SLEW 0x12
#define TO_CV_SLEW_S 0x13
#define TO_CV_SLEW_M 0x14
#define TO_CV_OFF 0x15
#define TO_TR_PULSE_MUTE 0x16
#define TO_TR_M_MUL 0x17
#define TO_M 0x18
#define TO_M_S 0x19
#define TO_M_M 0x1A
#define TO_M_BPM 0x1B
#define TO_M_ACT 0x1C
#define TO_M_SYNC 0x1D
#define TO_M_COUNT 0x1E
#define TO_KILL 0x20
// #define TO_RESET 0x21
#define TO_TR_INIT 0x22
#define TO_CV_INIT 0x23
#define TO_INIT 0x24
#define TO_CV_QT 0x30
#define TO_CV_QT_SET 0x31
#define TO_CV_N 0x32
#define TO_CV_N_SET 0x33
#define TO_CV_SCALE 0x34
#define TO_CV_LOG 0x35
#define TO_OSC 0x40
#define TO_OSC_SET 0x41
#define TO_OSC_QT 0x42
#define TO_OSC_QT_SET 0x43
#define TO_OSC_FQ 0x44
#define TO_OSC_FQ_SET 0x45
#define TO_OSC_N 0x46
#define TO_OSC_N_SET 0x47
#define TO_OSC_LFO 0x48
#define TO_OSC_LFO_SET 0x49
#define TO_OSC_WAVE 0x4A
#define TO_OSC_SYNC 0x4B
#define TO_OSC_WIDTH 0x4C
#define TO_OSC_RECT 0x4D
#define TO_OSC_SCALE 0x4E
#define TO_OSC_SLEW 0x4F
#define TO_OSC_SLEW_S 0x50
#define TO_OSC_SLEW_M 0x51
#define TO_OSC_TR_ACT 0x52
#define TO_OSC_PHASE 0x53
#define TO_OSC_CYC 0x54
#define TO_OSC_CYC_S 0x55
#define TO_OSC_CYC_M 0x56
#define TO_OSC_CYC_SET 0x57
#define TO_OSC_CYC_S_SET 0x58
#define TO_OSC_CYC_M_SET 0x59
#define TO_OSC_CTR 0x5A
#define TO_ENV_ACT 0x60
#define TO_ENV_ATT 0x61
#define TO_ENV_ATT_S 0x62
#define TO_ENV_ATT_M 0x63
#define TO_ENV_DEC 0x64
#define TO_ENV_DEC_S 0x65
#define TO_ENV_DEC_M 0x66
#define TO_ENV_TRIG 0x67
#define TO_ENV_CYC 0x68
#define TO_ENV_BPOL 0x69
#define TO_ENV_EOR 0x6A
#define TO_ENV_EOC 0x6B
#define TO_ENV_LOOP 0x6C
#define TO_ENV 0x6D
#define TO_CV_CALIB 0x6E
#define TO_CV_RESET 0x6F
// TELEXi
#define TI 0x68
#define TI_0 0x68
#define TI_1 0x69
#define TI_2 0x6A
#define TI_3 0x6B
#define TI_4 0x6C
#define TI_5 0x6D
#define TI_6 0x6E
#define TI_7 0x6F
// TXi Commands
#define TI_IN 0x00
#define TI_IN_QT 0x01
#define TI_IN_N 0x02
#define TI_IN_SCALE 0x03
#define TI_IN_TOP 0x04
#define TI_IN_BOT 0x05
#define TI_IN_MAP 0x06
#define TI_PARAM 0x10
#define TI_PARAM_QT 0x11
#define TI_PARAM_N 0x12
#define TI_PARAM_SCALE 0x13
#define TI_PARAM_TOP 0x14
#define TI_PARAM_BOT 0x15
#define TI_PARAM_MAP 0x16
#define TI_IN_CALIB 0x20
#define TI_PARAM_CALIB 0x21
#define TI_STORE 0x22
#define TI_RESET 0x23
#endif