/[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 3587 - (hide annotations) (download) (as text)
Sat Aug 31 12:08:49 2019 UTC (4 years, 7 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 28462 byte(s)
NKSP: Real number support for core instrument built-in functions.

* NKSP: Built-in function "play_note()" accepts now real numbers and
  seconds as unit type as well for its 3rd and 4th function arguments.

* NKSP: The following built-in functions accept now real numbers as well for
  their 2nd function argument: "change_vol()", "change_tune()",
  "change_cutoff()", "change_attack()", "change_decay()",
  "change_release()", "change_sustain()", "change_cutoff_attack()",
  "change_cutoff_decay()", "change_cutoff_sustain()",
  "change_cutoff_release()", "change_amp_lfo_freq()",
  "change_cutoff_lfo_freq()", "change_pitch_lfo_freq()",
  "change_vol_time()", "change_tune_time()", "change_pan_time()",
  "fade_in()", "fade_out()", "change_play_pos()".

* NKSP: Fixed built-in function "change_play_pos()" not having accepted
  metric prefixes at all.

* Bumped version (2.1.1.svn12).

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

  ViewVC Help
Powered by ViewVC