Subversion Repositories DIN Is Noise

Rev

Rev 1528 | Rev 1712 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1528 jag 1
/*
2
* command.h
3
* DIN Is Noise is copyright (c) 2006-2020 Jagannathan Sampath
4
* For more information, please visit https://dinisnoise.org/
5
*/
6
 
7
 
8
#ifndef __command
9
#define __command
10
 
11
#include "help.h"
12
 
13
struct tokenizer;
14
 
15
struct command {
16
 
17
  std::string longname;
18
  std::string shortname;
19
 
20
  command (const std::string& ln, const std::string& sn) : longname (ln), shortname (sn) {}
21
  virtual int operator() (tokenizer& tz) { return 1; }
22
  virtual ~command () {}
23
 
24
};
25
 
26
struct cmdlist {
27
 
28
  std::vector<command*> cmds;
29
  int ncmds;
30
 
31
  std::string result; // holds last run command output
32
 
33
  void add (command* cmd);
34
  ~cmdlist ();
35
 
36
};
37
 
38
extern cmdlist cmdlst;
39
 
40
struct din;
41
struct i_binaural_drones;
42
 
43
struct set_var : command { // set var
44
  din* d;
45
  set_var (din* dd, const std::string& ln, const std::string& sn) : command (ln, sn), d(dd) {}
46
  int operator() (tokenizer& tz);
47
  int set_scroll (std::string& varn, tokenizer& tz);
48
  int set_zoom_pan (int& rate, float& amount, std::string& varn, tokenizer& tz);
49
  ~set_var () {}
50
};
51
 
52
struct get_var : command { // get var
53
  din* d;
54
  get_var (din* dd, const std::string& ln, const std::string& sn) : command (ln, sn), d(dd) {}
55
  int operator() (tokenizer& tz);
56
  ~get_var () {}
57
};
58
 
59
struct delay;
60
struct set_delay: command { // set delay time
61
  delay* left;
62
  delay* right;
63
  set_delay (delay* l, delay* r, const std::string& ln, const std::string& sn) : command (ln, sn), left(l), right(r) {}
64
  int operator() (tokenizer& tz);
65
  ~set_delay () {}
66
};
67
 
68
struct get_delay: command { // get delay time
69
  delay* left;
70
  delay* right;
71
  get_delay (delay* l, delay* r, const std::string& ln, const std::string& sn) : command (ln, sn), left(l), right(r) {}
72
  int operator() (tokenizer& tz);
73
  ~get_delay () {}
74
};
75
 
76
struct beat2value;
77
 
78
// bpm
79
//
80
struct bpm_com {
81
  static const int NUM = 4;
82
  static const char* str [NUM];
83
  static beat2value* bv [NUM];
84
  int get_bpm_id_from_name (const std::string& name);
85
};
86
 
87
struct ls_bpm: command, bpm_com { // list bpmable components
88
  ls_bpm (const std::string& ln, const std::string& sn) : command (ln, sn) {}
89
  int operator() (tokenizer& tz);
90
  ~ls_bpm () {}
91
};
92
 
93
struct set_bpm: command, bpm_com {
94
  set_bpm (const std::string& ln, const std::string& sn) : command (ln, sn) {}
95
  int operator() (tokenizer& tz);
96
  ~set_bpm () {}
97
};
98
 
99
struct get_bpm: command, bpm_com {
100
  get_bpm (const std::string& ln, const std::string& sn) : command (ln, sn) {}
101
  int operator() (tokenizer& tz);
102
  ~get_bpm () {}
103
};
104
 
105
struct set_style : command, bpm_com {
106
  set_style (const std::string& ln, const std::string& sn) : command (ln, sn) {}
107
  int operator() (tokenizer& tz);
108
  ~set_style () {}
109
};
110
 
111
struct get_style : command, bpm_com {
112
  get_style (const std::string& ln, const std::string& sn) : command (ln, sn) {}
113
  int operator() (tokenizer& tz);
114
  ~get_style () {}
115
};
116
 
117
struct set_beat : command, bpm_com {
118
  set_beat (const std::string& ln, const std::string& sn) : command (ln, sn) {}
119
  int operator() (tokenizer& tz);
120
  ~set_beat () {}
121
};
122
 
123
struct get_beat : command, bpm_com {
124
  get_beat (const std::string& ln, const std::string& sn) : command (ln, sn) {}
125
  int operator() (tokenizer& tz);
126
  ~get_beat () {}
127
};
128
 
129
struct add_scale: command {
130
  add_scale (const std::string& ln, const std::string& sn) : command (ln, sn) {}
131
  int operator () (tokenizer& tz);
132
  ~add_scale () {}
133
};
134
 
