--- linuxsampler/trunk/src/engines/common/InstrumentScriptVMFunctions.h 2016/07/14 00:22:26 2945 +++ linuxsampler/trunk/src/engines/common/InstrumentScriptVMFunctions.h 2017/04/21 13:33:03 3118 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 - 2016 Christian Schoenebeck + * Copyright (c) 2014 - 2017 Christian Schoenebeck * * http://www.linuxsampler.org * @@ -12,6 +12,7 @@ #include "../../common/global.h" #include "../../scriptvm/CoreVMFunctions.h" +#include "Note.h" namespace LinuxSampler { @@ -105,13 +106,13 @@ class InstrumentScriptVMFunction_by_marks : public VMFunction { public: InstrumentScriptVMFunction_by_marks(InstrumentScriptVM* parent); - int minRequiredArgs() const { return 1; } - int maxAllowedArgs() const { return 1; } - bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR;} + int minRequiredArgs() const OVERRIDE { return 1; } + int maxAllowedArgs() const OVERRIDE { return 1; } + bool acceptsArgType(int iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;} bool modifiesArg(int iArg) const OVERRIDE { return false; } - ExprType_t argType(int iArg) const { return INT_EXPR; } - ExprType_t returnType() { return INT_ARR_EXPR; } - VMFnResult* exec(VMFnArgs* args); + ExprType_t argType(int iArg) const OVERRIDE { return INT_EXPR; } + ExprType_t returnType() OVERRIDE { return INT_ARR_EXPR; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; protected: InstrumentScriptVM* m_vm; class Result : public VMFnResult, public VMIntArrayExpr { @@ -123,7 +124,7 @@ int evalIntElement(uint i) OVERRIDE; void assignIntElement(uint i, int value) OVERRIDE {} // ignore assignment VMExpr* resultValue() OVERRIDE { return this; } - StmtFlags_t resultFlags() { return flags; } + StmtFlags_t resultFlags() OVERRIDE { return flags; } bool isConstExpr() const OVERRIDE { return false; } } m_result; @@ -190,6 +191,80 @@ protected: InstrumentScriptVM* m_vm; }; + + class InstrumentScriptVMFunction_change_attack : public VMEmptyResultFunction { + public: + InstrumentScriptVMFunction_change_attack(InstrumentScriptVM* parent); + int minRequiredArgs() const { return 2; } + int maxAllowedArgs() const { return 2; } + bool acceptsArgType(int iArg, ExprType_t type) const; + ExprType_t argType(int iArg) const { return INT_EXPR; } + VMFnResult* exec(VMFnArgs* args); + protected: + InstrumentScriptVM* m_vm; + }; + + class InstrumentScriptVMFunction_change_decay : public VMEmptyResultFunction { + public: + InstrumentScriptVMFunction_change_decay(InstrumentScriptVM* parent); + int minRequiredArgs() const { return 2; } + int maxAllowedArgs() const { return 2; } + bool acceptsArgType(int iArg, ExprType_t type) const; + ExprType_t argType(int iArg) const { return INT_EXPR; } + VMFnResult* exec(VMFnArgs* args); + protected: + InstrumentScriptVM* m_vm; + }; + + class InstrumentScriptVMFunction_change_release : public VMEmptyResultFunction { + public: + InstrumentScriptVMFunction_change_release(InstrumentScriptVM* parent); + int minRequiredArgs() const { return 2; } + int maxAllowedArgs() const { return 2; } + bool acceptsArgType(int iArg, ExprType_t type) const; + ExprType_t argType(int iArg) const { return INT_EXPR; } + VMFnResult* exec(VMFnArgs* args); + protected: + InstrumentScriptVM* m_vm; + }; + + class VMChangeSynthParamFunction : public VMEmptyResultFunction { + public: + VMChangeSynthParamFunction(InstrumentScriptVM* parent) : m_vm(parent) {} + int minRequiredArgs() const { return 2; } + int maxAllowedArgs() const { return 2; } + bool acceptsArgType(int iArg, ExprType_t type) const; + ExprType_t argType(int iArg) const { return INT_EXPR; } + + template + VMFnResult* execTemplate(VMFnArgs* args, const char* functionName); + protected: + InstrumentScriptVM* m_vm; + }; + + class InstrumentScriptVMFunction_change_amp_lfo_depth : public VMChangeSynthParamFunction { + public: + InstrumentScriptVMFunction_change_amp_lfo_depth(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent) {} + VMFnResult* exec(VMFnArgs* args); + }; + + class InstrumentScriptVMFunction_change_amp_lfo_freq : public VMChangeSynthParamFunction { + public: + InstrumentScriptVMFunction_change_amp_lfo_freq(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent) {} + VMFnResult* exec(VMFnArgs* args); + }; + + class InstrumentScriptVMFunction_change_pitch_lfo_depth : public VMChangeSynthParamFunction { + public: + InstrumentScriptVMFunction_change_pitch_lfo_depth(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent) {} + VMFnResult* exec(VMFnArgs* args); + }; + + class InstrumentScriptVMFunction_change_pitch_lfo_freq : public VMChangeSynthParamFunction { + public: + InstrumentScriptVMFunction_change_pitch_lfo_freq(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent) {} + VMFnResult* exec(VMFnArgs* args); + }; class InstrumentScriptVMFunction_event_status : public VMIntResultFunction { public: @@ -199,6 +274,25 @@ bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR;} ExprType_t argType(int iArg) const { return INT_EXPR; } VMFnResult* exec(VMFnArgs* args); + protected: + InstrumentScriptVM* m_vm; + }; + + // overrides core wait() implementation + class InstrumentScriptVMFunction_wait : public CoreVMFunction_wait { + public: + InstrumentScriptVMFunction_wait(InstrumentScriptVM* parent); + VMFnResult* exec(VMFnArgs* args); + }; + + class InstrumentScriptVMFunction_stop_wait : public VMEmptyResultFunction { + public: + InstrumentScriptVMFunction_stop_wait(InstrumentScriptVM* parent); + int minRequiredArgs() const { return 1; } + int maxAllowedArgs() const { return 2; } + bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR;} + ExprType_t argType(int iArg) const { return INT_EXPR; } + VMFnResult* exec(VMFnArgs* args); protected: InstrumentScriptVM* m_vm; };