1 |
/* |
/* |
2 |
* Copyright (c) 2014 - 2016 Christian Schoenebeck |
* Copyright (c) 2014 - 2017 Christian Schoenebeck |
3 |
* |
* |
4 |
* http://www.linuxsampler.org |
* http://www.linuxsampler.org |
5 |
* |
* |
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 |
|
|
106 |
class InstrumentScriptVMFunction_by_marks : public VMFunction { |
class InstrumentScriptVMFunction_by_marks : public VMFunction { |
107 |
public: |
public: |
108 |
InstrumentScriptVMFunction_by_marks(InstrumentScriptVM* parent); |
InstrumentScriptVMFunction_by_marks(InstrumentScriptVM* parent); |
109 |
int minRequiredArgs() const { return 1; } |
int minRequiredArgs() const OVERRIDE { return 1; } |
110 |
int maxAllowedArgs() const { return 1; } |
int maxAllowedArgs() const OVERRIDE { return 1; } |
111 |
bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR;} |
bool acceptsArgType(int iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;} |
112 |
bool modifiesArg(int iArg) const OVERRIDE { return false; } |
bool modifiesArg(int iArg) const OVERRIDE { return false; } |
113 |
ExprType_t argType(int iArg) const { return INT_EXPR; } |
ExprType_t argType(int iArg) const OVERRIDE { return INT_EXPR; } |
114 |
ExprType_t returnType() { return INT_ARR_EXPR; } |
ExprType_t returnType() OVERRIDE { return INT_ARR_EXPR; } |
115 |
VMFnResult* exec(VMFnArgs* args); |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
116 |
protected: |
protected: |
117 |
InstrumentScriptVM* m_vm; |
InstrumentScriptVM* m_vm; |
118 |
class Result : public VMFnResult, public VMIntArrayExpr { |
class Result : public VMFnResult, public VMIntArrayExpr { |
124 |
int evalIntElement(uint i) OVERRIDE; |
int evalIntElement(uint i) OVERRIDE; |
125 |
void assignIntElement(uint i, int value) OVERRIDE {} // ignore assignment |
void assignIntElement(uint i, int value) OVERRIDE {} // ignore assignment |
126 |
VMExpr* resultValue() OVERRIDE { return this; } |
VMExpr* resultValue() OVERRIDE { return this; } |
127 |
StmtFlags_t resultFlags() { return flags; } |
StmtFlags_t resultFlags() OVERRIDE { return flags; } |
128 |
bool isConstExpr() const OVERRIDE { return false; } |
bool isConstExpr() const OVERRIDE { return false; } |
129 |
} m_result; |
} m_result; |
130 |
|
|
191 |
protected: |
protected: |
192 |
InstrumentScriptVM* m_vm; |
InstrumentScriptVM* m_vm; |
193 |
}; |
}; |
194 |
|
|
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 |
|
|
207 |
|
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 |
|
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 |
|
template<float NoteBase::_Override::*T_noteParam, int T_synthParam> |
240 |
|
VMFnResult* execTemplate(VMFnArgs* args, const char* functionName); |
241 |
|
protected: |
242 |
|
InstrumentScriptVM* m_vm; |
243 |
|
}; |
244 |
|
|
245 |
|
class InstrumentScriptVMFunction_change_amp_lfo_depth : public VMChangeSynthParamFunction { |
246 |
|
public: |
247 |
|
InstrumentScriptVMFunction_change_amp_lfo_depth(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent) {} |
248 |
|
VMFnResult* exec(VMFnArgs* args); |
249 |
|
}; |
250 |
|
|
251 |
|
class InstrumentScriptVMFunction_change_amp_lfo_freq : public VMChangeSynthParamFunction { |
252 |
|
public: |
253 |
|
InstrumentScriptVMFunction_change_amp_lfo_freq(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent) {} |
254 |
|
VMFnResult* exec(VMFnArgs* args); |
255 |
|
}; |
256 |
|
|
257 |
|
class InstrumentScriptVMFunction_change_pitch_lfo_depth : public VMChangeSynthParamFunction { |
258 |
|
public: |
259 |
|
InstrumentScriptVMFunction_change_pitch_lfo_depth(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent) {} |
260 |
|
VMFnResult* exec(VMFnArgs* args); |
261 |
|
}; |
262 |
|
|
263 |
|
class InstrumentScriptVMFunction_change_pitch_lfo_freq : public VMChangeSynthParamFunction { |
264 |
|
public: |
265 |
|
InstrumentScriptVMFunction_change_pitch_lfo_freq(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent) {} |
266 |
|
VMFnResult* exec(VMFnArgs* args); |
267 |
|
}; |
268 |
|
|
269 |
class InstrumentScriptVMFunction_event_status : public VMIntResultFunction { |
class InstrumentScriptVMFunction_event_status : public VMIntResultFunction { |
270 |
public: |
public: |
274 |
bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR;} |
bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR;} |
275 |
ExprType_t argType(int iArg) const { return INT_EXPR; } |
ExprType_t argType(int iArg) const { return INT_EXPR; } |
276 |
VMFnResult* exec(VMFnArgs* args); |
VMFnResult* exec(VMFnArgs* args); |
277 |
|
protected: |
278 |
|
InstrumentScriptVM* m_vm; |
279 |
|
}; |
280 |
|
|
281 |
|
// overrides core wait() implementation |
282 |
|
class InstrumentScriptVMFunction_wait : public CoreVMFunction_wait { |
283 |
|
public: |
284 |
|
InstrumentScriptVMFunction_wait(InstrumentScriptVM* parent); |
285 |
|
VMFnResult* exec(VMFnArgs* args); |
286 |
|
}; |
287 |
|
|
288 |
|
class InstrumentScriptVMFunction_stop_wait : public VMEmptyResultFunction { |
289 |
|
public: |
290 |
|
InstrumentScriptVMFunction_stop_wait(InstrumentScriptVM* parent); |
291 |
|
int minRequiredArgs() const { return 1; } |
292 |
|
int maxAllowedArgs() const { return 2; } |
293 |
|
bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR;} |
294 |
|
ExprType_t argType(int iArg) const { return INT_EXPR; } |
295 |
|
VMFnResult* exec(VMFnArgs* args); |
296 |
protected: |
protected: |
297 |
InstrumentScriptVM* m_vm; |
InstrumentScriptVM* m_vm; |
298 |
}; |
}; |