135
struct remove_scale : command {
136
  remove_scale (const std::string& ln, const std::string& sn) : command (ln, sn) {}
137
  int operator () (tokenizer& tz);
138
  ~remove_scale () {}
139
};
140
 
141
struct ls_scales: command {
142
  ls_scales (const std::string& ln, const std::string& sn) : command (ln, sn) {}
143
  int operator () (tokenizer& tz);
144
  ~ls_scales () {}
145
};
146
 
147
struct ls_notes: command {
148
  ls_notes (const std::string& ln, const std::string& sn) : command (ln, sn) {}
149
  int operator () (tokenizer& tz);
150
  ~ls_notes () {}
151
};
152
 
153
struct load_scale : command {
154
  din* d;
155
  int reentry;
156
  load_scale (din* dd, const std::string& ln, const std::string& sn) : command (ln, sn), d(dd) {}
157
  int operator () (tokenizer& tz);
158
  ~load_scale () {}
159
};
160
 
161
struct key : command {
162
  din* d;
163
  key (din* dd, const std::string& ln, const std::string& sn) : command (ln, sn), d(dd) {}
164
  int operator() (tokenizer& tz);
165
  ~key () {}
166
};
167
 
168
struct notation : command {
169
  din* d;
170
  notation (din* dd, const std::string& ln, const std::string& sn) : command (ln, sn), d(dd) {}
171
  int operator() (tokenizer& tz);
172
  ~notation () {}
173
};
174
 
175
struct note_distance: command {
176
  note_distance (const std::string& ln, const std::string& sn) : command (ln, sn) {}
177
  int operator() (tokenizer& tz);
178
  ~note_distance () {}
179
};
180
 
181
struct chord: command {
182
  chord (const std::string& ln, const std::string& sn) : command (ln, sn) {}
183
  int operator() (tokenizer& tz);
184
  ~chord () {}
185
};
186
 
187
struct set_font_size: command {
188
  set_font_size (const std::string& ln, const std::string& sn) : command (ln, sn) {}
189
  int operator() (tokenizer& tz);
190
  ~set_font_size () {}
191
};
192
 
193
struct get_font_size: command {
194
  get_font_size (const std::string& ln, const std::string& sn) : command (ln, sn) {}
195
  int operator() (tokenizer& tz);
196
  ~get_font_size () {}
197
};
198
 
199
struct set_kern: command {
200
  set_kern (const std::string& ln, const std::string& sn) : command (ln, sn) {}
201
  int operator() (tokenizer& tz);
202
  ~set_kern () {}
203
};
204
 
205
struct get_kern: command {
206
  get_kern (const std::string& ln, const std::string& sn) : command (ln, sn) {}
207
  int operator() (tokenizer& tz);
208
  ~get_kern () {}
209
};
210
 
211
struct curve_name : command { // change picked curve name
212
  curve_name (const std::string& ln, const std::string& sn) : command (ln, sn) {}
213
  int operator() (tokenizer& tz);
214
  ~curve_name () {}
215
};
216
 
217
struct scale_curve : command {
218
  scale_curve (const std::string& ln, const std::string& sn) : command (ln, sn) {}
219
  int operator() (tokenizer& tz);
220
  ~scale_curve () {}
221
};
222
 
223
 
224
struct multi_curve;
225
 
226
struct paste_gater: command {
227
  paste_gater (const std::string& ln, const std::string& sn) : command (ln, sn) {}
228
  int operator() (tokenizer& tz);
229
  ~paste_gater () {}
230
};
231
 
232
struct curve_value : command { // change curve value (vertex, tangent)
233
  curve_value (const std::string& ln, const std::string& sn) : command (ln, sn) {}
234
  ~curve_value () {}
235
  int operator() (tokenizer& tz);
236
};
237
 
238
struct curve__library : command { // edit curve library attached to current curve editor
239
  curve__library (const std::string& ln, const std::string& sn) : command (ln, sn) {}
240
  int operator() (tokenizer& tz);
241
  ~curve__library () {}
242
};
243
 
244
struct set_curve_editor : command {
245
  set_curve_editor (const std::string& ln, const std::string& sn) : command (ln, sn) {}
246
  int operator() (tokenizer& tz);
247
  ~set_curve_editor () {}
248
};
249
 
250
struct set_scope : command {
251
  din* d;
252
  i_binaural_drones* sb;
253
  set_scope (const std::string& ln, const std::string& sn, din* _d, i_binaural_drones* _sb) : command (ln, sn), d(_d), sb(_sb) {}
254
  int operator() (tokenizer& tz);
255
  ~set_scope () {}
256
};
257
 
258
struct get_scope : command {
259
  din* d;
260
  get_scope (const std::string& ln, const std::string& sn, din* dd) : command (ln, sn), d(dd) {}
261
  int operator() (tokenizer& tz);
262
  ~get_scope () {}
263
};
264
 
