/[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 3581 - (show annotations) (download) (as text)
Fri Aug 30 11:40:25 2019 UTC (4 years, 7 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 27802 byte(s)
NKSP: Allow more wider support of standard measuring units & 'final'ness.

* Raised compiler requirement to be C++14 compliant (due to severe
  restrictions regarding C-style aggregate initializer lists in C++11
  which are now massively used throughout the code base).

* NKSP VM API: Allow units and 'final'ness to be returned as result from
  built-in functions (added methods VMFunction::returnUnitType() and
  VMFunction::returnsFinal() for that purpose which must be implemented by
  built-in function implementations).

* NKSP language: Allow metric unit prefixes of numeric scalar and array
  variables to be changed freely at runtime (unlike unit types like Hz etc.
  which are still sticky parse-time features of variables which cannot be
  changed at runtime for the intentional sake of determinism).

* NKSP language: 'final' values are prohibited for array variables for now
  (attempt causes a parsers error).

* NKSP language: expressions with unit types (e.g. Hz) are prohibited for
  conditions of runtime control structures like if(), while(), select()
  (attempt causes a parser error).

* NKSP VM API: Allow built-in functions to perform their own, individual
  parse time checks of arguments going to be passed to the function at
  runtime (added method VMFunction::checkArgs() for that purpose).

* NKSP language: raise parser warning if only one operand of binary
  operators (like logical 'or' comparison) contain a 'final' value (because
  it would always yield in a 'final' result in such cases).

* NKSP language: Allow comparison (=, #, <, >, <=, >=) of values with
  different metric unit prefixes, which will behave as expected (e.g.
  result of expression '1000us < 2ms' is true).

* NKSP language: Allow adding values with different metric unit prefixes
  (e.g. result of expression '100Hz + 5kHz' is '5100Hz').

* NKSP language: Allow subtracting values with different metric unit
  prefixes (e.g. result of expression '1ms - 20us' is '980us').

* NKSP language: Allow multiplying with any metric unit prefixes
  (e.g. result of expression '2k * 3ms' is '6s'), however multiplications
  with unit types on both sides (e.g. '2s * 2s') is still prohibited since
  we don't have any considerable practical use for a term like '4s^2'
  (hence any attempt multiplying two unit types still causes parser error).

* NKSP language: Allow dividing by any metric unit prefixes and allow
  division of same unit type on both sides (e.g. expression '8kHz / 1000Hz'
  yields in unit free result '8'). So this is now a way to cast units away
  e.g. for passing the result to other expressions, certain function calls
  or variables which are not accepting any units (or that specific unit).

* NKSP language: integer arrays and real number arrays can now be converted
  to strings (e.g. for dumping their content with message() calls for
  script debugging purposes).

* NKSP language: expressions and variables with units are now correctly
  casted to strings (e.g. with message() calls).

* NKSP language: comparing real numbers for equalness (e.g. '~foo = 3.1') or
  unequalness (e.g. '~foo # 3.1') is now less strict and takes the expected
  floating point tolerances into account.

* NKSP VM API: Added methods VMScalarNumberExpr::evalCastInt() and
  VMScalarNumberExpr::evalCastReal().

* NKSP VM API: Added base class 'VMNumberArrayExpr' for classes
  'VMIntArrayExpr' and 'VMRealArrayExpr'.

* NKSP VM API: replaced all unitPrefix() (parse time) methods by
  unitFactor() (runtime) methods.

* Built-in function "exit()" supports now returning units and 'final'ness
  exclusively for test cases.

* The following built-in functions support now units as well: "abs()",
  "random()", "inc()", "dec()", "in_range()", "min()", "max()",
  "real_to_int()", "int()", "int_to_real()" and "real()".

* Built-in functions "array_equal()", "search()" and "sort()" support now
  real number arrays (correctly) as well.

* Added individual parse time checks of arguments to be passed to built-in
  functions "random()", "inc()", "dec()", "in_range()", "min()", "max()",
  "array_equal()" and "search()" specific for their individual purposes.

* Test cases: Added massive amount of NKSP test cases for standard
  measuring units and 'final' operator usage cases.

* Test cases: Added NKSP test cases for (floating point tolerance aware)
  real number equalness / unequalness comparison.

* Bumped version (2.1.1.svn8).

1 /*
2 * Copyright (c) 2014 - 2019 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 public:
24 InstrumentScriptVMFunction_play_note(InstrumentScriptVM* parent);
25 StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; }
26 bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }
27 vmint minRequiredArgs() const OVERRIDE { return 1; }
28 vmint maxAllowedArgs() const OVERRIDE { return 4; }
29 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
30 ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; }
31 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
32 protected:
33 InstrumentScriptVM* m_vm;
34 };
35
36 class InstrumentScriptVMFunction_set_controller FINAL : public VMIntResultFunction {
37 public:
38 InstrumentScriptVMFunction_set_controller(InstrumentScriptVM* parent);
39 StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; }
40 bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }
41 vmint minRequiredArgs() const OVERRIDE { return 2; }
42 vmint maxAllowedArgs() const OVERRIDE { return 2; }
43 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
44 ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; }
45 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
46 protected:
47 InstrumentScriptVM* m_vm;
48 };
49
50 class InstrumentScriptVMFunction_ignore_event FINAL : public VMEmptyResultFunction {
51 public:
52 InstrumentScriptVMFunction_ignore_event(InstrumentScriptVM* parent);
53 vmint minRequiredArgs() const OVERRIDE { return 0; }
54 vmint maxAllowedArgs() const OVERRIDE { return 1; }
55 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
56 ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; }
57 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
58 protected:
59 InstrumentScriptVM* m_vm;
60 };
61
62 class InstrumentScriptVMFunction_ignore_controller FINAL : public VMEmptyResultFunction {
63 public:
64 InstrumentScriptVMFunction_ignore_controller(InstrumentScriptVM* parent);
65 vmint minRequiredArgs() const OVERRIDE { return 0; }
66 vmint maxAllowedArgs() const OVERRIDE { return 1; }
67 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
68 ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; }
69 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
70 protected:
71 InstrumentScriptVM* m_vm;
72 };
73
74 class InstrumentScriptVMFunction_note_off FINAL : public VMEmptyResultFunction {
75 public:
76 InstrumentScriptVMFunction_note_off(InstrumentScriptVM* parent);
77 vmint minRequiredArgs() const OVERRIDE { return 1; }
78 vmint maxAllowedArgs() const OVERRIDE { return 2; }
79 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
80 ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; }
81 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
82 protected:
83 InstrumentScriptVM* m_vm;
84 };
85
86 class InstrumentScriptVMFunction_set_event_mark FINAL : public VMEmptyResultFunction {
87 public:
88 InstrumentScriptVMFunction_set_event_mark(InstrumentScriptVM* parent);
89 vmint minRequiredArgs() const OVERRIDE { return 2; }
90 vmint maxAllowedArgs() const OVERRIDE { return 2; }
91 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
92 ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; }
93 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
94 protected:
95 InstrumentScriptVM* m_vm;
96 };
97
98 class InstrumentScriptVMFunction_delete_event_mark FINAL : public VMEmptyResultFunction {
99 public:
100 InstrumentScriptVMFunction_delete_event_mark(InstrumentScriptVM* parent);
101 vmint minRequiredArgs() const OVERRIDE { return 2; }
102 vmint maxAllowedArgs() const OVERRIDE { return 2; }
103 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
104 ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; }
105 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
106 protected:
107 InstrumentScriptVM* m_vm;
108 };
109
110 class InstrumentScriptVMFunction_by_marks FINAL : public VMFunction {
111 public:
112 InstrumentScriptVMFunction_by_marks(InstrumentScriptVM* parent);
113 StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; }
114 bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }
115 vmint minRequiredArgs() const OVERRIDE { return 1; }
116 vmint maxAllowedArgs() const OVERRIDE { return 1; }
117 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
118 bool modifiesArg(vmint iArg) const OVERRIDE { return false; }
119 ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; }
120 ExprType_t returnType(VMFnArgs* args) OVERRIDE { return INT_ARR_EXPR; }
121 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
122 protected:
123 InstrumentScriptVM* m_vm;
124 class Result : public VMFnResult, public VMIntArrayExpr {
125 public:
126 StmtFlags_t flags;
127 EventGroup* eventGroup;
128
129 vmint arraySize() const OVERRIDE;
130 vmint evalIntElement(vmuint i) OVERRIDE;
131 void assignIntElement(vmuint i, vmint value) OVERRIDE {} // ignore assignment
132 vmfloat unitFactorOfElement(vmuint i) const OVERRIDE { return VM_NO_FACTOR; }
133 void assignElementUnitFactor(vmuint i, vmfloat factor) OVERRIDE {} // ignore assignment
134 VMExpr* resultValue() OVERRIDE { return this; }
135 StmtFlags_t resultFlags() OVERRIDE { return flags; }
136 bool isConstExpr() const OVERRIDE { return false; }
137 } m_result;
138
139 VMFnResult* errorResult();
140 VMFnResult* successResult(EventGroup* eventGroup);
141 };
142
143 class InstrumentScriptVMFunction_change_vol FINAL : public VMEmptyResultFunction {
144 public:
145 InstrumentScriptVMFunction_change_vol(InstrumentScriptVM* parent);
146 vmint minRequiredArgs() const OVERRIDE { return 2; }
147 vmint maxAllowedArgs() const OVERRIDE { return 3; }
148 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
149 bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
150 bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
151 bool acceptsArgFinal(vmint iArg) const OVERRIDE;
152 ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; }
153 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
154 protected:
155 InstrumentScriptVM* m_vm;
156 };
157
158 class InstrumentScriptVMFunction_change_tune FINAL : public VMEmptyResultFunction {
159 public:
160 InstrumentScriptVMFunction_change_tune(InstrumentScriptVM* parent);
161 vmint minRequiredArgs() const OVERRIDE { return 2; }
162 vmint maxAllowedArgs() const OVERRIDE { return 3; }
163 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
164 bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
165 bool acceptsArgFinal(vmint iArg) const OVERRIDE;
166 ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; }
167 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
168 protected:
169 InstrumentScriptVM* m_vm;
170 };
171
172 class InstrumentScriptVMFunction_change_pan FINAL : public VMEmptyResultFunction {
173 public:
174 InstrumentScriptVMFunction_change_pan(InstrumentScriptVM* parent);
175 vmint minRequiredArgs() const OVERRIDE { return 2; }
176 vmint maxAllowedArgs() const OVERRIDE { return 3; }
177 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
178 bool acceptsArgFinal(vmint iArg) const OVERRIDE;
179 ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; }
180 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
181 protected:
182 InstrumentScriptVM* m_vm;
183 };
184
185 class InstrumentScriptVMFunction_change_cutoff FINAL : public VMEmptyResultFunction {
186 public:
187 InstrumentScriptVMFunction_change_cutoff(InstrumentScriptVM* parent);
188 vmint minRequiredArgs() const OVERRIDE { return 2; }
189 vmint maxAllowedArgs() const OVERRIDE { return 2; }
190 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
191 bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
192 bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
193 bool acceptsArgFinal(vmint iArg) const OVERRIDE;
194 ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; }
195 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
196 protected:
197 InstrumentScriptVM* m_vm;
198 };
199
200 class InstrumentScriptVMFunction_change_reso FINAL : public VMEmptyResultFunction {
201 public:
202 InstrumentScriptVMFunction_change_reso(InstrumentScriptVM* parent);
203 vmint minRequiredArgs() const OVERRIDE { return 2; }
204 vmint maxAllowedArgs() const OVERRIDE { return 2; }
205 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
206 bool acceptsArgFinal(vmint iArg) const OVERRIDE;
207 ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; }
208 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
209 protected:
210 InstrumentScriptVM* m_vm;
211 };
212
213 class InstrumentScriptVMFunction_change_attack FINAL : public VMEmptyResultFunction {
214 public:
215 InstrumentScriptVMFunction_change_attack(InstrumentScriptVM* parent);
216 vmint minRequiredArgs() const OVERRIDE { return 2; }
217 vmint maxAllowedArgs() const OVERRIDE { return 2; }
218 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
219 bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
220 bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
221 bool acceptsArgFinal(vmint iArg) const OVERRIDE;
222 ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; }
223 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
224 protected:
225 InstrumentScriptVM* m_vm;
226 };
227
228 class InstrumentScriptVMFunction_change_decay FINAL : public VMEmptyResultFunction {
229 public:
230 InstrumentScriptVMFunction_change_decay(InstrumentScriptVM* parent);
231 vmint minRequiredArgs() const OVERRIDE { return 2; }
232 vmint maxAllowedArgs() const OVERRIDE { return 2; }
233 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
234 bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
235 bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
236 bool acceptsArgFinal(vmint iArg) const OVERRIDE;
237 ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; }
238 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
239 protected:
240 InstrumentScriptVM* m_vm;
241 };
242
243 class InstrumentScriptVMFunction_change_release FINAL : public VMEmptyResultFunction {
244 public:
245 InstrumentScriptVMFunction_change_release(InstrumentScriptVM* parent);
246 vmint minRequiredArgs() const OVERRIDE { return 2; }
247 vmint maxAllowedArgs() const OVERRIDE { return 2; }
248 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
249 bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
250 bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
251 bool acceptsArgFinal(vmint iArg) const OVERRIDE;
252 ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; }
253 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
254 protected:
255 InstrumentScriptVM* m_vm;
256 };
257
258 class VMChangeSynthParamFunction : public VMEmptyResultFunction {
259 public:
260 VMChangeSynthParamFunction(InstrumentScriptVM* parent, bool acceptFinal, StdUnit_t unit, bool acceptUnitPrefix)
261 : m_vm(parent), m_acceptFinal(acceptFinal), m_acceptUnitPrefix(acceptUnitPrefix), m_unit(unit) {}
262 vmint minRequiredArgs() const OVERRIDE { return 2; }
263 vmint maxAllowedArgs() const OVERRIDE { return 2; }
264 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
265 bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
266 bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
267 bool acceptsArgFinal(vmint iArg) const OVERRIDE;
268 ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; }
269
270 template<class T_NoteParamType, T_NoteParamType NoteBase::_Override::*T_noteParam,
271 vmint T_synthParam,
272 vmint T_minValueNorm, vmint T_maxValueNorm, bool T_normalizeNorm,
273 vmint T_minValueUnit, vmint T_maxValueUnit,
274 MetricPrefix_t T_unitPrefix0, MetricPrefix_t ... T_unitPrefixN>
275 VMFnResult* execTemplate(VMFnArgs* args, const char* functionName);
276 protected:
277 InstrumentScriptVM* m_vm;
278 const bool m_acceptFinal;
279 const bool m_acceptUnitPrefix;
280 const StdUnit_t m_unit;
281 };
282
283 class InstrumentScriptVMFunction_change_sustain FINAL : public VMChangeSynthParamFunction {
284 public:
285 InstrumentScriptVMFunction_change_sustain(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_BEL,true) {}
286 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
287 };
288
289 class InstrumentScriptVMFunction_change_cutoff_attack FINAL : public VMChangeSynthParamFunction {
290 public:
291 InstrumentScriptVMFunction_change_cutoff_attack(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_SECOND,true) {}
292 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
293 };
294
295 class InstrumentScriptVMFunction_change_cutoff_decay FINAL : public VMChangeSynthParamFunction {
296 public:
297 InstrumentScriptVMFunction_change_cutoff_decay(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_SECOND,true) {}
298 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
299 };
300
301 class InstrumentScriptVMFunction_change_cutoff_sustain FINAL : public VMChangeSynthParamFunction {
302 public:
303 InstrumentScriptVMFunction_change_cutoff_sustain(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_BEL,true) {}
304 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
305 };
306
307 class InstrumentScriptVMFunction_change_cutoff_release FINAL : public VMChangeSynthParamFunction {
308 public:
309 InstrumentScriptVMFunction_change_cutoff_release(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_SECOND,true) {}
310 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
311 };
312
313 class InstrumentScriptVMFunction_change_amp_lfo_depth FINAL : public VMChangeSynthParamFunction {
314 public:
315 InstrumentScriptVMFunction_change_amp_lfo_depth(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_NO_UNIT,false) {}
316 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
317 };
318
319 class InstrumentScriptVMFunction_change_amp_lfo_freq FINAL : public VMChangeSynthParamFunction {
320 public:
321 InstrumentScriptVMFunction_change_amp_lfo_freq(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_HERTZ,true) {}
322 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
323 };
324
325 class InstrumentScriptVMFunction_change_cutoff_lfo_depth FINAL : public VMChangeSynthParamFunction {
326 public:
327 InstrumentScriptVMFunction_change_cutoff_lfo_depth(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_NO_UNIT,false) {}
328 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
329 };
330
331 class InstrumentScriptVMFunction_change_cutoff_lfo_freq FINAL : public VMChangeSynthParamFunction {
332 public:
333 InstrumentScriptVMFunction_change_cutoff_lfo_freq(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_HERTZ,true) {}
334 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
335 };
336
337 class InstrumentScriptVMFunction_change_pitch_lfo_depth FINAL : public VMChangeSynthParamFunction {
338 public:
339 InstrumentScriptVMFunction_change_pitch_lfo_depth(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_NO_UNIT,false) {}
340 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
341 };
342
343 class InstrumentScriptVMFunction_change_pitch_lfo_freq FINAL : public VMChangeSynthParamFunction {
344 public:
345 InstrumentScriptVMFunction_change_pitch_lfo_freq(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_HERTZ,true) {}
346 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
347 };
348
349 class InstrumentScriptVMFunction_change_vol_time FINAL : public VMChangeSynthParamFunction {
350 public:
351 InstrumentScriptVMFunction_change_vol_time(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,false,VM_SECOND,true) {}
352 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
353 };
354
355 class InstrumentScriptVMFunction_change_tune_time FINAL : public VMChangeSynthParamFunction {
356 public:
357 InstrumentScriptVMFunction_change_tune_time(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,false,VM_SECOND,true) {}
358 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
359 };
360
361 class InstrumentScriptVMFunction_change_pan_time FINAL : public VMChangeSynthParamFunction {
362 public:
363 InstrumentScriptVMFunction_change_pan_time(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,false,VM_SECOND,true) {}
364 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
365 };
366
367 class VMChangeFadeCurveFunction : public VMEmptyResultFunction {
368 public:
369 VMChangeFadeCurveFunction(InstrumentScriptVM* parent) : m_vm(parent) {}
370 vmint minRequiredArgs() const OVERRIDE { return 2; }
371 vmint maxAllowedArgs() const OVERRIDE { return 2; }
372 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
373 ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; }
374
375 template<fade_curve_t NoteBase::_Override::*T_noteParam, vmint T_synthParam>
376 VMFnResult* execTemplate(VMFnArgs* args, const char* functionName);
377 protected:
378 InstrumentScriptVM* m_vm;
379 };
380
381 class InstrumentScriptVMFunction_change_vol_curve FINAL : public VMChangeFadeCurveFunction {
382 public:
383 InstrumentScriptVMFunction_change_vol_curve(InstrumentScriptVM* parent) : VMChangeFadeCurveFunction(parent) {}
384 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
385 };
386
387 class InstrumentScriptVMFunction_change_tune_curve FINAL : public VMChangeFadeCurveFunction {
388 public:
389 InstrumentScriptVMFunction_change_tune_curve(InstrumentScriptVM* parent) : VMChangeFadeCurveFunction(parent) {}
390 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
391 };
392
393 class InstrumentScriptVMFunction_change_pan_curve FINAL : public VMChangeFadeCurveFunction {
394 public:
395 InstrumentScriptVMFunction_change_pan_curve(InstrumentScriptVM* parent) : VMChangeFadeCurveFunction(parent) {}
396 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
397 };
398
399 class InstrumentScriptVMFunction_fade_in FINAL : public VMEmptyResultFunction {
400 public:
401 InstrumentScriptVMFunction_fade_in(InstrumentScriptVM* parent);
402 vmint minRequiredArgs() const OVERRIDE { return 2; }
403 vmint maxAllowedArgs() const OVERRIDE { return 2; }
404 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
405 bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
406 bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
407 ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; }
408 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
409 protected:
410 InstrumentScriptVM* m_vm;
411 };
412
413 class InstrumentScriptVMFunction_fade_out FINAL : public VMEmptyResultFunction {
414 public:
415 InstrumentScriptVMFunction_fade_out(InstrumentScriptVM* parent);
416 vmint minRequiredArgs() const OVERRIDE { return 2; }
417 vmint maxAllowedArgs() const OVERRIDE { return 3; }
418 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
419 bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
420 bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
421 ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; }
422 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
423 protected:
424 InstrumentScriptVM* m_vm;
425 };
426
427 class InstrumentScriptVMFunction_get_event_par FINAL : public VMIntResultFunction {
428 public:
429 InstrumentScriptVMFunction_get_event_par(InstrumentScriptVM* parent);
430 StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; }
431 bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }
432 vmint minRequiredArgs() const OVERRIDE { return 2; }
433 vmint maxAllowedArgs() const OVERRIDE { return 2; }
434 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
435 ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; }
436 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
437 protected:
438 InstrumentScriptVM* m_vm;
439 };
440
441 class InstrumentScriptVMFunction_set_event_par FINAL : public VMEmptyResultFunction {
442 public:
443 InstrumentScriptVMFunction_set_event_par(InstrumentScriptVM* parent);
444 vmint minRequiredArgs() const OVERRIDE { return 3; }
445 vmint maxAllowedArgs() const OVERRIDE { return 3; }
446 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
447 ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; }
448 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
449 protected:
450 InstrumentScriptVM* m_vm;
451 };
452
453 class InstrumentScriptVMFunction_change_note FINAL : public VMEmptyResultFunction {
454 public:
455 InstrumentScriptVMFunction_change_note(InstrumentScriptVM* parent);
456 vmint minRequiredArgs() const OVERRIDE { return 2; }
457 vmint maxAllowedArgs() const OVERRIDE { return 2; }
458 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
459 ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; }
460 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
461 protected:
462 InstrumentScriptVM* m_vm;
463 };
464
465 class InstrumentScriptVMFunction_change_velo FINAL : public VMEmptyResultFunction {
466 public:
467 InstrumentScriptVMFunction_change_velo(InstrumentScriptVM* parent);
468 vmint minRequiredArgs() const OVERRIDE { return 2; }
469 vmint maxAllowedArgs() const OVERRIDE { return 2; }
470 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
471 ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; }
472 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
473 protected:
474 InstrumentScriptVM* m_vm;
475 };
476
477 class InstrumentScriptVMFunction_change_play_pos FINAL : public VMEmptyResultFunction {
478 public:
479 InstrumentScriptVMFunction_change_play_pos(InstrumentScriptVM* parent);
480 vmint minRequiredArgs() const OVERRIDE { return 2; }
481 vmint maxAllowedArgs() const OVERRIDE { return 2; }
482 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR; }
483 bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
484 bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
485 ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; }
486 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
487 protected:
488 InstrumentScriptVM* m_vm;
489 };
490
491 class InstrumentScriptVMFunction_event_status FINAL : public VMIntResultFunction {
492 public:
493 InstrumentScriptVMFunction_event_status(InstrumentScriptVM* parent);
494 StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; }
495 bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }
496 vmint minRequiredArgs() const OVERRIDE { return 1; }
497 vmint maxAllowedArgs() const OVERRIDE { return 1; }
498 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
499 ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; }
500 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
501 protected:
502 InstrumentScriptVM* m_vm;
503 };
504
505 class InstrumentScriptVMFunction_callback_status FINAL : public VMIntResultFunction {
506 public:
507 InstrumentScriptVMFunction_callback_status(InstrumentScriptVM* parent);
508 StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; }
509 bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }
510 vmint minRequiredArgs() const OVERRIDE { return 1; }
511 vmint maxAllowedArgs() const OVERRIDE { return 1; }
512 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
513 ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; }
514 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
515 protected:
516 InstrumentScriptVM* m_vm;
517 };
518
519 // overrides core wait() implementation
520 class InstrumentScriptVMFunction_wait FINAL : public CoreVMFunction_wait {
521 public:
522 InstrumentScriptVMFunction_wait(InstrumentScriptVM* parent);
523 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
524 };
525
526 class InstrumentScriptVMFunction_stop_wait FINAL : public VMEmptyResultFunction {
527 public:
528 InstrumentScriptVMFunction_stop_wait(InstrumentScriptVM* parent);
529 vmint minRequiredArgs() const OVERRIDE { return 1; }
530 vmint maxAllowedArgs() const OVERRIDE { return 2; }
531 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
532 ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; }
533 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
534 protected:
535 InstrumentScriptVM* m_vm;
536 };
537
538 class InstrumentScriptVMFunction_abort FINAL : public VMEmptyResultFunction {
539 public:
540 InstrumentScriptVMFunction_abort(InstrumentScriptVM* parent);
541 vmint minRequiredArgs() const OVERRIDE { return 1; }
542 vmint maxAllowedArgs() const OVERRIDE { return 1; }
543 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR; }
544 ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; }
545 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
546 protected:
547 InstrumentScriptVM* m_vm;
548 };
549
550 class InstrumentScriptVMFunction_fork FINAL : public VMIntResultFunction {
551 public:
552 InstrumentScriptVMFunction_fork(InstrumentScriptVM* parent);
553 StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; }
554 bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }
555 vmint minRequiredArgs() const OVERRIDE { return 0; }
556 vmint maxAllowedArgs() const OVERRIDE { return 2; }
557 bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
558 ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; }
559 VMFnResult* exec(VMFnArgs* args) OVERRIDE;
560 protected:
561 InstrumentScriptVM* m_vm;
562 };
563
564 } // namespace LinuxSampler
565
566 #endif // LS_INSTRSCRIPTVMFUNCTIONS_H

  ViewVC Help
Powered by ViewVC