Subversion Repositories DIN Is Noise

Rev

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