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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2600 by schoenebeck, Sat Jun 7 00:16:03 2014 UTC revision 3587 by schoenebeck, Sat Aug 31 12:08:49 2019 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (c) 2014 Christian Schoenebeck   * Copyright (c) 2014 - 2019 Christian Schoenebeck
3   *   *
4   * http://www.linuxsampler.org   * http://www.linuxsampler.org
5   *   *
# Line 12  Line 12 
12    
13  #include "../../common/global.h"  #include "../../common/global.h"
14  #include "../../scriptvm/CoreVMFunctions.h"  #include "../../scriptvm/CoreVMFunctions.h"
15    #include "Note.h"
16    
17  namespace LinuxSampler {  namespace LinuxSampler {
18    
19        class EventGroup;
20      class InstrumentScriptVM;      class InstrumentScriptVM;
21    
22      class InstrumentScriptVMFunction_play_note : public VMIntResultFunction {      class InstrumentScriptVMFunction_play_note FINAL : public VMIntResultFunction {
23      public:      public:
24          InstrumentScriptVMFunction_play_note(InstrumentScriptVM* parent);          InstrumentScriptVMFunction_play_note(InstrumentScriptVM* parent);
25          int minRequiredArgs() const { return 1; }          StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; }
26          int maxAllowedArgs() const { return 4; }          bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }
27          bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR;}          vmint minRequiredArgs() const OVERRIDE { return 1; }
28          ExprType_t argType(int iArg) const { return INT_EXPR; }          vmint maxAllowedArgs() const OVERRIDE { return 4; }
29          VMFnResult* exec(VMFnArgs* args);          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            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
33      protected:      protected:
34          InstrumentScriptVM* m_vm;          InstrumentScriptVM* m_vm;
35      };      };
36    
37      class InstrumentScriptVMFunction_set_controller : public VMIntResultFunction {      class InstrumentScriptVMFunction_set_controller FINAL : public VMIntResultFunction {
38      public:      public:
39          InstrumentScriptVMFunction_set_controller(InstrumentScriptVM* parent);          InstrumentScriptVMFunction_set_controller(InstrumentScriptVM* parent);
40          int minRequiredArgs() const { return 2; }          StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; }
41          int maxAllowedArgs() const { return 2; }          bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }
42          bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR;}          vmint minRequiredArgs() const OVERRIDE { return 2; }
43          ExprType_t argType(int iArg) const { return INT_EXPR; }          vmint maxAllowedArgs() const OVERRIDE { return 2; }
44          VMFnResult* exec(VMFnArgs* args);          bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
45            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
46      protected:      protected:
47          InstrumentScriptVM* m_vm;          InstrumentScriptVM* m_vm;
48      };      };
49    
50      class InstrumentScriptVMFunction_ignore_event : public VMEmptyResultFunction {      class InstrumentScriptVMFunction_ignore_event FINAL : public VMEmptyResultFunction {
51      public:      public:
52          InstrumentScriptVMFunction_ignore_event(InstrumentScriptVM* parent);          InstrumentScriptVMFunction_ignore_event(InstrumentScriptVM* parent);
53          int minRequiredArgs() const { return 1; }          vmint minRequiredArgs() const OVERRIDE { return 0; }
54          int maxAllowedArgs() const { return 1; }          vmint maxAllowedArgs() const OVERRIDE { return 1; }
55          bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR;}          bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
56          ExprType_t argType(int iArg) const { return INT_EXPR; }          VMFnResult* exec(VMFnArgs* args) OVERRIDE;
         VMFnResult* exec(VMFnArgs* args);  
57      protected:      protected:
58          InstrumentScriptVM* m_vm;          InstrumentScriptVM* m_vm;
59      };      };
60    
61      class InstrumentScriptVMFunction_ignore_controller : public VMEmptyResultFunction {      class InstrumentScriptVMFunction_ignore_controller FINAL : public VMEmptyResultFunction {
62      public:      public:
63          InstrumentScriptVMFunction_ignore_controller(InstrumentScriptVM* parent);          InstrumentScriptVMFunction_ignore_controller(InstrumentScriptVM* parent);
64          int minRequiredArgs() const { return 0; }          vmint minRequiredArgs() const OVERRIDE { return 0; }
65          int maxAllowedArgs() const { return 1; }          vmint maxAllowedArgs() const OVERRIDE { return 1; }
66          bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR;}          bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
67          ExprType_t argType(int iArg) const { return INT_EXPR; }          VMFnResult* exec(VMFnArgs* args) OVERRIDE;
68          VMFnResult* exec(VMFnArgs* args);      protected:
69            InstrumentScriptVM* m_vm;
70        };
71    
72        class InstrumentScriptVMFunction_note_off FINAL : public VMEmptyResultFunction {
73        public:
74            InstrumentScriptVMFunction_note_off(InstrumentScriptVM* parent);
75            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        protected:
80            InstrumentScriptVM* m_vm;
81        };
82    
83        class InstrumentScriptVMFunction_set_event_mark FINAL : public VMEmptyResultFunction {
84        public:
85            InstrumentScriptVMFunction_set_event_mark(InstrumentScriptVM* parent);
86            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        protected:
91            InstrumentScriptVM* m_vm;
92        };
93    
94        class InstrumentScriptVMFunction_delete_event_mark FINAL : public VMEmptyResultFunction {
95        public:
96            InstrumentScriptVMFunction_delete_event_mark(InstrumentScriptVM* parent);
97            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        protected:
102            InstrumentScriptVM* m_vm;
103        };
104    
105        class InstrumentScriptVMFunction_by_marks FINAL : public VMFunction {
106        public:
107            InstrumentScriptVMFunction_by_marks(InstrumentScriptVM* parent);
108            StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; }
109            bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }
110            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            ExprType_t returnType(VMFnArgs* args) OVERRIDE { return INT_ARR_EXPR; }
115            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
116        protected:
117            InstrumentScriptVM* m_vm;
118            class Result : public VMFnResult, public VMIntArrayExpr {
119            public:
120                StmtFlags_t flags;
121                EventGroup* eventGroup;
122    
123                vmint arraySize() const OVERRIDE;
124                vmint evalIntElement(vmuint i) OVERRIDE;
125                void assignIntElement(vmuint i, vmint value) OVERRIDE {} // ignore assignment
126                vmfloat unitFactorOfElement(vmuint i) const OVERRIDE { return VM_NO_FACTOR; }
127                void assignElementUnitFactor(vmuint i, vmfloat factor) OVERRIDE {} // ignore assignment
128                VMExpr* resultValue() OVERRIDE { return this; }
129                StmtFlags_t resultFlags() OVERRIDE { return flags; }
130                bool isConstExpr() const OVERRIDE { return false; }
131            } m_result;
132    
133            VMFnResult* errorResult();
134            VMFnResult* successResult(EventGroup* eventGroup);
135        };
136    
137        class InstrumentScriptVMFunction_change_vol FINAL : public VMEmptyResultFunction {
138        public:
139            InstrumentScriptVMFunction_change_vol(InstrumentScriptVM* parent);
140            vmint minRequiredArgs() const OVERRIDE { return 2; }
141            vmint maxAllowedArgs() const OVERRIDE { return 3; }
142            bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
143            bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
144            bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
145            bool acceptsArgFinal(vmint iArg) const OVERRIDE;
146            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
147        protected:
148            InstrumentScriptVM* m_vm;
149        };
150    
151        class InstrumentScriptVMFunction_change_tune FINAL : public VMEmptyResultFunction {
152        public:
153            InstrumentScriptVMFunction_change_tune(InstrumentScriptVM* parent);
154            vmint minRequiredArgs() const OVERRIDE { return 2; }
155            vmint maxAllowedArgs() const OVERRIDE { return 3; }
156            bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
157            bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
158            bool acceptsArgFinal(vmint iArg) const OVERRIDE;
159            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
160        protected:
161            InstrumentScriptVM* m_vm;
162        };
163    
164        class InstrumentScriptVMFunction_change_pan FINAL : public VMEmptyResultFunction {
165        public:
166            InstrumentScriptVMFunction_change_pan(InstrumentScriptVM* parent);
167            vmint minRequiredArgs() const OVERRIDE { return 2; }
168            vmint maxAllowedArgs() const OVERRIDE { return 3; }
169            bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
170            bool acceptsArgFinal(vmint iArg) const OVERRIDE;
171            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
172        protected:
173            InstrumentScriptVM* m_vm;
174        };
175    
176        class InstrumentScriptVMFunction_change_cutoff FINAL : public VMEmptyResultFunction {
177        public:
178            InstrumentScriptVMFunction_change_cutoff(InstrumentScriptVM* parent);
179            vmint minRequiredArgs() const OVERRIDE { return 2; }
180            vmint maxAllowedArgs() const OVERRIDE { return 2; }
181            bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
182            bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
183            bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
184            bool acceptsArgFinal(vmint iArg) const OVERRIDE;
185            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
186        protected:
187            InstrumentScriptVM* m_vm;
188        };
189    
190        class InstrumentScriptVMFunction_change_reso FINAL : public VMEmptyResultFunction {
191        public:
192            InstrumentScriptVMFunction_change_reso(InstrumentScriptVM* parent);
193            vmint minRequiredArgs() const OVERRIDE { return 2; }
194            vmint maxAllowedArgs() const OVERRIDE { return 2; }
195            bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
196            bool acceptsArgFinal(vmint iArg) const OVERRIDE;
197            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
198        protected:
199            InstrumentScriptVM* m_vm;
200        };
201        
202        class InstrumentScriptVMFunction_change_attack FINAL : public VMEmptyResultFunction {
203        public:
204            InstrumentScriptVMFunction_change_attack(InstrumentScriptVM* parent);
205            vmint minRequiredArgs() const OVERRIDE { return 2; }
206            vmint maxAllowedArgs() const OVERRIDE { return 2; }
207            bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
208            bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
209            bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
210            bool acceptsArgFinal(vmint iArg) const OVERRIDE;
211            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
212        protected:
213            InstrumentScriptVM* m_vm;
214        };
215    
216        class InstrumentScriptVMFunction_change_decay FINAL : public VMEmptyResultFunction {
217        public:
218            InstrumentScriptVMFunction_change_decay(InstrumentScriptVM* parent);
219            vmint minRequiredArgs() const OVERRIDE { return 2; }
220            vmint maxAllowedArgs() const OVERRIDE { return 2; }
221            bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
222            bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
223            bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
224            bool acceptsArgFinal(vmint iArg) const OVERRIDE;
225            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
226        protected:
227            InstrumentScriptVM* m_vm;
228        };
229        
230        class InstrumentScriptVMFunction_change_release FINAL : public VMEmptyResultFunction {
231        public:
232            InstrumentScriptVMFunction_change_release(InstrumentScriptVM* parent);
233            vmint minRequiredArgs() const OVERRIDE { return 2; }
234            vmint maxAllowedArgs() const OVERRIDE { return 2; }
235            bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
236            bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
237            bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
238            bool acceptsArgFinal(vmint iArg) const OVERRIDE;
239            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
240        protected:
241            InstrumentScriptVM* m_vm;
242        };
243    
244        class VMChangeSynthParamFunction : public VMEmptyResultFunction {
245        public:
246            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            vmint minRequiredArgs() const OVERRIDE { return 2; }
258            vmint maxAllowedArgs() const OVERRIDE { return 2; }
259            bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
260            bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
261            bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
262            bool acceptsArgFinal(vmint iArg) const OVERRIDE;
263    
264            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            VMFnResult* execTemplate(VMFnArgs* args, const char* functionName);
270        protected:
271            InstrumentScriptVM* const m_vm;
272            const bool m_acceptReal;
273            const bool m_acceptFinal;
274            const bool m_acceptUnitPrefix;
275            const StdUnit_t m_unit;
276        };
277    
278        class InstrumentScriptVMFunction_change_sustain FINAL : public VMChangeSynthParamFunction {
279        public:
280            InstrumentScriptVMFunction_change_sustain(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
281                .vm = parent,
282                .acceptFinal = true,
283                .unit = VM_BEL,
284                .acceptUnitPrefix = true,
285                .acceptReal = true,
286            }) {}
287            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
288        };
289    
290        class InstrumentScriptVMFunction_change_cutoff_attack FINAL : public VMChangeSynthParamFunction {
291        public:
292            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            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
300        };
301    
302        class InstrumentScriptVMFunction_change_cutoff_decay FINAL : public VMChangeSynthParamFunction {
303        public:
304            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            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
312        };
313    
314        class InstrumentScriptVMFunction_change_cutoff_sustain FINAL : public VMChangeSynthParamFunction {
315        public:
316            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            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
324        };
325    
326        class InstrumentScriptVMFunction_change_cutoff_release FINAL : public VMChangeSynthParamFunction {
327        public:
328            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            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
336        };
337    
338        class InstrumentScriptVMFunction_change_amp_lfo_depth FINAL : public VMChangeSynthParamFunction {
339        public:
340            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            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
348        };
349    
350        class InstrumentScriptVMFunction_change_amp_lfo_freq FINAL : public VMChangeSynthParamFunction {
351        public:
352            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            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
360        };
361    
362        class InstrumentScriptVMFunction_change_cutoff_lfo_depth FINAL : public VMChangeSynthParamFunction {
363        public:
364            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            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
372        };
373    
374        class InstrumentScriptVMFunction_change_cutoff_lfo_freq FINAL : public VMChangeSynthParamFunction {
375        public:
376            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            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
384        };
385    
386        class InstrumentScriptVMFunction_change_pitch_lfo_depth FINAL : public VMChangeSynthParamFunction {
387        public:
388            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            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
396        };
397    
398        class InstrumentScriptVMFunction_change_pitch_lfo_freq FINAL : public VMChangeSynthParamFunction {
399        public:
400            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            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
408        };
409    
410        class InstrumentScriptVMFunction_change_vol_time FINAL : public VMChangeSynthParamFunction {
411        public:
412            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            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
420        };
421    
422        class InstrumentScriptVMFunction_change_tune_time FINAL : public VMChangeSynthParamFunction {
423        public:
424            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            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
432        };
433    
434        class InstrumentScriptVMFunction_change_pan_time FINAL : public VMChangeSynthParamFunction {
435        public:
436            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            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
444        };
445    
446        class VMChangeFadeCurveFunction : public VMEmptyResultFunction {
447        public:
448            VMChangeFadeCurveFunction(InstrumentScriptVM* parent) : m_vm(parent) {}
449            vmint minRequiredArgs() const OVERRIDE { return 2; }
450            vmint maxAllowedArgs() const OVERRIDE { return 2; }
451            bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
452    
453            template<fade_curve_t NoteBase::_Override::*T_noteParam, vmint T_synthParam>
454            VMFnResult* execTemplate(VMFnArgs* args, const char* functionName);
455        protected:
456            InstrumentScriptVM* m_vm;
457        };
458    
459        class InstrumentScriptVMFunction_change_vol_curve FINAL : public VMChangeFadeCurveFunction {
460        public:
461            InstrumentScriptVMFunction_change_vol_curve(InstrumentScriptVM* parent) : VMChangeFadeCurveFunction(parent) {}
462            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
463        };
464    
465        class InstrumentScriptVMFunction_change_tune_curve FINAL : public VMChangeFadeCurveFunction {
466        public:
467            InstrumentScriptVMFunction_change_tune_curve(InstrumentScriptVM* parent) : VMChangeFadeCurveFunction(parent) {}
468            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
469        };
470    
471        class InstrumentScriptVMFunction_change_pan_curve FINAL : public VMChangeFadeCurveFunction {
472        public:
473            InstrumentScriptVMFunction_change_pan_curve(InstrumentScriptVM* parent) : VMChangeFadeCurveFunction(parent) {}
474            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
475        };
476    
477        class InstrumentScriptVMFunction_fade_in FINAL : public VMEmptyResultFunction {
478        public:
479            InstrumentScriptVMFunction_fade_in(InstrumentScriptVM* parent);
480            vmint minRequiredArgs() const OVERRIDE { return 2; }
481            vmint maxAllowedArgs() const OVERRIDE { return 2; }
482            bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
483            bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
484            bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
485            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
486        protected:
487            InstrumentScriptVM* m_vm;
488        };
489    
490        class InstrumentScriptVMFunction_fade_out FINAL : public VMEmptyResultFunction {
491        public:
492            InstrumentScriptVMFunction_fade_out(InstrumentScriptVM* parent);
493            vmint minRequiredArgs() const OVERRIDE { return 2; }
494            vmint maxAllowedArgs() const OVERRIDE { return 3; }
495            bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
496            bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
497            bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
498            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
499        protected:
500            InstrumentScriptVM* m_vm;
501        };
502    
503        class InstrumentScriptVMFunction_get_event_par FINAL : public VMIntResultFunction {
504        public:
505            InstrumentScriptVMFunction_get_event_par(InstrumentScriptVM* parent);
506            StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; }
507            bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }
508            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        protected:
513            InstrumentScriptVM* m_vm;
514        };
515    
516        class InstrumentScriptVMFunction_set_event_par FINAL : public VMEmptyResultFunction {
517        public:
518            InstrumentScriptVMFunction_set_event_par(InstrumentScriptVM* parent);
519            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        protected:
524            InstrumentScriptVM* m_vm;
525        };
526    
527        class InstrumentScriptVMFunction_change_note FINAL : public VMEmptyResultFunction {
528        public:
529            InstrumentScriptVMFunction_change_note(InstrumentScriptVM* parent);
530            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        protected:
535            InstrumentScriptVM* m_vm;
536        };
537    
538        class InstrumentScriptVMFunction_change_velo FINAL : public VMEmptyResultFunction {
539        public:
540            InstrumentScriptVMFunction_change_velo(InstrumentScriptVM* parent);
541            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        protected:
546            InstrumentScriptVM* m_vm;
547        };
548    
549        class InstrumentScriptVMFunction_change_play_pos FINAL : public VMEmptyResultFunction {
550        public:
551            InstrumentScriptVMFunction_change_play_pos(InstrumentScriptVM* parent);
552            vmint minRequiredArgs() const OVERRIDE { return 2; }
553            vmint maxAllowedArgs() const OVERRIDE { return 2; }
554            bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
555            bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
556            bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
557            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
558        protected:
559            InstrumentScriptVM* m_vm;
560        };
561    
562        class InstrumentScriptVMFunction_event_status FINAL : public VMIntResultFunction {
563        public:
564            InstrumentScriptVMFunction_event_status(InstrumentScriptVM* parent);
565            StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; }
566            bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }
567            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        protected:
572            InstrumentScriptVM* m_vm;
573        };
574    
575        class InstrumentScriptVMFunction_callback_status FINAL : public VMIntResultFunction {
576        public:
577            InstrumentScriptVMFunction_callback_status(InstrumentScriptVM* parent);
578            StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; }
579            bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }
580            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        protected:
585            InstrumentScriptVM* m_vm;
586        };
587    
588        // overrides core wait() implementation
589        class InstrumentScriptVMFunction_wait FINAL : public CoreVMFunction_wait {
590        public:
591            InstrumentScriptVMFunction_wait(InstrumentScriptVM* parent);
592            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
593        };
594    
595        class InstrumentScriptVMFunction_stop_wait FINAL : public VMEmptyResultFunction {
596        public:
597            InstrumentScriptVMFunction_stop_wait(InstrumentScriptVM* parent);
598            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        protected:
603            InstrumentScriptVM* m_vm;
604        };
605    
606        class InstrumentScriptVMFunction_abort FINAL : public VMEmptyResultFunction {
607        public:
608            InstrumentScriptVMFunction_abort(InstrumentScriptVM* parent);
609            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            VMFnResult* exec(VMFnArgs* args) OVERRIDE;
613        protected:
614            InstrumentScriptVM* m_vm;
615        };
616    
617        class InstrumentScriptVMFunction_fork FINAL : public VMIntResultFunction {
618        public:
619            InstrumentScriptVMFunction_fork(InstrumentScriptVM* parent);
620            StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; }
621            bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }
622            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      protected:      protected:
627          InstrumentScriptVM* m_vm;          InstrumentScriptVM* m_vm;
628      };      };

Legend:
Removed from v.2600  
changed lines
  Added in v.3587

  ViewVC Help
Powered by ViewVC