/[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 3747 - (hide annotations) (download) (as text)
Sun Feb 16 11:31:46 2020 UTC (4 years, 2 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 32585 byte(s)
* NKSP: Fixed re-entrant issue with function calls which caused wrong
  result values if the same function was called multiple times in a term
  (specifically if metric prefixes were used).

* Tests: Added NKSP core language test cases to guard this fixed issue.

* Bumped version (2.1.1.svn50).

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

  ViewVC Help
Powered by ViewVC