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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3588 - (hide annotations) (download) (as text)
Sun Sep 1 16:06:48 2019 UTC (4 years, 7 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 30649 byte(s)
NKSP: Built-in instrument functions fixes & hardening:

* Fixed the following built-in functions having misinterpreted values given
  with unit type (for their 2nd argument) as if they were relative values
  (that is as if they were passed without a unit type): "change_attack()",
  "change_decay()", "change_release()", "change_cutoff_attack()",
  "change_cutoff_decay()", "change_cutoff_release()".

* Fixed the following built-in functions having applied completely wrong
  'final' values: "change_sustain()", "change_cutoff_sustain()" (since the
  respective EGs being their modulation sink assume uint data type with
  value range 0..1000 instead of 0.0..1.0.

* Added individual parse-time checks of function arguments for the following
  built-in functions: "play_note()", "note_off()", "set_event_mark()",
  "delete_event_mark()", "by_marks()", "change_cutoff()", "change_attack()",
  "change_decay()", "change_release()", "change_cutoff_attack()",
  "change_cutoff_decay()", "change_cutoff_release()",
  "change_amp_lfo_freq()", "change_cutoff_lfo_freq()",
  "change_pitch_lfo_freq()", "change_vol_time()", "change_tune_time()" and
  "change_pan_time()".

* Don't abort function call if unit type was used and at the same time
  'final' operator was omitted for the primary value argument of the
  following built-in functions: "change_cutoff()", "change_attack()",
  "change_decay()", "change_release()", "change_cutoff_attack()",
  "change_cutoff_decay()", "change_cutoff_release()",
  "change_amp_lfo_freq()", "change_cutoff_lfo_freq()",
  "change_pitch_lfo_freq()", "change_vol_time()", "change_tune_time()",
  "change_pan_time()", instead imply 'final'ness at runtime and raise an
  appropriate parser warning at parse time.

* Bumped version (2.1.1.svn13).

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

  ViewVC Help
Powered by ViewVC