/[svn]/linuxsampler/trunk/src/engines/common/InstrumentScriptVMFunctions.h
ViewVC logotype

Contents of /linuxsampler/trunk/src/engines/common/InstrumentScriptVMFunctions.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3743 - (show annotations) (download) (as text)
Fri Feb 14 15:35:53 2020 UTC (3 days, 18 hours ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 32425 byte(s)
- Just added some TODO comments.

- Minor white space cleanup.

1 /*
2 * Copyright (c) 2014 - 2020 Christian Schoenebeck
3 *
4 * http://www.linuxsampler.org
5 *
6 * This file is part of LinuxSampler and released under the same terms.
7 * See README file for details.
8 */
9
10 #ifndef LS_INSTRSCRIPTVMFUNCTIONS_H
11 #define LS_INSTRSCRIPTVMFUNCTIONS_H
12
13 #include "../../common/global.h"
14 #include "../../scriptvm/CoreVMFunctions.h"
15 #include "Note.h"
16
17 namespace LinuxSampler {
18
19 class EventGroup;
20 class InstrumentScriptVM;
21
22 class InstrumentScriptVMFunction_play_note FINAL : public VMIntResultFunction {
23 using Super = VMIntResultFunction; // just an alias for the super class
24 public:
25 InstrumentScriptVMFunction_play_note(InstrumentScriptVM* parent);
26 StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; }
27 bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }
28 vmint minRequiredArgs() const OVERRIDE { return 1; }
29 vmint maxAllowedArgs() const OVERRIDE { return 4; }
30 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
31 bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
32 bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
33 void checkArgs(VMFnArgs* args, std::function<void(String)> err,
34 std::function<void(String)> wrn) OVERRIDE;
35 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
36 protected:
37 InstrumentScriptVM* m_vm;
38 };
39
40 class InstrumentScriptVMFunction_set_controller FINAL : public VMIntResultFunction {
41 public:
42 InstrumentScriptVMFunction_set_controller(InstrumentScriptVM* parent);
43 StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; }
44 bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }
45 vmint minRequiredArgs() const OVERRIDE { return 2; }
46 vmint maxAllowedArgs() const OVERRIDE { return 2; }
47 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
48 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
49 protected:
50 InstrumentScriptVM* m_vm;
51 };
52
53 class InstrumentScriptVMFunction_set_rpn FINAL : public VMIntResultFunction {
54 public:
55 InstrumentScriptVMFunction_set_rpn(InstrumentScriptVM* parent);
56 StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; }
57 bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }
58 vmint minRequiredArgs() const OVERRIDE { return 2; }
59 vmint maxAllowedArgs() const OVERRIDE { return 2; }
60 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
61 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
62 protected:
63 InstrumentScriptVM* m_vm;
64 };
65
66 class InstrumentScriptVMFunction_set_nrpn FINAL : public VMIntResultFunction {
67 public:
68 InstrumentScriptVMFunction_set_nrpn(InstrumentScriptVM* parent);
69 StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; }
70 bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }
71 vmint minRequiredArgs() const OVERRIDE { return 2; }
72 vmint maxAllowedArgs() const OVERRIDE { return 2; }
73 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
74 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
75 protected:
76 InstrumentScriptVM* m_vm;
77 };
78
79 class InstrumentScriptVMFunction_ignore_event FINAL : public VMEmptyResultFunction {
80 public:
81 InstrumentScriptVMFunction_ignore_event(InstrumentScriptVM* parent);
82 vmint minRequiredArgs() const OVERRIDE { return 0; }
83 vmint maxAllowedArgs() const OVERRIDE { return 1; }
84 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
85 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
86 protected:
87 InstrumentScriptVM* m_vm;
88 };
89
90 class InstrumentScriptVMFunction_ignore_controller FINAL : public VMEmptyResultFunction {
91 public:
92 InstrumentScriptVMFunction_ignore_controller(InstrumentScriptVM* parent);
93 vmint minRequiredArgs() const OVERRIDE { return 0; }
94 vmint maxAllowedArgs() const OVERRIDE { return 1; }
95 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
96 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
97 protected:
98 InstrumentScriptVM* m_vm;
99 };
100
101 class InstrumentScriptVMFunction_note_off FINAL : public VMEmptyResultFunction {
102 using Super = VMEmptyResultFunction; // just an alias for the super class
103 public:
104 InstrumentScriptVMFunction_note_off(InstrumentScriptVM* parent);
105 vmint minRequiredArgs() const OVERRIDE { return 1; }
106 vmint maxAllowedArgs() const OVERRIDE { return 2; }
107 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
108 void checkArgs(VMFnArgs* args, std::function<void(String)> err,
109 std::function<void(String)> wrn) OVERRIDE;
110 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
111 protected:
112 InstrumentScriptVM* m_vm;
113 };
114
115 class InstrumentScriptVMFunction_set_event_mark FINAL : public VMEmptyResultFunction {
116 using Super = VMEmptyResultFunction; // just an alias for the super class
117 public:
118 InstrumentScriptVMFunction_set_event_mark(InstrumentScriptVM* parent);
119 vmint minRequiredArgs() const OVERRIDE { return 2; }
120 vmint maxAllowedArgs() const OVERRIDE { return 2; }
121 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
122 void checkArgs(VMFnArgs* args, std::function<void(String)> err,
123 std::function<void(String)> wrn) OVERRIDE;
124 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
125 protected:
126 InstrumentScriptVM* m_vm;
127 };
128
129 class InstrumentScriptVMFunction_delete_event_mark FINAL : public VMEmptyResultFunction {
130 using Super = VMEmptyResultFunction; // just an alias for the super class
131 public:
132 InstrumentScriptVMFunction_delete_event_mark(InstrumentScriptVM* parent);
133 vmint minRequiredArgs() const OVERRIDE { return 2; }
134 vmint maxAllowedArgs() const OVERRIDE { return 2; }
135 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
136 void checkArgs(VMFnArgs* args, std::function<void(String)> err,
137 std::function<void(String)> wrn) OVERRIDE;
138 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
139 protected:
140 InstrumentScriptVM* m_vm;
141 };
142
143 class InstrumentScriptVMFunction_by_marks FINAL : public VMFunction {
144 using Super = VMFunction; // just an alias for the super class
145 public:
146 InstrumentScriptVMFunction_by_marks(InstrumentScriptVM* parent);
147 StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; }
148 bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }
149 vmint minRequiredArgs() const OVERRIDE { return 1; }
150 vmint maxAllowedArgs() const OVERRIDE { return 1; }
151 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
152 bool modifiesArg(vmint iArg) const OVERRIDE { return false; }
153 ExprType_t returnType(VMFnArgs* args) OVERRIDE { return INT_ARR_EXPR; }
154 void checkArgs(VMFnArgs* args, std::function<void(String)> err,
155 std::function<void(String)> wrn) OVERRIDE;
156 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
157 protected:
158 InstrumentScriptVM* m_vm;
159 class Result : public VMFnResult, public VMIntArrayExpr {
160 public:
161 StmtFlags_t flags;
162 EventGroup* eventGroup;
163
164 vmint arraySize() const OVERRIDE;
165 vmint evalIntElement(vmuint i) OVERRIDE;
166 void assignIntElement(vmuint i, vmint value) OVERRIDE {} // ignore assignment
167 vmfloat unitFactorOfElement(vmuint i) const OVERRIDE { return VM_NO_FACTOR; }
168 void assignElementUnitFactor(vmuint i, vmfloat factor) OVERRIDE {} // ignore assignment
169 VMExpr* resultValue() OVERRIDE { return this; }
170 StmtFlags_t resultFlags() OVERRIDE { return flags; }
171 bool isConstExpr() const OVERRIDE { return false; }
172 } m_result;
173
174 VMFnResult* errorResult();
175 VMFnResult* successResult(EventGroup* eventGroup);
176 };
177
178 class InstrumentScriptVMFunction_change_vol FINAL : public VMEmptyResultFunction {
179 public:
180 InstrumentScriptVMFunction_change_vol(InstrumentScriptVM* parent);
181 vmint minRequiredArgs() const OVERRIDE { return 2; }
182 vmint maxAllowedArgs() const OVERRIDE { return 3; }
183 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
184 bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
185 bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
186 bool acceptsArgFinal(vmint iArg) const OVERRIDE;
187 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
188 protected:
189 InstrumentScriptVM* m_vm;
190 };
191
192 class InstrumentScriptVMFunction_change_tune FINAL : public VMEmptyResultFunction {
193 public:
194 InstrumentScriptVMFunction_change_tune(InstrumentScriptVM* parent);
195 vmint minRequiredArgs() const OVERRIDE { return 2; }
196 vmint maxAllowedArgs() const OVERRIDE { return 3; }
197 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
198 bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
199 bool acceptsArgFinal(vmint iArg) const OVERRIDE;
200 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
201 protected:
202 InstrumentScriptVM* m_vm;
203 };
204
205 class InstrumentScriptVMFunction_change_pan FINAL : public VMEmptyResultFunction {
206 public:
207 InstrumentScriptVMFunction_change_pan(InstrumentScriptVM* parent);
208 vmint minRequiredArgs() const OVERRIDE { return 2; }
209 vmint maxAllowedArgs() const OVERRIDE { return 3; }
210 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
211 bool acceptsArgFinal(vmint iArg) const OVERRIDE;
212 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
213 protected:
214 InstrumentScriptVM* m_vm;
215 };
216
217 class InstrumentScriptVMFunction_change_cutoff FINAL : public VMEmptyResultFunction {
218 using Super = VMEmptyResultFunction; // just an alias for the super class
219 public:
220 InstrumentScriptVMFunction_change_cutoff(InstrumentScriptVM* parent);
221 vmint minRequiredArgs() const OVERRIDE { return 2; }
222 vmint maxAllowedArgs() const OVERRIDE { return 2; }
223 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
224 bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
225 bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
226 bool acceptsArgFinal(vmint iArg) const OVERRIDE;
227 void checkArgs(VMFnArgs* args, std::function<void(String)> err,
228 std::function<void(String)> wrn) OVERRIDE;
229 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
230 protected:
231 InstrumentScriptVM* m_vm;
232 };
233
234 class InstrumentScriptVMFunction_change_reso FINAL : public VMEmptyResultFunction {
235 public:
236 InstrumentScriptVMFunction_change_reso(InstrumentScriptVM* parent);
237 vmint minRequiredArgs() const OVERRIDE { return 2; }
238 vmint maxAllowedArgs() const OVERRIDE { return 2; }
239 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
240 bool acceptsArgFinal(vmint iArg) const OVERRIDE;
241 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
242 protected:
243 InstrumentScriptVM* m_vm;
244 };
245
246 //TODO: Derive from generalized, shared template class VMChangeSynthParamFunction instead (like e.g. change_cutoff_attack() implementation below already does).
247 class InstrumentScriptVMFunction_change_attack FINAL : public VMEmptyResultFunction {
248 using Super = VMEmptyResultFunction; // just an alias for the super class
249 public:
250 InstrumentScriptVMFunction_change_attack(InstrumentScriptVM* parent);
251 vmint minRequiredArgs() const OVERRIDE { return 2; }
252 vmint maxAllowedArgs() const OVERRIDE { return 2; }
253 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
254 bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
255 bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
256 bool acceptsArgFinal(vmint iArg) const OVERRIDE;
257 void checkArgs(VMFnArgs* args, std::function<void(String)> err,
258 std::function<void(String)> wrn) OVERRIDE;
259 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
260 protected:
261 InstrumentScriptVM* m_vm;
262 };
263
264 //TODO: Derive from generalized, shared template class VMChangeSynthParamFunction instead (like e.g. change_cutoff_decay() implementation below already does).
265 class InstrumentScriptVMFunction_change_decay FINAL : public VMEmptyResultFunction {
266 using Super = VMEmptyResultFunction; // just an alias for the super class
267 public:
268 InstrumentScriptVMFunction_change_decay(InstrumentScriptVM* parent);
269 vmint minRequiredArgs() const OVERRIDE { return 2; }
270 vmint maxAllowedArgs() const OVERRIDE { return 2; }
271 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
272 bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
273 bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
274 bool acceptsArgFinal(vmint iArg) const OVERRIDE;
275 void checkArgs(VMFnArgs* args, std::function<void(String)> err,
276 std::function<void(String)> wrn) OVERRIDE;
277 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
278 protected:
279 InstrumentScriptVM* m_vm;
280 };
281
282 //TODO: Derive from generalized, shared template class VMChangeSynthParamFunction instead (like e.g. change_cutoff_release() implementation below already does).
283 class InstrumentScriptVMFunction_change_release FINAL : public VMEmptyResultFunction {
284 using Super = VMEmptyResultFunction; // just an alias for the super class
285 public:
286 InstrumentScriptVMFunction_change_release(InstrumentScriptVM* parent);
287 vmint minRequiredArgs() const OVERRIDE { return 2; }
288 vmint maxAllowedArgs() const OVERRIDE { return 2; }
289 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
290 bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
291 bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
292 bool acceptsArgFinal(vmint iArg) const OVERRIDE;
293 void checkArgs(VMFnArgs* args, std::function<void(String)> err,
294 std::function<void(String)> wrn) OVERRIDE;
295 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
296 protected:
297 InstrumentScriptVM* m_vm;
298 };
299
300 class VMChangeSynthParamFunction : public VMEmptyResultFunction {
301 using Super = VMEmptyResultFunction; // just an alias for the super class
302 public:
303 struct Opt_t {
304 InstrumentScriptVM* vm = NULL; ///< Parent object owning the built-in function implementation object.
305 bool acceptFinal = false; ///< Whether built-in function allows 'final' operator for its 2nd function argument.
306 StdUnit_t unit = VM_NO_UNIT; ///< Whether built-in functions accepts a unit type for its 2nd function argument and if yes which one.
307 bool acceptUnitPrefix = false; ///< Whether built-in function accepts metric unit prefix(es) for its 2nd function argument.
308 bool acceptReal = false; ///< Whether the built-in function accepts both int and real number as data type for its 2nd function argument (otherwise its int only if false).
309 };
310 VMChangeSynthParamFunction(const Opt_t& opt)
311 : m_vm(opt.vm), m_acceptReal(opt.acceptReal),
312 m_acceptFinal(opt.acceptFinal),
313 m_acceptUnitPrefix(opt.acceptUnitPrefix), m_unit(opt.unit) {}
314 vmint minRequiredArgs() const OVERRIDE { return 2; }
315 vmint maxAllowedArgs() const OVERRIDE { return 2; }
316 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
317 bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
318 bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
319 bool acceptsArgFinal(vmint iArg) const OVERRIDE;
320 void checkArgs(VMFnArgs* args, std::function<void(String)> err,
321 std::function<void(String)> wrn) OVERRIDE;
322
323 template<class T_NoteParamType, T_NoteParamType NoteBase::_Override::*T_noteParam,
324 vmint T_synthParam,
325 vmint T_minValueNorm, vmint T_maxValueNorm, bool T_normalizeNorm,
326 vmint T_minValueUnit, vmint T_maxValueUnit,
327 MetricPrefix_t T_unitPrefix0, MetricPrefix_t ... T_unitPrefixN>
328 VMFnResult* execTemplate(VMFnArgs* args, const char* functionName);
329 protected:
330 InstrumentScriptVM* const m_vm;
331 const bool m_acceptReal;
332 const bool m_acceptFinal;
333 const bool m_acceptUnitPrefix;
334 const StdUnit_t m_unit;
335 };
336
337 class InstrumentScriptVMFunction_change_sustain FINAL : public VMChangeSynthParamFunction {
338 public:
339 InstrumentScriptVMFunction_change_sustain(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
340 .vm = parent,
341 .acceptFinal = true,
342 .unit = VM_BEL,
343 .acceptUnitPrefix = true,
344 .acceptReal = true,
345 }) {}
346 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
347 };
348
349 class InstrumentScriptVMFunction_change_cutoff_attack FINAL : public VMChangeSynthParamFunction {
350 public:
351 InstrumentScriptVMFunction_change_cutoff_attack(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
352 .vm = parent,
353 .acceptFinal = true,
354 .unit = VM_SECOND,
355 .acceptUnitPrefix = true,
356 .acceptReal = true,
357 }) {}
358 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
359 };
360
361 class InstrumentScriptVMFunction_change_cutoff_decay FINAL : public VMChangeSynthParamFunction {
362 public:
363 InstrumentScriptVMFunction_change_cutoff_decay(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
364 .vm = parent,
365 .acceptFinal = true,
366 .unit = VM_SECOND,
367 .acceptUnitPrefix = true,
368 .acceptReal = true,
369 }) {}
370 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
371 };
372
373 class InstrumentScriptVMFunction_change_cutoff_sustain FINAL : public VMChangeSynthParamFunction {
374 public:
375 InstrumentScriptVMFunction_change_cutoff_sustain(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
376 .vm = parent,
377 .acceptFinal = true,
378 .unit = VM_BEL,
379 .acceptUnitPrefix = true,
380 .acceptReal = true,
381 }) {}
382 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
383 };
384
385 class InstrumentScriptVMFunction_change_cutoff_release FINAL : public VMChangeSynthParamFunction {
386 public:
387 InstrumentScriptVMFunction_change_cutoff_release(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
388 .vm = parent,
389 .acceptFinal = true,
390 .unit = VM_SECOND,
391 .acceptUnitPrefix = true,
392 .acceptReal = true,
393 }) {}
394 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
395 };
396
397 class InstrumentScriptVMFunction_change_amp_lfo_depth FINAL : public VMChangeSynthParamFunction {
398 public:
399 InstrumentScriptVMFunction_change_amp_lfo_depth(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
400 .vm = parent,
401 .acceptFinal = true,
402 .unit = VM_NO_UNIT,
403 .acceptUnitPrefix = false,
404 .acceptReal = false,
405 }) {}
406 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
407 };
408
409 class InstrumentScriptVMFunction_change_amp_lfo_freq FINAL : public VMChangeSynthParamFunction {
410 public:
411 InstrumentScriptVMFunction_change_amp_lfo_freq(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
412 .vm = parent,
413 .acceptFinal = true,
414 .unit = VM_HERTZ,
415 .acceptUnitPrefix = true,
416 .acceptReal = true,
417 }) {}
418 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
419 };
420
421 class InstrumentScriptVMFunction_change_cutoff_lfo_depth FINAL : public VMChangeSynthParamFunction {
422 public:
423 InstrumentScriptVMFunction_change_cutoff_lfo_depth(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
424 .vm = parent,
425 .acceptFinal = true,
426 .unit = VM_NO_UNIT,
427 .acceptUnitPrefix = false,
428 .acceptReal = false,
429 }) {}
430 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
431 };
432
433 class InstrumentScriptVMFunction_change_cutoff_lfo_freq FINAL : public VMChangeSynthParamFunction {
434 public:
435 InstrumentScriptVMFunction_change_cutoff_lfo_freq(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
436 .vm = parent,
437 .acceptFinal = true,
438 .unit = VM_HERTZ,
439 .acceptUnitPrefix = true,
440 .acceptReal = true,
441 }) {}
442 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
443 };
444
445 class InstrumentScriptVMFunction_change_pitch_lfo_depth FINAL : public VMChangeSynthParamFunction {
446 public:
447 InstrumentScriptVMFunction_change_pitch_lfo_depth(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
448 .vm = parent,
449 .acceptFinal = true,
450 .unit = VM_NO_UNIT,
451 .acceptUnitPrefix = false,
452 .acceptReal = false,
453 }) {}
454 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
455 };
456
457 class InstrumentScriptVMFunction_change_pitch_lfo_freq FINAL : public VMChangeSynthParamFunction {
458 public:
459 InstrumentScriptVMFunction_change_pitch_lfo_freq(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
460 .vm = parent,
461 .acceptFinal = true,
462 .unit = VM_HERTZ,
463 .acceptUnitPrefix = true,
464 .acceptReal = true,
465 }) {}
466 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
467 };
468
469 class InstrumentScriptVMFunction_change_vol_time FINAL : public VMChangeSynthParamFunction {
470 public:
471 InstrumentScriptVMFunction_change_vol_time(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
472 .vm = parent,
473 .acceptFinal = false,
474 .unit = VM_SECOND,
475 .acceptUnitPrefix = true,
476 .acceptReal = true,
477 }) {}
478 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
479 };
480
481 class InstrumentScriptVMFunction_change_tune_time FINAL : public VMChangeSynthParamFunction {
482 public:
483 InstrumentScriptVMFunction_change_tune_time(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
484 .vm = parent,
485 .acceptFinal = false,
486 .unit = VM_SECOND,
487 .acceptUnitPrefix = true,
488 .acceptReal = true,
489 }) {}
490 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
491 };
492
493 class InstrumentScriptVMFunction_change_pan_time FINAL : public VMChangeSynthParamFunction {
494 public:
495 InstrumentScriptVMFunction_change_pan_time(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
496 .vm = parent,
497 .acceptFinal = false,
498 .unit = VM_SECOND,
499 .acceptUnitPrefix = true,
500 .acceptReal = true,
501 }) {}
502 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
503 };
504
505 class VMChangeFadeCurveFunction : public VMEmptyResultFunction {
506 public:
507 VMChangeFadeCurveFunction(InstrumentScriptVM* parent) : m_vm(parent) {}
508 vmint minRequiredArgs() const OVERRIDE { return 2; }
509 vmint maxAllowedArgs() const OVERRIDE { return 2; }
510 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
511
512 template<fade_curve_t NoteBase::_Override::*T_noteParam, vmint T_synthParam>
513 VMFnResult* execTemplate(VMFnArgs* args, const char* functionName);
514 protected:
515 InstrumentScriptVM* m_vm;
516 };
517
518 class InstrumentScriptVMFunction_change_vol_curve FINAL : public VMChangeFadeCurveFunction {
519 public:
520 InstrumentScriptVMFunction_change_vol_curve(InstrumentScriptVM* parent) : VMChangeFadeCurveFunction(parent) {}
521 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
522 };
523
524 class InstrumentScriptVMFunction_change_tune_curve FINAL : public VMChangeFadeCurveFunction {
525 public:
526 InstrumentScriptVMFunction_change_tune_curve(InstrumentScriptVM* parent) : VMChangeFadeCurveFunction(parent) {}
527 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
528 };
529
530 class InstrumentScriptVMFunction_change_pan_curve FINAL : public VMChangeFadeCurveFunction {
531 public:
532 InstrumentScriptVMFunction_change_pan_curve(InstrumentScriptVM* parent) : VMChangeFadeCurveFunction(parent) {}
533 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
534 };
535
536 class InstrumentScriptVMFunction_fade_in FINAL : public VMEmptyResultFunction {
537 public:
538 InstrumentScriptVMFunction_fade_in(InstrumentScriptVM* parent);
539 vmint minRequiredArgs() const OVERRIDE { return 2; }
540 vmint maxAllowedArgs() const OVERRIDE { return 2; }
541 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
542 bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
543 bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
544 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
545 protected:
546 InstrumentScriptVM* m_vm;
547 };
548
549 class InstrumentScriptVMFunction_fade_out FINAL : public VMEmptyResultFunction {
550 public:
551 InstrumentScriptVMFunction_fade_out(InstrumentScriptVM* parent);
552 vmint minRequiredArgs() const OVERRIDE { return 2; }
553 vmint maxAllowedArgs() const OVERRIDE { return 3; }
554 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
555 bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
556 bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
557 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
558 protected:
559 InstrumentScriptVM* m_vm;
560 };
561
562 class InstrumentScriptVMFunction_get_event_par FINAL : public VMIntResultFunction {
563 public:
564 InstrumentScriptVMFunction_get_event_par(InstrumentScriptVM* parent);
565 StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; }
566 bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }
567 vmint minRequiredArgs() const OVERRIDE { return 2; }
568 vmint maxAllowedArgs() const OVERRIDE { return 2; }
569 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
570 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
571 protected:
572 InstrumentScriptVM* m_vm;
573 };
574
575 class InstrumentScriptVMFunction_set_event_par FINAL : public VMEmptyResultFunction {
576 public:
577 InstrumentScriptVMFunction_set_event_par(InstrumentScriptVM* parent);
578 vmint minRequiredArgs() const OVERRIDE { return 3; }
579 vmint maxAllowedArgs() const OVERRIDE { return 3; }
580 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
581 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
582 protected:
583 InstrumentScriptVM* m_vm;
584 };
585
586 class InstrumentScriptVMFunction_change_note FINAL : public VMEmptyResultFunction {
587 public:
588 InstrumentScriptVMFunction_change_note(InstrumentScriptVM* parent);
589 vmint minRequiredArgs() const OVERRIDE { return 2; }
590 vmint maxAllowedArgs() const OVERRIDE { return 2; }
591 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
592 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
593 protected:
594 InstrumentScriptVM* m_vm;
595 };
596
597 class InstrumentScriptVMFunction_change_velo FINAL : public VMEmptyResultFunction {
598 public:
599 InstrumentScriptVMFunction_change_velo(InstrumentScriptVM* parent);
600 vmint minRequiredArgs() const OVERRIDE { return 2; }
601 vmint maxAllowedArgs() const OVERRIDE { return 2; }
602 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
603 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
604 protected:
605 InstrumentScriptVM* m_vm;
606 };
607
608 class InstrumentScriptVMFunction_change_play_pos FINAL : public VMEmptyResultFunction {
609 public:
610 InstrumentScriptVMFunction_change_play_pos(InstrumentScriptVM* parent);
611 vmint minRequiredArgs() const OVERRIDE { return 2; }
612 vmint maxAllowedArgs() const OVERRIDE { return 2; }
613 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
614 bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
615 bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
616 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
617 protected:
618 InstrumentScriptVM* m_vm;
619 };
620
621 class InstrumentScriptVMFunction_event_status FINAL : public VMIntResultFunction {
622 public:
623 InstrumentScriptVMFunction_event_status(InstrumentScriptVM* parent);
624 StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; }
625 bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }
626 vmint minRequiredArgs() const OVERRIDE { return 1; }
627 vmint maxAllowedArgs() const OVERRIDE { return 1; }
628 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
629 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
630 protected:
631 InstrumentScriptVM* m_vm;
632 };
633
634 class InstrumentScriptVMFunction_callback_status FINAL : public VMIntResultFunction {
635 public:
636 InstrumentScriptVMFunction_callback_status(InstrumentScriptVM* parent);
637 StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; }
638 bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }
639 vmint minRequiredArgs() const OVERRIDE { return 1; }
640 vmint maxAllowedArgs() const OVERRIDE { return 1; }
641 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
642 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
643 protected:
644 InstrumentScriptVM* m_vm;
645 };
646
647 // overrides core wait() implementation
648 class InstrumentScriptVMFunction_wait FINAL : public CoreVMFunction_wait {
649 public:
650 InstrumentScriptVMFunction_wait(InstrumentScriptVM* parent);
651 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
652 };
653
654 class InstrumentScriptVMFunction_stop_wait FINAL : public VMEmptyResultFunction {
655 public:
656 InstrumentScriptVMFunction_stop_wait(InstrumentScriptVM* parent);
657 vmint minRequiredArgs() const OVERRIDE { return 1; }
658 vmint maxAllowedArgs() const OVERRIDE { return 2; }
659 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
660 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
661 protected:
662 InstrumentScriptVM* m_vm;
663 };
664
665 class InstrumentScriptVMFunction_abort FINAL : public VMEmptyResultFunction {
666 public:
667 InstrumentScriptVMFunction_abort(InstrumentScriptVM* parent);
668 vmint minRequiredArgs() const OVERRIDE { return 1; }
669 vmint maxAllowedArgs() const OVERRIDE { return 1; }
670 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR; }
671 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
672 protected:
673 InstrumentScriptVM* m_vm;
674 };
675
676 class InstrumentScriptVMFunction_fork FINAL : public VMIntResultFunction {
677 public:
678 InstrumentScriptVMFunction_fork(InstrumentScriptVM* parent);
679 StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; }
680 bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }
681 vmint minRequiredArgs() const OVERRIDE { return 0; }
682 vmint maxAllowedArgs() const OVERRIDE { return 2; }
683 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
684 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
685 protected:
686 InstrumentScriptVM* m_vm;
687 };
688
689 } // namespace LinuxSampler
690
691 #endif // LS_INSTRSCRIPTVMFUNCTIONS_H

  ViewVC Help
Powered by ViewVC