/[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 3691 - (show annotations) (download) (as text)
Fri Jan 3 12:35:20 2020 UTC (4 years, 2 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 31941 byte(s)
* NKSP: Implemented built-in script function "set_rpn()".

* NKSP: Implemented built-in script function "set_nrpn()".

* Bumped version (2.1.1.svn31).

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 class InstrumentScriptVMFunction_change_attack FINAL : public VMEmptyResultFunction {
247 using Super = VMEmptyResultFunction; // just an alias for the super class
248 public:
249 InstrumentScriptVMFunction_change_attack(InstrumentScriptVM* parent);
250 vmint minRequiredArgs() const OVERRIDE { return 2; }
251 vmint maxAllowedArgs() const OVERRIDE { return 2; }
252 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
253 bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
254 bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
255 bool acceptsArgFinal(vmint iArg) const OVERRIDE;
256 void checkArgs(VMFnArgs* args, std::function<void(String)> err,
257 std::function<void(String)> wrn) OVERRIDE;
258 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
259 protected:
260 InstrumentScriptVM* m_vm;
261 };
262
263 class InstrumentScriptVMFunction_change_decay FINAL : public VMEmptyResultFunction {
264 using Super = VMEmptyResultFunction; // just an alias for the super class
265 public:
266 InstrumentScriptVMFunction_change_decay(InstrumentScriptVM* parent);
267 vmint minRequiredArgs() const OVERRIDE { return 2; }
268 vmint maxAllowedArgs() const OVERRIDE { return 2; }
269 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
270 bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
271 bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
272 bool acceptsArgFinal(vmint iArg) const OVERRIDE;
273 void checkArgs(VMFnArgs* args, std::function<void(String)> err,
274 std::function<void(String)> wrn) OVERRIDE;
275 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
276 protected:
277 InstrumentScriptVM* m_vm;
278 };
279
280 class InstrumentScriptVMFunction_change_release FINAL : public VMEmptyResultFunction {
281 using Super = VMEmptyResultFunction; // just an alias for the super class
282 public:
283 InstrumentScriptVMFunction_change_release(InstrumentScriptVM* parent);
284 vmint minRequiredArgs() const OVERRIDE { return 2; }
285 vmint maxAllowedArgs() const OVERRIDE { return 2; }
286 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
287 bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
288 bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
289 bool acceptsArgFinal(vmint iArg) const OVERRIDE;
290 void checkArgs(VMFnArgs* args, std::function<void(String)> err,
291 std::function<void(String)> wrn) OVERRIDE;
292 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
293 protected:
294 InstrumentScriptVM* m_vm;
295 };
296
297 class VMChangeSynthParamFunction : public VMEmptyResultFunction {
298 using Super = VMEmptyResultFunction; // just an alias for the super class
299 public:
300 struct Opt_t {
301 InstrumentScriptVM* vm = NULL; ///< Parent object owning the built-in function implementation object.
302 bool acceptFinal = false; ///< Whether built-in function allows 'final' operator for its 2nd function argument.
303 StdUnit_t unit = VM_NO_UNIT; ///< Whether built-in functions accepts a unit type for its 2nd function argument and if yes which one.
304 bool acceptUnitPrefix = false; ///< Whether built-in function accepts metric unit prefix(es) for its 2nd function argument.
305 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).
306 };
307 VMChangeSynthParamFunction(const Opt_t& opt)
308 : m_vm(opt.vm), m_acceptReal(opt.acceptReal),
309 m_acceptFinal(opt.acceptFinal),
310 m_acceptUnitPrefix(opt.acceptUnitPrefix), m_unit(opt.unit) {}
311 vmint minRequiredArgs() const OVERRIDE { return 2; }
312 vmint maxAllowedArgs() const OVERRIDE { return 2; }
313 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
314 bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
315 bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
316 bool acceptsArgFinal(vmint iArg) const OVERRIDE;
317 void checkArgs(VMFnArgs* args, std::function<void(String)> err,
318 std::function<void(String)> wrn) OVERRIDE;
319
320 template<class T_NoteParamType, T_NoteParamType NoteBase::_Override::*T_noteParam,
321 vmint T_synthParam,
322 vmint T_minValueNorm, vmint T_maxValueNorm, bool T_normalizeNorm,
323 vmint T_minValueUnit, vmint T_maxValueUnit,
324 MetricPrefix_t T_unitPrefix0, MetricPrefix_t ... T_unitPrefixN>
325 VMFnResult* execTemplate(VMFnArgs* args, const char* functionName);
326 protected:
327 InstrumentScriptVM* const m_vm;
328 const bool m_acceptReal;
329 const bool m_acceptFinal;
330 const bool m_acceptUnitPrefix;
331 const StdUnit_t m_unit;
332 };
333
334 class InstrumentScriptVMFunction_change_sustain FINAL : public VMChangeSynthParamFunction {
335 public:
336 InstrumentScriptVMFunction_change_sustain(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
337 .vm = parent,
338 .acceptFinal = true,
339 .unit = VM_BEL,
340 .acceptUnitPrefix = true,
341 .acceptReal = true,
342 }) {}
343 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
344 };
345
346 class InstrumentScriptVMFunction_change_cutoff_attack FINAL : public VMChangeSynthParamFunction {
347 public:
348 InstrumentScriptVMFunction_change_cutoff_attack(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
349 .vm = parent,
350 .acceptFinal = true,
351 .unit = VM_SECOND,
352 .acceptUnitPrefix = true,
353 .acceptReal = true,
354 }) {}
355 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
356 };
357
358 class InstrumentScriptVMFunction_change_cutoff_decay FINAL : public VMChangeSynthParamFunction {
359 public:
360 InstrumentScriptVMFunction_change_cutoff_decay(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
361 .vm = parent,
362 .acceptFinal = true,
363 .unit = VM_SECOND,
364 .acceptUnitPrefix = true,
365 .acceptReal = true,
366 }) {}
367 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
368 };
369
370 class InstrumentScriptVMFunction_change_cutoff_sustain FINAL : public VMChangeSynthParamFunction {
371 public:
372 InstrumentScriptVMFunction_change_cutoff_sustain(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
373 .vm = parent,
374 .acceptFinal = true,
375 .unit = VM_BEL,
376 .acceptUnitPrefix = true,
377 .acceptReal = true,
378 }) {}
379 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
380 };
381
382 class InstrumentScriptVMFunction_change_cutoff_release FINAL : public VMChangeSynthParamFunction {
383 public:
384 InstrumentScriptVMFunction_change_cutoff_release(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
385 .vm = parent,
386 .acceptFinal = true,
387 .unit = VM_SECOND,
388 .acceptUnitPrefix = true,
389 .acceptReal = true,
390 }) {}
391 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
392 };
393
394 class InstrumentScriptVMFunction_change_amp_lfo_depth FINAL : public VMChangeSynthParamFunction {
395 public:
396 InstrumentScriptVMFunction_change_amp_lfo_depth(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
397 .vm = parent,
398 .acceptFinal = true,
399 .unit = VM_NO_UNIT,
400 .acceptUnitPrefix = false,
401 .acceptReal = false,
402 }) {}
403 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
404 };
405
406 class InstrumentScriptVMFunction_change_amp_lfo_freq FINAL : public VMChangeSynthParamFunction {
407 public:
408 InstrumentScriptVMFunction_change_amp_lfo_freq(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
409 .vm = parent,
410 .acceptFinal = true,
411 .unit = VM_HERTZ,
412 .acceptUnitPrefix = true,
413 .acceptReal = true,
414 }) {}
415 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
416 };
417
418 class InstrumentScriptVMFunction_change_cutoff_lfo_depth FINAL : public VMChangeSynthParamFunction {
419 public:
420 InstrumentScriptVMFunction_change_cutoff_lfo_depth(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
421 .vm = parent,
422 .acceptFinal = true,
423 .unit = VM_NO_UNIT,
424 .acceptUnitPrefix = false,
425 .acceptReal = false,
426 }) {}
427 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
428 };
429
430 class InstrumentScriptVMFunction_change_cutoff_lfo_freq FINAL : public VMChangeSynthParamFunction {
431 public:
432 InstrumentScriptVMFunction_change_cutoff_lfo_freq(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
433 .vm = parent,
434 .acceptFinal = true,
435 .unit = VM_HERTZ,
436 .acceptUnitPrefix = true,
437 .acceptReal = true,
438 }) {}
439 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
440 };
441
442 class InstrumentScriptVMFunction_change_pitch_lfo_depth FINAL : public VMChangeSynthParamFunction {
443 public:
444 InstrumentScriptVMFunction_change_pitch_lfo_depth(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
445 .vm = parent,
446 .acceptFinal = true,
447 .unit = VM_NO_UNIT,
448 .acceptUnitPrefix = false,
449 .acceptReal = false,
450 }) {}
451 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
452 };
453
454 class InstrumentScriptVMFunction_change_pitch_lfo_freq FINAL : public VMChangeSynthParamFunction {
455 public:
456 InstrumentScriptVMFunction_change_pitch_lfo_freq(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
457 .vm = parent,
458 .acceptFinal = true,
459 .unit = VM_HERTZ,
460 .acceptUnitPrefix = true,
461 .acceptReal = true,
462 }) {}
463 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
464 };
465
466 class InstrumentScriptVMFunction_change_vol_time FINAL : public VMChangeSynthParamFunction {
467 public:
468 InstrumentScriptVMFunction_change_vol_time(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
469 .vm = parent,
470 .acceptFinal = false,
471 .unit = VM_SECOND,
472 .acceptUnitPrefix = true,
473 .acceptReal = true,
474 }) {}
475 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
476 };
477
478 class InstrumentScriptVMFunction_change_tune_time FINAL : public VMChangeSynthParamFunction {
479 public:
480 InstrumentScriptVMFunction_change_tune_time(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
481 .vm = parent,
482 .acceptFinal = false,
483 .unit = VM_SECOND,
484 .acceptUnitPrefix = true,
485 .acceptReal = true,
486 }) {}
487 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
488 };
489
490 class InstrumentScriptVMFunction_change_pan_time FINAL : public VMChangeSynthParamFunction {
491 public:
492 InstrumentScriptVMFunction_change_pan_time(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
493 .vm = parent,
494 .acceptFinal = false,
495 .unit = VM_SECOND,
496 .acceptUnitPrefix = true,
497 .acceptReal = true,
498 }) {}
499 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
500 };
501
502 class VMChangeFadeCurveFunction : public VMEmptyResultFunction {
503 public:
504 VMChangeFadeCurveFunction(InstrumentScriptVM* parent) : m_vm(parent) {}
505 vmint minRequiredArgs() const OVERRIDE { return 2; }
506 vmint maxAllowedArgs() const OVERRIDE { return 2; }
507 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
508
509 template<fade_curve_t NoteBase::_Override::*T_noteParam, vmint T_synthParam>
510 VMFnResult* execTemplate(VMFnArgs* args, const char* functionName);
511 protected:
512 InstrumentScriptVM* m_vm;
513 };
514
515 class InstrumentScriptVMFunction_change_vol_curve FINAL : public VMChangeFadeCurveFunction {
516 public:
517 InstrumentScriptVMFunction_change_vol_curve(InstrumentScriptVM* parent) : VMChangeFadeCurveFunction(parent) {}
518 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
519 };
520
521 class InstrumentScriptVMFunction_change_tune_curve FINAL : public VMChangeFadeCurveFunction {
522 public:
523 InstrumentScriptVMFunction_change_tune_curve(InstrumentScriptVM* parent) : VMChangeFadeCurveFunction(parent) {}
524 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
525 };
526
527 class InstrumentScriptVMFunction_change_pan_curve FINAL : public VMChangeFadeCurveFunction {
528 public:
529 InstrumentScriptVMFunction_change_pan_curve(InstrumentScriptVM* parent) : VMChangeFadeCurveFunction(parent) {}
530 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
531 };
532
533 class InstrumentScriptVMFunction_fade_in FINAL : public VMEmptyResultFunction {
534 public:
535 InstrumentScriptVMFunction_fade_in(InstrumentScriptVM* parent);
536 vmint minRequiredArgs() const OVERRIDE { return 2; }
537 vmint maxAllowedArgs() const OVERRIDE { return 2; }
538 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
539 bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
540 bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
541 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
542 protected:
543 InstrumentScriptVM* m_vm;
544 };
545
546 class InstrumentScriptVMFunction_fade_out FINAL : public VMEmptyResultFunction {
547 public:
548 InstrumentScriptVMFunction_fade_out(InstrumentScriptVM* parent);
549 vmint minRequiredArgs() const OVERRIDE { return 2; }
550 vmint maxAllowedArgs() const OVERRIDE { return 3; }
551 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
552 bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
553 bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
554 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
555 protected:
556 InstrumentScriptVM* m_vm;
557 };
558
559 class InstrumentScriptVMFunction_get_event_par FINAL : public VMIntResultFunction {
560 public:
561 InstrumentScriptVMFunction_get_event_par(InstrumentScriptVM* parent);
562 StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; }
563 bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }
564 vmint minRequiredArgs() const OVERRIDE { return 2; }
565 vmint maxAllowedArgs() const OVERRIDE { return 2; }
566 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
567 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
568 protected:
569 InstrumentScriptVM* m_vm;
570 };
571
572 class InstrumentScriptVMFunction_set_event_par FINAL : public VMEmptyResultFunction {
573 public:
574 InstrumentScriptVMFunction_set_event_par(InstrumentScriptVM* parent);
575 vmint minRequiredArgs() const OVERRIDE { return 3; }
576 vmint maxAllowedArgs() const OVERRIDE { return 3; }
577 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
578 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
579 protected:
580 InstrumentScriptVM* m_vm;
581 };
582
583 class InstrumentScriptVMFunction_change_note FINAL : public VMEmptyResultFunction {
584 public:
585 InstrumentScriptVMFunction_change_note(InstrumentScriptVM* parent);
586 vmint minRequiredArgs() const OVERRIDE { return 2; }
587 vmint maxAllowedArgs() const OVERRIDE { return 2; }
588 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
589 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
590 protected:
591 InstrumentScriptVM* m_vm;
592 };
593
594 class InstrumentScriptVMFunction_change_velo FINAL : public VMEmptyResultFunction {
595 public:
596 InstrumentScriptVMFunction_change_velo(InstrumentScriptVM* parent);
597 vmint minRequiredArgs() const OVERRIDE { return 2; }
598 vmint maxAllowedArgs() const OVERRIDE { return 2; }
599 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
600 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
601 protected:
602 InstrumentScriptVM* m_vm;
603 };
604
605 class InstrumentScriptVMFunction_change_play_pos FINAL : public VMEmptyResultFunction {
606 public:
607 InstrumentScriptVMFunction_change_play_pos(InstrumentScriptVM* parent);
608 vmint minRequiredArgs() const OVERRIDE { return 2; }
609 vmint maxAllowedArgs() const OVERRIDE { return 2; }
610 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
611 bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
612 bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
613 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
614 protected:
615 InstrumentScriptVM* m_vm;
616 };
617
618 class InstrumentScriptVMFunction_event_status FINAL : public VMIntResultFunction {
619 public:
620 InstrumentScriptVMFunction_event_status(InstrumentScriptVM* parent);
621 StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; }
622 bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }
623 vmint minRequiredArgs() const OVERRIDE { return 1; }
624 vmint maxAllowedArgs() const OVERRIDE { return 1; }
625 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
626 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
627 protected:
628 InstrumentScriptVM* m_vm;
629 };
630
631 class InstrumentScriptVMFunction_callback_status FINAL : public VMIntResultFunction {
632 public:
633 InstrumentScriptVMFunction_callback_status(InstrumentScriptVM* parent);
634 StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; }
635 bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }
636 vmint minRequiredArgs() const OVERRIDE { return 1; }
637 vmint maxAllowedArgs() const OVERRIDE { return 1; }
638 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
639 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
640 protected:
641 InstrumentScriptVM* m_vm;
642 };
643
644 // overrides core wait() implementation
645 class InstrumentScriptVMFunction_wait FINAL : public CoreVMFunction_wait {
646 public:
647 InstrumentScriptVMFunction_wait(InstrumentScriptVM* parent);
648 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
649 };
650
651 class InstrumentScriptVMFunction_stop_wait FINAL : public VMEmptyResultFunction {
652 public:
653 InstrumentScriptVMFunction_stop_wait(InstrumentScriptVM* parent);
654 vmint minRequiredArgs() const OVERRIDE { return 1; }
655 vmint maxAllowedArgs() const OVERRIDE { return 2; }
656 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
657 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
658 protected:
659 InstrumentScriptVM* m_vm;
660 };
661
662 class InstrumentScriptVMFunction_abort FINAL : public VMEmptyResultFunction {
663 public:
664 InstrumentScriptVMFunction_abort(InstrumentScriptVM* parent);
665 vmint minRequiredArgs() const OVERRIDE { return 1; }
666 vmint maxAllowedArgs() const OVERRIDE { return 1; }
667 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR; }
668 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
669 protected:
670 InstrumentScriptVM* m_vm;
671 };
672
673 class InstrumentScriptVMFunction_fork FINAL : public VMIntResultFunction {
674 public:
675 InstrumentScriptVMFunction_fork(InstrumentScriptVM* parent);
676 StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; }
677 bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }
678 vmint minRequiredArgs() const OVERRIDE { return 0; }
679 vmint maxAllowedArgs() const OVERRIDE { return 2; }
680 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
681 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
682 protected:
683 InstrumentScriptVM* m_vm;
684 };
685
686 } // namespace LinuxSampler
687
688 #endif // LS_INSTRSCRIPTVMFUNCTIONS_H

  ViewVC Help
Powered by ViewVC