/[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 3188 - (hide annotations) (download) (as text)
Fri May 19 14:23:12 2017 UTC (6 years, 11 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 14062 byte(s)
* NKSP: Implemented built-in script function "change_vol_time()".
* NKSP: Implemented built-in script function "change_tune_time()".
* NKSP: Implemented built-in script function "fade_in()".
* NKSP: Implemented built-in script function "fade_out()".
* NKSP: Fixed acceptance of wrong data type of parameters passed to
  built-in script functions "change_vol()", "change_tune()",
  "change_pan()", "change_cutoff()", "change_reso()",
  "change_attack()", "change_decay()", "change_release()",
  "change_amp_lfo_depth()", "change_amp_lfo_freq()",
  "change_pitch_lfo_depth()" and "change_pitch_lfo_freq()".
* Bumped version (2.0.0.svn45).

1 schoenebeck 2596 /*
2 schoenebeck 3118 * Copyright (c) 2014 - 2017 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 2598 class InstrumentScriptVMFunction_play_note : public VMIntResultFunction {
23 schoenebeck 2596 public:
24     InstrumentScriptVMFunction_play_note(InstrumentScriptVM* parent);
25     int minRequiredArgs() const { return 1; }
26     int maxAllowedArgs() const { return 4; }
27     bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR;}
28     ExprType_t argType(int iArg) const { return INT_EXPR; }
29     VMFnResult* exec(VMFnArgs* args);
30     protected:
31     InstrumentScriptVM* m_vm;
32     };
33    
34 schoenebeck 2600 class InstrumentScriptVMFunction_set_controller : public VMIntResultFunction {
35     public:
36     InstrumentScriptVMFunction_set_controller(InstrumentScriptVM* parent);
37     int minRequiredArgs() const { return 2; }
38     int maxAllowedArgs() const { return 2; }
39     bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR;}
40     ExprType_t argType(int iArg) const { return INT_EXPR; }
41     VMFnResult* exec(VMFnArgs* args);
42     protected:
43     InstrumentScriptVM* m_vm;
44     };
45    
46 schoenebeck 2598 class InstrumentScriptVMFunction_ignore_event : public VMEmptyResultFunction {
47     public:
48     InstrumentScriptVMFunction_ignore_event(InstrumentScriptVM* parent);
49     int minRequiredArgs() const { return 1; }
50     int maxAllowedArgs() const { return 1; }
51 schoenebeck 2630 bool acceptsArgType(int iArg, ExprType_t type) const;
52 schoenebeck 2598 ExprType_t argType(int iArg) const { return INT_EXPR; }
53     VMFnResult* exec(VMFnArgs* args);
54     protected:
55     InstrumentScriptVM* m_vm;
56     };
57    
58     class InstrumentScriptVMFunction_ignore_controller : public VMEmptyResultFunction {
59     public:
60     InstrumentScriptVMFunction_ignore_controller(InstrumentScriptVM* parent);
61     int minRequiredArgs() const { return 0; }
62     int maxAllowedArgs() const { return 1; }
63     bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR;}
64     ExprType_t argType(int iArg) const { return INT_EXPR; }
65     VMFnResult* exec(VMFnArgs* args);
66     protected:
67     InstrumentScriptVM* m_vm;
68     };
69    
70 schoenebeck 2629 class InstrumentScriptVMFunction_note_off : public VMEmptyResultFunction {
71     public:
72     InstrumentScriptVMFunction_note_off(InstrumentScriptVM* parent);
73     int minRequiredArgs() const { return 1; }
74     int maxAllowedArgs() const { return 2; }
75 schoenebeck 2630 bool acceptsArgType(int iArg, ExprType_t type) const;
76     ExprType_t argType(int iArg) const { return INT_EXPR; }
77     VMFnResult* exec(VMFnArgs* args);
78     protected:
79     InstrumentScriptVM* m_vm;
80     };
81    
82     class InstrumentScriptVMFunction_set_event_mark : public VMEmptyResultFunction {
83     public:
84     InstrumentScriptVMFunction_set_event_mark(InstrumentScriptVM* parent);
85     int minRequiredArgs() const { return 2; }
86     int maxAllowedArgs() const { return 2; }
87 schoenebeck 2629 bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR;}
88     ExprType_t argType(int iArg) const { return INT_EXPR; }
89     VMFnResult* exec(VMFnArgs* args);
90     protected:
91     InstrumentScriptVM* m_vm;
92     };
93    
94 schoenebeck 2630 class InstrumentScriptVMFunction_delete_event_mark : public VMEmptyResultFunction {
95     public:
96     InstrumentScriptVMFunction_delete_event_mark(InstrumentScriptVM* parent);
97     int minRequiredArgs() const { return 2; }
98     int maxAllowedArgs() const { return 2; }
99     bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR;}
100     ExprType_t argType(int iArg) const { return INT_EXPR; }
101     VMFnResult* exec(VMFnArgs* args);
102     protected:
103     InstrumentScriptVM* m_vm;
104     };
105    
106     class InstrumentScriptVMFunction_by_marks : public VMFunction {
107     public:
108     InstrumentScriptVMFunction_by_marks(InstrumentScriptVM* parent);
109 schoenebeck 3054 int minRequiredArgs() const OVERRIDE { return 1; }
110     int maxAllowedArgs() const OVERRIDE { return 1; }
111     bool acceptsArgType(int iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}
112 schoenebeck 2945 bool modifiesArg(int iArg) const OVERRIDE { return false; }
113 schoenebeck 3054 ExprType_t argType(int iArg) const OVERRIDE { return INT_EXPR; }
114     ExprType_t returnType() OVERRIDE { return INT_ARR_EXPR; }
115     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     int arraySize() const OVERRIDE;
124     int evalIntElement(uint i) OVERRIDE;
125     void assignIntElement(uint i, int value) OVERRIDE {} // ignore assignment
126     VMExpr* resultValue() OVERRIDE { return this; }
127 schoenebeck 3054 StmtFlags_t resultFlags() OVERRIDE { return flags; }
128 schoenebeck 2945 bool isConstExpr() const OVERRIDE { return false; }
129 schoenebeck 2630 } m_result;
130    
131     VMFnResult* errorResult();
132     VMFnResult* successResult(EventGroup* eventGroup);
133     };
134    
135 schoenebeck 2931 class InstrumentScriptVMFunction_change_vol : public VMEmptyResultFunction {
136     public:
137     InstrumentScriptVMFunction_change_vol(InstrumentScriptVM* parent);
138     int minRequiredArgs() const { return 2; }
139     int maxAllowedArgs() const { return 3; }
140     bool acceptsArgType(int iArg, ExprType_t type) const;
141     ExprType_t argType(int iArg) const { return INT_EXPR; }
142     VMFnResult* exec(VMFnArgs* args);
143     protected:
144     InstrumentScriptVM* m_vm;
145     };
146    
147     class InstrumentScriptVMFunction_change_tune : public VMEmptyResultFunction {
148     public:
149     InstrumentScriptVMFunction_change_tune(InstrumentScriptVM* parent);
150     int minRequiredArgs() const { return 2; }
151     int maxAllowedArgs() const { return 3; }
152     bool acceptsArgType(int iArg, ExprType_t type) const;
153     ExprType_t argType(int iArg) const { return INT_EXPR; }
154     VMFnResult* exec(VMFnArgs* args);
155     protected:
156     InstrumentScriptVM* m_vm;
157     };
158    
159     class InstrumentScriptVMFunction_change_pan : public VMEmptyResultFunction {
160     public:
161     InstrumentScriptVMFunction_change_pan(InstrumentScriptVM* parent);
162     int minRequiredArgs() const { return 2; }
163     int maxAllowedArgs() const { return 3; }
164     bool acceptsArgType(int iArg, ExprType_t type) const;
165     ExprType_t argType(int iArg) const { return INT_EXPR; }
166     VMFnResult* exec(VMFnArgs* args);
167     protected:
168     InstrumentScriptVM* m_vm;
169     };
170    
171 schoenebeck 2935 class InstrumentScriptVMFunction_change_cutoff : public VMEmptyResultFunction {
172     public:
173     InstrumentScriptVMFunction_change_cutoff(InstrumentScriptVM* parent);
174     int minRequiredArgs() const { return 2; }
175     int maxAllowedArgs() const { return 2; }
176     bool acceptsArgType(int iArg, ExprType_t type) const;
177     ExprType_t argType(int iArg) const { return INT_EXPR; }
178     VMFnResult* exec(VMFnArgs* args);
179     protected:
180     InstrumentScriptVM* m_vm;
181     };
182    
183     class InstrumentScriptVMFunction_change_reso : public VMEmptyResultFunction {
184     public:
185     InstrumentScriptVMFunction_change_reso(InstrumentScriptVM* parent);
186     int minRequiredArgs() const { return 2; }
187     int maxAllowedArgs() const { return 2; }
188     bool acceptsArgType(int iArg, ExprType_t type) const;
189     ExprType_t argType(int iArg) const { return INT_EXPR; }
190     VMFnResult* exec(VMFnArgs* args);
191     protected:
192     InstrumentScriptVM* m_vm;
193     };
194 schoenebeck 2953
195     class InstrumentScriptVMFunction_change_attack : public VMEmptyResultFunction {
196     public:
197     InstrumentScriptVMFunction_change_attack(InstrumentScriptVM* parent);
198     int minRequiredArgs() const { return 2; }
199     int maxAllowedArgs() const { return 2; }
200     bool acceptsArgType(int iArg, ExprType_t type) const;
201     ExprType_t argType(int iArg) const { return INT_EXPR; }
202     VMFnResult* exec(VMFnArgs* args);
203     protected:
204     InstrumentScriptVM* m_vm;
205     };
206 schoenebeck 2935
207 schoenebeck 2953 class InstrumentScriptVMFunction_change_decay : public VMEmptyResultFunction {
208     public:
209     InstrumentScriptVMFunction_change_decay(InstrumentScriptVM* parent);
210     int minRequiredArgs() const { return 2; }
211     int maxAllowedArgs() const { return 2; }
212     bool acceptsArgType(int iArg, ExprType_t type) const;
213     ExprType_t argType(int iArg) const { return INT_EXPR; }
214     VMFnResult* exec(VMFnArgs* args);
215     protected:
216     InstrumentScriptVM* m_vm;
217     };
218    
219     class InstrumentScriptVMFunction_change_release : public VMEmptyResultFunction {
220     public:
221     InstrumentScriptVMFunction_change_release(InstrumentScriptVM* parent);
222     int minRequiredArgs() const { return 2; }
223     int maxAllowedArgs() const { return 2; }
224     bool acceptsArgType(int iArg, ExprType_t type) const;
225     ExprType_t argType(int iArg) const { return INT_EXPR; }
226     VMFnResult* exec(VMFnArgs* args);
227     protected:
228     InstrumentScriptVM* m_vm;
229     };
230    
231 schoenebeck 3118 class VMChangeSynthParamFunction : public VMEmptyResultFunction {
232     public:
233     VMChangeSynthParamFunction(InstrumentScriptVM* parent) : m_vm(parent) {}
234     int minRequiredArgs() const { return 2; }
235     int maxAllowedArgs() const { return 2; }
236     bool acceptsArgType(int iArg, ExprType_t type) const;
237     ExprType_t argType(int iArg) const { return INT_EXPR; }
238    
239 schoenebeck 3188 template<float NoteBase::_Override::*T_noteParam, int T_synthParam,
240     bool T_isNormalizedParam, int T_maxValue = 1000000,
241     int T_minValue = 0>
242 schoenebeck 3118 VMFnResult* execTemplate(VMFnArgs* args, const char* functionName);
243     protected:
244     InstrumentScriptVM* m_vm;
245     };
246    
247     class InstrumentScriptVMFunction_change_amp_lfo_depth : public VMChangeSynthParamFunction {
248     public:
249     InstrumentScriptVMFunction_change_amp_lfo_depth(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent) {}
250     VMFnResult* exec(VMFnArgs* args);
251     };
252    
253     class InstrumentScriptVMFunction_change_amp_lfo_freq : public VMChangeSynthParamFunction {
254     public:
255     InstrumentScriptVMFunction_change_amp_lfo_freq(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent) {}
256     VMFnResult* exec(VMFnArgs* args);
257     };
258    
259     class InstrumentScriptVMFunction_change_pitch_lfo_depth : public VMChangeSynthParamFunction {
260     public:
261     InstrumentScriptVMFunction_change_pitch_lfo_depth(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent) {}
262     VMFnResult* exec(VMFnArgs* args);
263     };
264    
265     class InstrumentScriptVMFunction_change_pitch_lfo_freq : public VMChangeSynthParamFunction {
266     public:
267     InstrumentScriptVMFunction_change_pitch_lfo_freq(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent) {}
268     VMFnResult* exec(VMFnArgs* args);
269     };
270    
271 schoenebeck 3188 class InstrumentScriptVMFunction_change_vol_time : public VMChangeSynthParamFunction {
272     public:
273     InstrumentScriptVMFunction_change_vol_time(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent) {}
274     VMFnResult* exec(VMFnArgs* args);
275     };
276    
277     class InstrumentScriptVMFunction_change_tune_time : public VMChangeSynthParamFunction {
278     public:
279     InstrumentScriptVMFunction_change_tune_time(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent) {}
280     VMFnResult* exec(VMFnArgs* args);
281     };
282    
283     class InstrumentScriptVMFunction_fade_in : public VMEmptyResultFunction {
284     public:
285     InstrumentScriptVMFunction_fade_in(InstrumentScriptVM* parent);
286     int minRequiredArgs() const { return 2; }
287     int maxAllowedArgs() const { return 2; }
288     bool acceptsArgType(int iArg, ExprType_t type) const;
289     ExprType_t argType(int iArg) const { return INT_EXPR; }
290     VMFnResult* exec(VMFnArgs* args);
291     protected:
292     InstrumentScriptVM* m_vm;
293     };
294    
295     class InstrumentScriptVMFunction_fade_out : public VMEmptyResultFunction {
296     public:
297     InstrumentScriptVMFunction_fade_out(InstrumentScriptVM* parent);
298     int minRequiredArgs() const { return 2; }
299     int maxAllowedArgs() const { return 3; }
300     bool acceptsArgType(int iArg, ExprType_t type) const;
301     ExprType_t argType(int iArg) const { return INT_EXPR; }
302     VMFnResult* exec(VMFnArgs* args);
303     protected:
304     InstrumentScriptVM* m_vm;
305     };
306    
307 schoenebeck 2935 class InstrumentScriptVMFunction_event_status : public VMIntResultFunction {
308     public:
309     InstrumentScriptVMFunction_event_status(InstrumentScriptVM* parent);
310     int minRequiredArgs() const { return 1; }
311     int maxAllowedArgs() const { return 1; }
312     bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR;}
313     ExprType_t argType(int iArg) const { return INT_EXPR; }
314     VMFnResult* exec(VMFnArgs* args);
315     protected:
316     InstrumentScriptVM* m_vm;
317     };
318    
319 schoenebeck 2948 // overrides core wait() implementation
320     class InstrumentScriptVMFunction_wait : public CoreVMFunction_wait {
321     public:
322     InstrumentScriptVMFunction_wait(InstrumentScriptVM* parent);
323     VMFnResult* exec(VMFnArgs* args);
324     };
325    
326     class InstrumentScriptVMFunction_stop_wait : public VMEmptyResultFunction {
327     public:
328     InstrumentScriptVMFunction_stop_wait(InstrumentScriptVM* parent);
329     int minRequiredArgs() const { return 1; }
330     int maxAllowedArgs() const { return 2; }
331     bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR;}
332     ExprType_t argType(int iArg) const { return INT_EXPR; }
333     VMFnResult* exec(VMFnArgs* args);
334     protected:
335     InstrumentScriptVM* m_vm;
336     };
337    
338 schoenebeck 2596 } // namespace LinuxSampler
339    
340     #endif // LS_INSTRSCRIPTVMFUNCTIONS_H

  ViewVC Help
Powered by ViewVC