1 |
/* |
2 |
* Copyright (c) 2014 - 2020 Christian Schoenebeck |
3 |
* |
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 |
#include "Note.h" |
16 |
|
17 |
namespace LinuxSampler { |
18 |
|
19 |
class EventGroup; |
20 |
class InstrumentScriptVM; |
21 |
|
22 |
class InstrumentScriptVMFunction_play_note FINAL : public VMIntResultFunction { |
23 |
using Super = VMIntResultFunction; // just an alias for the super class |
24 |
public: |
25 |
InstrumentScriptVMFunction_play_note(InstrumentScriptVM* parent); |
26 |
StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; } |
27 |
bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; } |
28 |
vmint minRequiredArgs() const OVERRIDE { return 1; } |
29 |
vmint maxAllowedArgs() const OVERRIDE { return 4; } |
30 |
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 |
void checkArgs(VMFnArgs* args, std::function<void(String)> err, |
34 |
std::function<void(String)> wrn) OVERRIDE; |
35 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
36 |
protected: |
37 |
InstrumentScriptVM* m_vm; |
38 |
}; |
39 |
|
40 |
class InstrumentScriptVMFunction_set_controller FINAL : public VMIntResultFunction { |
41 |
public: |
42 |
InstrumentScriptVMFunction_set_controller(InstrumentScriptVM* parent); |
43 |
StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; } |
44 |
bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; } |
45 |
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 |
protected: |
50 |
InstrumentScriptVM* m_vm; |
51 |
}; |
52 |
|
53 |
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 |
class InstrumentScriptVMFunction_ignore_event FINAL : public VMEmptyResultFunction { |
80 |
public: |
81 |
InstrumentScriptVMFunction_ignore_event(InstrumentScriptVM* parent); |
82 |
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 |
protected: |
87 |
InstrumentScriptVM* m_vm; |
88 |
}; |
89 |
|
90 |
class InstrumentScriptVMFunction_ignore_controller FINAL : public VMEmptyResultFunction { |
91 |
public: |
92 |
InstrumentScriptVMFunction_ignore_controller(InstrumentScriptVM* parent); |
93 |
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 |
protected: |
98 |
InstrumentScriptVM* m_vm; |
99 |
}; |
100 |
|
101 |
class InstrumentScriptVMFunction_note_off FINAL : public VMEmptyResultFunction { |
102 |
using Super = VMEmptyResultFunction; // just an alias for the super class |
103 |
public: |
104 |
InstrumentScriptVMFunction_note_off(InstrumentScriptVM* parent); |
105 |
vmint minRequiredArgs() const OVERRIDE { return 1; } |
106 |
vmint maxAllowedArgs() const OVERRIDE { return 2; } |
107 |
bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; |
108 |
void checkArgs(VMFnArgs* args, std::function<void(String)> err, |
109 |
std::function<void(String)> wrn) OVERRIDE; |
110 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
111 |
protected: |
112 |
InstrumentScriptVM* m_vm; |
113 |
}; |
114 |
|
115 |
class InstrumentScriptVMFunction_set_event_mark FINAL : public VMEmptyResultFunction { |
116 |
using Super = VMEmptyResultFunction; // just an alias for the super class |
117 |
public: |
118 |
InstrumentScriptVMFunction_set_event_mark(InstrumentScriptVM* parent); |
119 |
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 |
void checkArgs(VMFnArgs* args, std::function<void(String)> err, |
123 |
std::function<void(String)> wrn) OVERRIDE; |
124 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
125 |
protected: |
126 |
InstrumentScriptVM* m_vm; |
127 |
}; |
128 |
|
129 |
class InstrumentScriptVMFunction_delete_event_mark FINAL : public VMEmptyResultFunction { |
130 |
using Super = VMEmptyResultFunction; // just an alias for the super class |
131 |
public: |
132 |
InstrumentScriptVMFunction_delete_event_mark(InstrumentScriptVM* parent); |
133 |
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 |
void checkArgs(VMFnArgs* args, std::function<void(String)> err, |
137 |
std::function<void(String)> wrn) OVERRIDE; |
138 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
139 |
protected: |
140 |
InstrumentScriptVM* m_vm; |
141 |
}; |
142 |
|
143 |
class InstrumentScriptVMFunction_by_marks FINAL : public VMFunction { |
144 |
using Super = VMFunction; // just an alias for the super class |
145 |
public: |
146 |
InstrumentScriptVMFunction_by_marks(InstrumentScriptVM* parent); |
147 |
StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; } |
148 |
bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; } |
149 |
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 |
ExprType_t returnType(VMFnArgs* args) OVERRIDE { return INT_ARR_EXPR; } |
154 |
void checkArgs(VMFnArgs* args, std::function<void(String)> err, |
155 |
std::function<void(String)> wrn) OVERRIDE; |
156 |
VMFnResult* allocResult(VMFnArgs* args) OVERRIDE; |
157 |
void bindResult(VMFnResult* res) OVERRIDE; |
158 |
VMFnResult* boundResult() const OVERRIDE; |
159 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
160 |
protected: |
161 |
InstrumentScriptVM* m_vm; |
162 |
class Result : public VMFnResult, public VMIntArrayExpr { |
163 |
public: |
164 |
StmtFlags_t flags; |
165 |
EventGroup* eventGroup; |
166 |
|
167 |
vmint arraySize() const OVERRIDE; |
168 |
vmint evalIntElement(vmuint i) OVERRIDE; |
169 |
void assignIntElement(vmuint i, vmint value) OVERRIDE {} // ignore assignment |
170 |
vmfloat unitFactorOfElement(vmuint i) const OVERRIDE { return VM_NO_FACTOR; } |
171 |
void assignElementUnitFactor(vmuint i, vmfloat factor) OVERRIDE {} // ignore assignment |
172 |
VMExpr* resultValue() OVERRIDE { return this; } |
173 |
StmtFlags_t resultFlags() OVERRIDE { return flags; } |
174 |
bool isConstExpr() const OVERRIDE { return false; } |
175 |
} *m_result; |
176 |
|
177 |
VMFnResult* errorResult(); |
178 |
VMFnResult* successResult(EventGroup* eventGroup); |
179 |
}; |
180 |
|
181 |
class InstrumentScriptVMFunction_change_vol FINAL : public VMEmptyResultFunction { |
182 |
public: |
183 |
InstrumentScriptVMFunction_change_vol(InstrumentScriptVM* parent); |
184 |
vmint minRequiredArgs() const OVERRIDE { return 2; } |
185 |
vmint maxAllowedArgs() const OVERRIDE { return 3; } |
186 |
bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; |
187 |
bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE; |
188 |
bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE; |
189 |
bool acceptsArgFinal(vmint iArg) const OVERRIDE; |
190 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
191 |
protected: |
192 |
InstrumentScriptVM* m_vm; |
193 |
}; |
194 |
|
195 |
class InstrumentScriptVMFunction_change_tune FINAL : public VMEmptyResultFunction { |
196 |
public: |
197 |
InstrumentScriptVMFunction_change_tune(InstrumentScriptVM* parent); |
198 |
vmint minRequiredArgs() const OVERRIDE { return 2; } |
199 |
vmint maxAllowedArgs() const OVERRIDE { return 3; } |
200 |
bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; |
201 |
bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE; |
202 |
bool acceptsArgFinal(vmint iArg) const OVERRIDE; |
203 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
204 |
protected: |
205 |
InstrumentScriptVM* m_vm; |
206 |
}; |
207 |
|
208 |
class InstrumentScriptVMFunction_change_pan FINAL : public VMEmptyResultFunction { |
209 |
public: |
210 |
InstrumentScriptVMFunction_change_pan(InstrumentScriptVM* parent); |
211 |
vmint minRequiredArgs() const OVERRIDE { return 2; } |
212 |
vmint maxAllowedArgs() const OVERRIDE { return 3; } |
213 |
bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; |
214 |
bool acceptsArgFinal(vmint iArg) const OVERRIDE; |
215 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
216 |
protected: |
217 |
InstrumentScriptVM* m_vm; |
218 |
}; |
219 |
|
220 |
class InstrumentScriptVMFunction_change_cutoff FINAL : public VMEmptyResultFunction { |
221 |
using Super = VMEmptyResultFunction; // just an alias for the super class |
222 |
public: |
223 |
InstrumentScriptVMFunction_change_cutoff(InstrumentScriptVM* parent); |
224 |
vmint minRequiredArgs() const OVERRIDE { return 2; } |
225 |
vmint maxAllowedArgs() const OVERRIDE { return 2; } |
226 |
bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; |
227 |
bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE; |
228 |
bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE; |
229 |
bool acceptsArgFinal(vmint iArg) const OVERRIDE; |
230 |
void checkArgs(VMFnArgs* args, std::function<void(String)> err, |
231 |
std::function<void(String)> wrn) OVERRIDE; |
232 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
233 |
protected: |
234 |
InstrumentScriptVM* m_vm; |
235 |
}; |
236 |
|
237 |
class InstrumentScriptVMFunction_change_reso FINAL : public VMEmptyResultFunction { |
238 |
public: |
239 |
InstrumentScriptVMFunction_change_reso(InstrumentScriptVM* parent); |
240 |
vmint minRequiredArgs() const OVERRIDE { return 2; } |
241 |
vmint maxAllowedArgs() const OVERRIDE { return 2; } |
242 |
bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; |
243 |
bool acceptsArgFinal(vmint iArg) const OVERRIDE; |
244 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
245 |
protected: |
246 |
InstrumentScriptVM* m_vm; |
247 |
}; |
248 |
|
249 |
//TODO: Derive from generalized, shared template class VMChangeSynthParamFunction instead (like e.g. change_cutoff_attack() implementation below already does). |
250 |
class InstrumentScriptVMFunction_change_attack FINAL : public VMEmptyResultFunction { |
251 |
using Super = VMEmptyResultFunction; // just an alias for the super class |
252 |
public: |
253 |
InstrumentScriptVMFunction_change_attack(InstrumentScriptVM* parent); |
254 |
vmint minRequiredArgs() const OVERRIDE { return 2; } |
255 |
vmint maxAllowedArgs() const OVERRIDE { return 2; } |
256 |
bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; |
257 |
bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE; |
258 |
bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE; |
259 |
bool acceptsArgFinal(vmint iArg) const OVERRIDE; |
260 |
void checkArgs(VMFnArgs* args, std::function<void(String)> err, |
261 |
std::function<void(String)> wrn) OVERRIDE; |
262 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
263 |
protected: |
264 |
InstrumentScriptVM* m_vm; |
265 |
}; |
266 |
|
267 |
//TODO: Derive from generalized, shared template class VMChangeSynthParamFunction instead (like e.g. change_cutoff_decay() implementation below already does). |
268 |
class InstrumentScriptVMFunction_change_decay FINAL : public VMEmptyResultFunction { |
269 |
using Super = VMEmptyResultFunction; // just an alias for the super class |
270 |
public: |
271 |
InstrumentScriptVMFunction_change_decay(InstrumentScriptVM* parent); |
272 |
vmint minRequiredArgs() const OVERRIDE { return 2; } |
273 |
vmint maxAllowedArgs() const OVERRIDE { return 2; } |
274 |
bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; |
275 |
bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE; |
276 |
bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE; |
277 |
bool acceptsArgFinal(vmint iArg) const OVERRIDE; |
278 |
void checkArgs(VMFnArgs* args, std::function<void(String)> err, |
279 |
std::function<void(String)> wrn) OVERRIDE; |
280 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
281 |
protected: |
282 |
InstrumentScriptVM* m_vm; |
283 |
}; |
284 |
|
285 |
//TODO: Derive from generalized, shared template class VMChangeSynthParamFunction instead (like e.g. change_cutoff_release() implementation below already does). |
286 |
class InstrumentScriptVMFunction_change_release FINAL : public VMEmptyResultFunction { |
287 |
using Super = VMEmptyResultFunction; // just an alias for the super class |
288 |
public: |
289 |
InstrumentScriptVMFunction_change_release(InstrumentScriptVM* parent); |
290 |
vmint minRequiredArgs() const OVERRIDE { return 2; } |
291 |
vmint maxAllowedArgs() const OVERRIDE { return 2; } |
292 |
bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; |
293 |
bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE; |
294 |
bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE; |
295 |
bool acceptsArgFinal(vmint iArg) const OVERRIDE; |
296 |
void checkArgs(VMFnArgs* args, std::function<void(String)> err, |
297 |
std::function<void(String)> wrn) OVERRIDE; |
298 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
299 |
protected: |
300 |
InstrumentScriptVM* m_vm; |
301 |
}; |
302 |
|
303 |
class VMChangeSynthParamFunction : public VMEmptyResultFunction { |
304 |
using Super = VMEmptyResultFunction; // just an alias for the super class |
305 |
public: |
306 |
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 |
vmint minRequiredArgs() const OVERRIDE { return 2; } |
318 |
vmint maxAllowedArgs() const OVERRIDE { return 2; } |
319 |
bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; |
320 |
bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE; |
321 |
bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE; |
322 |
bool acceptsArgFinal(vmint iArg) const OVERRIDE; |
323 |
void checkArgs(VMFnArgs* args, std::function<void(String)> err, |
324 |
std::function<void(String)> wrn) OVERRIDE; |
325 |
|
326 |
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 |
VMFnResult* execTemplate(VMFnArgs* args, const char* functionName); |
332 |
protected: |
333 |
InstrumentScriptVM* const m_vm; |
334 |
const bool m_acceptReal; |
335 |
const bool m_acceptFinal; |
336 |
const bool m_acceptUnitPrefix; |
337 |
const StdUnit_t m_unit; |
338 |
}; |
339 |
|
340 |
class InstrumentScriptVMFunction_change_sustain FINAL : public VMChangeSynthParamFunction { |
341 |
public: |
342 |
InstrumentScriptVMFunction_change_sustain(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({ |
343 |
.vm = parent, |
344 |
.acceptFinal = true, |
345 |
.unit = VM_BEL, |
346 |
.acceptUnitPrefix = true, |
347 |
.acceptReal = true, |
348 |
}) {} |
349 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
350 |
}; |
351 |
|
352 |
class InstrumentScriptVMFunction_change_cutoff_attack FINAL : public VMChangeSynthParamFunction { |
353 |
public: |
354 |
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 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
362 |
}; |
363 |
|
364 |
class InstrumentScriptVMFunction_change_cutoff_decay FINAL : public VMChangeSynthParamFunction { |
365 |
public: |
366 |
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 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
374 |
}; |
375 |
|
376 |
class InstrumentScriptVMFunction_change_cutoff_sustain FINAL : public VMChangeSynthParamFunction { |
377 |
public: |
378 |
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 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
386 |
}; |
387 |
|
388 |
class InstrumentScriptVMFunction_change_cutoff_release FINAL : public VMChangeSynthParamFunction { |
389 |
public: |
390 |
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 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
398 |
}; |
399 |
|
400 |
class InstrumentScriptVMFunction_change_amp_lfo_depth FINAL : public VMChangeSynthParamFunction { |
401 |
public: |
402 |
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 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
410 |
}; |
411 |
|
412 |
class InstrumentScriptVMFunction_change_amp_lfo_freq FINAL : public VMChangeSynthParamFunction { |
413 |
public: |
414 |
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 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
422 |
}; |
423 |
|
424 |
class InstrumentScriptVMFunction_change_cutoff_lfo_depth FINAL : public VMChangeSynthParamFunction { |
425 |
public: |
426 |
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 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
434 |
}; |
435 |
|
436 |
class InstrumentScriptVMFunction_change_cutoff_lfo_freq FINAL : public VMChangeSynthParamFunction { |
437 |
public: |
438 |
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 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
446 |
}; |
447 |
|
448 |
class InstrumentScriptVMFunction_change_pitch_lfo_depth FINAL : public VMChangeSynthParamFunction { |
449 |
public: |
450 |
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 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
458 |
}; |
459 |
|
460 |
class InstrumentScriptVMFunction_change_pitch_lfo_freq FINAL : public VMChangeSynthParamFunction { |
461 |
public: |
462 |
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 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
470 |
}; |
471 |
|
472 |
class InstrumentScriptVMFunction_change_vol_time FINAL : public VMChangeSynthParamFunction { |
473 |
public: |
474 |
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 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
482 |
}; |
483 |
|
484 |
class InstrumentScriptVMFunction_change_tune_time FINAL : public VMChangeSynthParamFunction { |
485 |
public: |
486 |
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 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
494 |
}; |
495 |
|
496 |
class InstrumentScriptVMFunction_change_pan_time FINAL : public VMChangeSynthParamFunction { |
497 |
public: |
498 |
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 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
506 |
}; |
507 |
|
508 |
class VMChangeFadeCurveFunction : public VMEmptyResultFunction { |
509 |
public: |
510 |
VMChangeFadeCurveFunction(InstrumentScriptVM* parent) : m_vm(parent) {} |
511 |
vmint minRequiredArgs() const OVERRIDE { return 2; } |
512 |
vmint maxAllowedArgs() const OVERRIDE { return 2; } |
513 |
bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; |
514 |
|
515 |
template<fade_curve_t NoteBase::_Override::*T_noteParam, vmint T_synthParam> |
516 |
VMFnResult* execTemplate(VMFnArgs* args, const char* functionName); |
517 |
protected: |
518 |
InstrumentScriptVM* m_vm; |
519 |
}; |
520 |
|
521 |
class InstrumentScriptVMFunction_change_vol_curve FINAL : public VMChangeFadeCurveFunction { |
522 |
public: |
523 |
InstrumentScriptVMFunction_change_vol_curve(InstrumentScriptVM* parent) : VMChangeFadeCurveFunction(parent) {} |
524 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
525 |
}; |
526 |
|
527 |
class InstrumentScriptVMFunction_change_tune_curve FINAL : public VMChangeFadeCurveFunction { |
528 |
public: |
529 |
InstrumentScriptVMFunction_change_tune_curve(InstrumentScriptVM* parent) : VMChangeFadeCurveFunction(parent) {} |
530 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
531 |
}; |
532 |
|
533 |
class InstrumentScriptVMFunction_change_pan_curve FINAL : public VMChangeFadeCurveFunction { |
534 |
public: |
535 |
InstrumentScriptVMFunction_change_pan_curve(InstrumentScriptVM* parent) : VMChangeFadeCurveFunction(parent) {} |
536 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
537 |
}; |
538 |
|
539 |
class InstrumentScriptVMFunction_fade_in FINAL : public VMEmptyResultFunction { |
540 |
public: |
541 |
InstrumentScriptVMFunction_fade_in(InstrumentScriptVM* parent); |
542 |
vmint minRequiredArgs() const OVERRIDE { return 2; } |
543 |
vmint maxAllowedArgs() const OVERRIDE { return 2; } |
544 |
bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; |
545 |
bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE; |
546 |
bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE; |
547 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
548 |
protected: |
549 |
InstrumentScriptVM* m_vm; |
550 |
}; |
551 |
|
552 |
class InstrumentScriptVMFunction_fade_out FINAL : public VMEmptyResultFunction { |
553 |
public: |
554 |
InstrumentScriptVMFunction_fade_out(InstrumentScriptVM* parent); |
555 |
vmint minRequiredArgs() const OVERRIDE { return 2; } |
556 |
vmint maxAllowedArgs() const OVERRIDE { return 3; } |
557 |
bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; |
558 |
bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE; |
559 |
bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE; |
560 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
561 |
protected: |
562 |
InstrumentScriptVM* m_vm; |
563 |
}; |
564 |
|
565 |
class InstrumentScriptVMFunction_get_event_par FINAL : public VMIntResultFunction { |
566 |
public: |
567 |
InstrumentScriptVMFunction_get_event_par(InstrumentScriptVM* parent); |
568 |
StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; } |
569 |
bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; } |
570 |
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 |
protected: |
575 |
InstrumentScriptVM* m_vm; |
576 |
}; |
577 |
|
578 |
class InstrumentScriptVMFunction_set_event_par FINAL : public VMEmptyResultFunction { |
579 |
public: |
580 |
InstrumentScriptVMFunction_set_event_par(InstrumentScriptVM* parent); |
581 |
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 |
protected: |
586 |
InstrumentScriptVM* m_vm; |
587 |
}; |
588 |
|
589 |
class InstrumentScriptVMFunction_change_note FINAL : public VMEmptyResultFunction { |
590 |
public: |
591 |
InstrumentScriptVMFunction_change_note(InstrumentScriptVM* parent); |
592 |
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 |
protected: |
597 |
InstrumentScriptVM* m_vm; |
598 |
}; |
599 |
|
600 |
class InstrumentScriptVMFunction_change_velo FINAL : public VMEmptyResultFunction { |
601 |
public: |
602 |
InstrumentScriptVMFunction_change_velo(InstrumentScriptVM* parent); |
603 |
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 |
protected: |
608 |
InstrumentScriptVM* m_vm; |
609 |
}; |
610 |
|
611 |
class InstrumentScriptVMFunction_change_play_pos FINAL : public VMEmptyResultFunction { |
612 |
public: |
613 |
InstrumentScriptVMFunction_change_play_pos(InstrumentScriptVM* parent); |
614 |
vmint minRequiredArgs() const OVERRIDE { return 2; } |
615 |
vmint maxAllowedArgs() const OVERRIDE { return 2; } |
616 |
bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; |
617 |
bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE; |
618 |
bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE; |
619 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
620 |
protected: |
621 |
InstrumentScriptVM* m_vm; |
622 |
}; |
623 |
|
624 |
class InstrumentScriptVMFunction_event_status FINAL : public VMIntResultFunction { |
625 |
public: |
626 |
InstrumentScriptVMFunction_event_status(InstrumentScriptVM* parent); |
627 |
StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; } |
628 |
bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; } |
629 |
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 |
protected: |
634 |
InstrumentScriptVM* m_vm; |
635 |
}; |
636 |
|
637 |
class InstrumentScriptVMFunction_callback_status FINAL : public VMIntResultFunction { |
638 |
public: |
639 |
InstrumentScriptVMFunction_callback_status(InstrumentScriptVM* parent); |
640 |
StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; } |
641 |
bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; } |
642 |
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 |
protected: |
647 |
InstrumentScriptVM* m_vm; |
648 |
}; |
649 |
|
650 |
// overrides core wait() implementation |
651 |
class InstrumentScriptVMFunction_wait FINAL : public CoreVMFunction_wait { |
652 |
public: |
653 |
InstrumentScriptVMFunction_wait(InstrumentScriptVM* parent); |
654 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
655 |
}; |
656 |
|
657 |
class InstrumentScriptVMFunction_stop_wait FINAL : public VMEmptyResultFunction { |
658 |
public: |
659 |
InstrumentScriptVMFunction_stop_wait(InstrumentScriptVM* parent); |
660 |
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 |
protected: |
665 |
InstrumentScriptVM* m_vm; |
666 |
}; |
667 |
|
668 |
class InstrumentScriptVMFunction_abort FINAL : public VMEmptyResultFunction { |
669 |
public: |
670 |
InstrumentScriptVMFunction_abort(InstrumentScriptVM* parent); |
671 |
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 |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
675 |
protected: |
676 |
InstrumentScriptVM* m_vm; |
677 |
}; |
678 |
|
679 |
class InstrumentScriptVMFunction_fork FINAL : public VMIntResultFunction { |
680 |
public: |
681 |
InstrumentScriptVMFunction_fork(InstrumentScriptVM* parent); |
682 |
StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; } |
683 |
bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; } |
684 |
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 |
protected: |
689 |
InstrumentScriptVM* m_vm; |
690 |
}; |
691 |
|
692 |
} // namespace LinuxSampler |
693 |
|
694 |
#endif // LS_INSTRSCRIPTVMFUNCTIONS_H |