265
struct echo : command {
266
  echo (const std::string& ln, const std::string& sn) : command (ln, sn) {}
267
  int operator() (tokenizer& tz);
268
  ~echo () {}
269
};
270
 
271
struct set_text_color: command {
272
  set_text_color (const std::string& ln, const std::string& sn) : command (ln, sn) {}
273
  int operator() (tokenizer& tz);
274
  ~set_text_color () {}
275
};
276
 
277
struct get_selection : command {
278
  get_selection (const std::string& ln, const std::string& sn) : command (ln, sn) {}
279
  int operator() (tokenizer& tz);
280
  ~get_selection () {}
281
};
282
 
283
struct set_drone : command {
284
  din& d;
285
  set_drone (const std::string& ln, const std::string& sn, din& dd) : command (ln, sn), d(dd) {}
286
  int operator() (tokenizer& tz);
287
  ~set_drone () {}
288
};
289
 
290
struct get_drone : command {
291
  din& d;
292
  get_drone (const std::string& ln, const std::string& sn, din& dd) : command (ln, sn), d(dd) {}
293
  int operator() (tokenizer& tz);
294
  ~get_drone () {}
295
};
296
 
297
struct get_intervals : command {
298
  get_intervals (const std::string& ln, const std::string& sn) : command (ln, sn) {}
299
  int operator() (tokenizer& tz);
300
  ~get_intervals () {}
301
};
302
 
303
struct num_octaves : command {
304
  din& d;
305
  num_octaves (const std::string& ln, const std::string& sn, din& dd) : command (ln, sn), d(dd) {}
306
  int operator() (tokenizer& tz);
307
  ~num_octaves () {}
308
};
309
 
310
struct set_kb_layout : command {
311
  std::string layout;
312
  set_kb_layout (const std::string& ln, const std::string& sn) : command (ln, sn), layout ("us") {}
313
  int operator() (tokenizer& tz);
314
  ~set_kb_layout () {}
315
};
316
 
317
struct list_midi : command {
318
  list_midi (const std::string& ln, const std::string& sn) : command (ln, sn) {}
319
  int operator() (tokenizer& tz);
320
  ~list_midi () {}
321
};
322
 
323
struct set_midi : command {
324
  set_midi (const std::string& ln, const std::string& sn) : command (ln, sn) {}
325
  int operator() (tokenizer& tz);
326
  ~set_midi () {}
327
};
328
 
329
struct set_audio : command {
330
  set_audio (const std::string& ln, const std::string& sn) : command (ln, sn) {}
331
  int operator() (tokenizer& tz);
332
  ~set_audio () {}
333
};
334
 
335
struct gravity : command {
336
  gravity (const std::string& ln, const std::string& sn) : command (ln, sn) {}
337
  int operator() (tokenizer& tz);
338
  ~gravity () {}
339
};
340
 
341
#ifdef __SVG__
1662 jag 342
 
1528 jag 343
struct write_svg : command {
344
  write_svg (const std::string& ln, const std::string& sn) : command (ln, sn) {}
345
  int operator() (tokenizer& tz);
346
  ~write_svg () {}
347
};
1662 jag 348
 
349
struct write_trail : command {
350
  write_trail (const std::string& ln, const std::string& sn) : command (ln, sn) {}
351
  int operator() (tokenizer& tz);
352
  ~write_trail () {}
353
};
354
 
1528 jag 355
#endif
356
 
357
#ifdef __HPGL__
358
struct write_hpgl : command {
359
  write_hpgl (const std::string& ln, const std::string& sn) : command (ln, sn) {}
360
  int operator() (tokenizer& tz);
361
  ~write_hpgl () {}
362
};
363
#endif
364
 
365
struct cmd_binaural_drone : command {
366
  cmd_binaural_drone (const std::string& ln, const std::string& sn) : command (ln, sn) {}
367
  int operator() (tokenizer& tz);
368
  ~cmd_binaural_drone () {}
369
};
370
 
371
struct set_sine_mixer : command {
372
  set_sine_mixer (const std::string& ln, const std::string& sn) : command (ln, sn) {}
373
  int operator() (tokenizer& tz);
374
  ~set_sine_mixer () {}
375
};
376
 
377
struct change_sine_mixer : command {
378
  change_sine_mixer (const std::string& ln, const std::string& sn) : command (ln, sn) {}
379
  int operator() (tokenizer& tz);
380
  ~change_sine_mixer () {}
381
};
382
 
383
struct update_sine_mixer : command {
384
  update_sine_mixer (const std::string& ln, const std::string& sn) : command (ln, sn) {}
385
  int operator() (tokenizer& tz);
386
  ~update_sine_mixer () {}
387
};
388
 
389
 
390
#endif