--- linuxsampler/trunk/src/engines/common/InstrumentScriptVMFunctions.h 2017/07/20 12:05:53 3316 +++ linuxsampler/trunk/src/engines/common/InstrumentScriptVMFunctions.h 2019/08/30 11:40:25 3581 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 - 2017 Christian Schoenebeck + * Copyright (c) 2014 - 2019 Christian Schoenebeck * * http://www.linuxsampler.org * @@ -19,99 +19,105 @@ class EventGroup; class InstrumentScriptVM; - class InstrumentScriptVMFunction_play_note : public VMIntResultFunction { + class InstrumentScriptVMFunction_play_note FINAL : public VMIntResultFunction { public: InstrumentScriptVMFunction_play_note(InstrumentScriptVM* parent); - int minRequiredArgs() const { return 1; } - int maxAllowedArgs() const { return 4; } - 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); + StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; } + bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; } + vmint minRequiredArgs() const OVERRIDE { return 1; } + vmint maxAllowedArgs() const OVERRIDE { return 4; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;} + ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; protected: InstrumentScriptVM* m_vm; }; - class InstrumentScriptVMFunction_set_controller : public VMIntResultFunction { + class InstrumentScriptVMFunction_set_controller FINAL : public VMIntResultFunction { public: InstrumentScriptVMFunction_set_controller(InstrumentScriptVM* parent); - int minRequiredArgs() const { return 2; } - 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); + StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; } + bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; } + vmint minRequiredArgs() const OVERRIDE { return 2; } + vmint maxAllowedArgs() const OVERRIDE { return 2; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;} + ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; protected: InstrumentScriptVM* m_vm; }; - class InstrumentScriptVMFunction_ignore_event : public VMEmptyResultFunction { + class InstrumentScriptVMFunction_ignore_event FINAL : public VMEmptyResultFunction { public: InstrumentScriptVMFunction_ignore_event(InstrumentScriptVM* parent); - int minRequiredArgs() const { return 0; } - int maxAllowedArgs() const { return 1; } - bool acceptsArgType(int iArg, ExprType_t type) const; - ExprType_t argType(int iArg) const { return INT_EXPR; } - VMFnResult* exec(VMFnArgs* args); + vmint minRequiredArgs() const OVERRIDE { return 0; } + vmint maxAllowedArgs() const OVERRIDE { return 1; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; + ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; protected: InstrumentScriptVM* m_vm; }; - class InstrumentScriptVMFunction_ignore_controller : public VMEmptyResultFunction { + class InstrumentScriptVMFunction_ignore_controller FINAL : public VMEmptyResultFunction { public: InstrumentScriptVMFunction_ignore_controller(InstrumentScriptVM* parent); - int minRequiredArgs() const { return 0; } - int maxAllowedArgs() const { return 1; } - 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); + vmint minRequiredArgs() const OVERRIDE { return 0; } + vmint maxAllowedArgs() const OVERRIDE { return 1; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;} + ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; protected: InstrumentScriptVM* m_vm; }; - class InstrumentScriptVMFunction_note_off : public VMEmptyResultFunction { + class InstrumentScriptVMFunction_note_off FINAL : public VMEmptyResultFunction { public: InstrumentScriptVMFunction_note_off(InstrumentScriptVM* parent); - int minRequiredArgs() const { return 1; } - 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); + vmint minRequiredArgs() const OVERRIDE { return 1; } + vmint maxAllowedArgs() const OVERRIDE { return 2; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; + ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; protected: InstrumentScriptVM* m_vm; }; - class InstrumentScriptVMFunction_set_event_mark : public VMEmptyResultFunction { + class InstrumentScriptVMFunction_set_event_mark FINAL : public VMEmptyResultFunction { public: InstrumentScriptVMFunction_set_event_mark(InstrumentScriptVM* parent); - int minRequiredArgs() const { return 2; } - 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); + vmint minRequiredArgs() const OVERRIDE { return 2; } + vmint maxAllowedArgs() const OVERRIDE { return 2; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;} + ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; protected: InstrumentScriptVM* m_vm; }; - class InstrumentScriptVMFunction_delete_event_mark : public VMEmptyResultFunction { + class InstrumentScriptVMFunction_delete_event_mark FINAL : public VMEmptyResultFunction { public: InstrumentScriptVMFunction_delete_event_mark(InstrumentScriptVM* parent); - int minRequiredArgs() const { return 2; } - 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); + vmint minRequiredArgs() const OVERRIDE { return 2; } + vmint maxAllowedArgs() const OVERRIDE { return 2; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;} + ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; protected: InstrumentScriptVM* m_vm; }; - class InstrumentScriptVMFunction_by_marks : public VMFunction { + class InstrumentScriptVMFunction_by_marks FINAL : public VMFunction { public: InstrumentScriptVMFunction_by_marks(InstrumentScriptVM* parent); - 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 OVERRIDE { return INT_EXPR; } - ExprType_t returnType() OVERRIDE { return INT_ARR_EXPR; } + StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; } + bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; } + vmint minRequiredArgs() const OVERRIDE { return 1; } + vmint maxAllowedArgs() const OVERRIDE { return 1; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;} + bool modifiesArg(vmint iArg) const OVERRIDE { return false; } + ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } + ExprType_t returnType(VMFnArgs* args) OVERRIDE { return INT_ARR_EXPR; } VMFnResult* exec(VMFnArgs* args) OVERRIDE; protected: InstrumentScriptVM* m_vm; @@ -120,9 +126,11 @@ StmtFlags_t flags; EventGroup* eventGroup; - int arraySize() const OVERRIDE; - int evalIntElement(uint i) OVERRIDE; - void assignIntElement(uint i, int value) OVERRIDE {} // ignore assignment + vmint arraySize() const OVERRIDE; + vmint evalIntElement(vmuint i) OVERRIDE; + void assignIntElement(vmuint i, vmint value) OVERRIDE {} // ignore assignment + vmfloat unitFactorOfElement(vmuint i) const OVERRIDE { return VM_NO_FACTOR; } + void assignElementUnitFactor(vmuint i, vmfloat factor) OVERRIDE {} // ignore assignment VMExpr* resultValue() OVERRIDE { return this; } StmtFlags_t resultFlags() OVERRIDE { return flags; } bool isConstExpr() const OVERRIDE { return false; } @@ -132,332 +140,423 @@ VMFnResult* successResult(EventGroup* eventGroup); }; - class InstrumentScriptVMFunction_change_vol : public VMEmptyResultFunction { + class InstrumentScriptVMFunction_change_vol FINAL : public VMEmptyResultFunction { public: InstrumentScriptVMFunction_change_vol(InstrumentScriptVM* parent); - int minRequiredArgs() const { return 2; } - int maxAllowedArgs() const { return 3; } - bool acceptsArgType(int iArg, ExprType_t type) const; - ExprType_t argType(int iArg) const { return INT_EXPR; } - VMFnResult* exec(VMFnArgs* args); + vmint minRequiredArgs() const OVERRIDE { return 2; } + vmint maxAllowedArgs() const OVERRIDE { return 3; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; + bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE; + bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE; + bool acceptsArgFinal(vmint iArg) const OVERRIDE; + ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; protected: InstrumentScriptVM* m_vm; }; - class InstrumentScriptVMFunction_change_tune : public VMEmptyResultFunction { + class InstrumentScriptVMFunction_change_tune FINAL : public VMEmptyResultFunction { public: InstrumentScriptVMFunction_change_tune(InstrumentScriptVM* parent); - int minRequiredArgs() const { return 2; } - int maxAllowedArgs() const { return 3; } - bool acceptsArgType(int iArg, ExprType_t type) const; - ExprType_t argType(int iArg) const { return INT_EXPR; } - VMFnResult* exec(VMFnArgs* args); + vmint minRequiredArgs() const OVERRIDE { return 2; } + vmint maxAllowedArgs() const OVERRIDE { return 3; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; + bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE; + bool acceptsArgFinal(vmint iArg) const OVERRIDE; + ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; protected: InstrumentScriptVM* m_vm; }; - class InstrumentScriptVMFunction_change_pan : public VMEmptyResultFunction { + class InstrumentScriptVMFunction_change_pan FINAL : public VMEmptyResultFunction { public: InstrumentScriptVMFunction_change_pan(InstrumentScriptVM* parent); - int minRequiredArgs() const { return 2; } - int maxAllowedArgs() const { return 3; } - bool acceptsArgType(int iArg, ExprType_t type) const; - ExprType_t argType(int iArg) const { return INT_EXPR; } - VMFnResult* exec(VMFnArgs* args); + vmint minRequiredArgs() const OVERRIDE { return 2; } + vmint maxAllowedArgs() const OVERRIDE { return 3; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; + bool acceptsArgFinal(vmint iArg) const OVERRIDE; + ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; protected: InstrumentScriptVM* m_vm; }; - class InstrumentScriptVMFunction_change_cutoff : public VMEmptyResultFunction { + class InstrumentScriptVMFunction_change_cutoff FINAL : public VMEmptyResultFunction { public: InstrumentScriptVMFunction_change_cutoff(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); + vmint minRequiredArgs() const OVERRIDE { return 2; } + vmint maxAllowedArgs() const OVERRIDE { return 2; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; + bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE; + bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE; + bool acceptsArgFinal(vmint iArg) const OVERRIDE; + ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; protected: InstrumentScriptVM* m_vm; }; - class InstrumentScriptVMFunction_change_reso : public VMEmptyResultFunction { + class InstrumentScriptVMFunction_change_reso FINAL : public VMEmptyResultFunction { public: InstrumentScriptVMFunction_change_reso(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); + vmint minRequiredArgs() const OVERRIDE { return 2; } + vmint maxAllowedArgs() const OVERRIDE { return 2; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; + bool acceptsArgFinal(vmint iArg) const OVERRIDE; + ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; protected: InstrumentScriptVM* m_vm; }; - class InstrumentScriptVMFunction_change_attack : public VMEmptyResultFunction { + class InstrumentScriptVMFunction_change_attack FINAL : 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); + vmint minRequiredArgs() const OVERRIDE { return 2; } + vmint maxAllowedArgs() const OVERRIDE { return 2; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; + bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE; + bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE; + bool acceptsArgFinal(vmint iArg) const OVERRIDE; + ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; protected: InstrumentScriptVM* m_vm; }; - class InstrumentScriptVMFunction_change_decay : public VMEmptyResultFunction { + class InstrumentScriptVMFunction_change_decay FINAL : 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); + vmint minRequiredArgs() const OVERRIDE { return 2; } + vmint maxAllowedArgs() const OVERRIDE { return 2; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; + bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE; + bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE; + bool acceptsArgFinal(vmint iArg) const OVERRIDE; + ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; protected: InstrumentScriptVM* m_vm; }; - class InstrumentScriptVMFunction_change_release : public VMEmptyResultFunction { + class InstrumentScriptVMFunction_change_release FINAL : 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); + vmint minRequiredArgs() const OVERRIDE { return 2; } + vmint maxAllowedArgs() const OVERRIDE { return 2; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; + bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE; + bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE; + bool acceptsArgFinal(vmint iArg) const OVERRIDE; + ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; 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 + VMChangeSynthParamFunction(InstrumentScriptVM* parent, bool acceptFinal, StdUnit_t unit, bool acceptUnitPrefix) + : m_vm(parent), m_acceptFinal(acceptFinal), m_acceptUnitPrefix(acceptUnitPrefix), m_unit(unit) {} + vmint minRequiredArgs() const OVERRIDE { return 2; } + vmint maxAllowedArgs() const OVERRIDE { return 2; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; + bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE; + bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE; + bool acceptsArgFinal(vmint iArg) const OVERRIDE; + ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } + + template VMFnResult* execTemplate(VMFnArgs* args, const char* functionName); protected: InstrumentScriptVM* m_vm; + const bool m_acceptFinal; + const bool m_acceptUnitPrefix; + const StdUnit_t m_unit; }; - class InstrumentScriptVMFunction_change_sustain : public VMChangeSynthParamFunction { + class InstrumentScriptVMFunction_change_sustain FINAL : public VMChangeSynthParamFunction { public: - InstrumentScriptVMFunction_change_sustain(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent) {} - VMFnResult* exec(VMFnArgs* args); + InstrumentScriptVMFunction_change_sustain(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_BEL,true) {} + VMFnResult* exec(VMFnArgs* args) OVERRIDE; }; - class InstrumentScriptVMFunction_change_amp_lfo_depth : public VMChangeSynthParamFunction { + class InstrumentScriptVMFunction_change_cutoff_attack FINAL : public VMChangeSynthParamFunction { public: - InstrumentScriptVMFunction_change_amp_lfo_depth(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent) {} - VMFnResult* exec(VMFnArgs* args); + InstrumentScriptVMFunction_change_cutoff_attack(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_SECOND,true) {} + VMFnResult* exec(VMFnArgs* args) OVERRIDE; }; - class InstrumentScriptVMFunction_change_amp_lfo_freq : public VMChangeSynthParamFunction { + class InstrumentScriptVMFunction_change_cutoff_decay FINAL : public VMChangeSynthParamFunction { public: - InstrumentScriptVMFunction_change_amp_lfo_freq(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent) {} - VMFnResult* exec(VMFnArgs* args); + InstrumentScriptVMFunction_change_cutoff_decay(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_SECOND,true) {} + VMFnResult* exec(VMFnArgs* args) OVERRIDE; }; - class InstrumentScriptVMFunction_change_pitch_lfo_depth : public VMChangeSynthParamFunction { + class InstrumentScriptVMFunction_change_cutoff_sustain FINAL : public VMChangeSynthParamFunction { public: - InstrumentScriptVMFunction_change_pitch_lfo_depth(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent) {} - VMFnResult* exec(VMFnArgs* args); + InstrumentScriptVMFunction_change_cutoff_sustain(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_BEL,true) {} + VMFnResult* exec(VMFnArgs* args) OVERRIDE; }; - class InstrumentScriptVMFunction_change_pitch_lfo_freq : public VMChangeSynthParamFunction { + class InstrumentScriptVMFunction_change_cutoff_release FINAL : public VMChangeSynthParamFunction { public: - InstrumentScriptVMFunction_change_pitch_lfo_freq(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent) {} - VMFnResult* exec(VMFnArgs* args); + InstrumentScriptVMFunction_change_cutoff_release(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_SECOND,true) {} + VMFnResult* exec(VMFnArgs* args) OVERRIDE; }; - class InstrumentScriptVMFunction_change_vol_time : public VMChangeSynthParamFunction { + class InstrumentScriptVMFunction_change_amp_lfo_depth FINAL : public VMChangeSynthParamFunction { public: - InstrumentScriptVMFunction_change_vol_time(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent) {} - VMFnResult* exec(VMFnArgs* args); + InstrumentScriptVMFunction_change_amp_lfo_depth(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_NO_UNIT,false) {} + VMFnResult* exec(VMFnArgs* args) OVERRIDE; }; - class InstrumentScriptVMFunction_change_tune_time : public VMChangeSynthParamFunction { + class InstrumentScriptVMFunction_change_amp_lfo_freq FINAL : public VMChangeSynthParamFunction { public: - InstrumentScriptVMFunction_change_tune_time(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent) {} - VMFnResult* exec(VMFnArgs* args); + InstrumentScriptVMFunction_change_amp_lfo_freq(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_HERTZ,true) {} + VMFnResult* exec(VMFnArgs* args) OVERRIDE; + }; + + class InstrumentScriptVMFunction_change_cutoff_lfo_depth FINAL : public VMChangeSynthParamFunction { + public: + InstrumentScriptVMFunction_change_cutoff_lfo_depth(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_NO_UNIT,false) {} + VMFnResult* exec(VMFnArgs* args) OVERRIDE; + }; + + class InstrumentScriptVMFunction_change_cutoff_lfo_freq FINAL : public VMChangeSynthParamFunction { + public: + InstrumentScriptVMFunction_change_cutoff_lfo_freq(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_HERTZ,true) {} + VMFnResult* exec(VMFnArgs* args) OVERRIDE; + }; + + class InstrumentScriptVMFunction_change_pitch_lfo_depth FINAL : public VMChangeSynthParamFunction { + public: + InstrumentScriptVMFunction_change_pitch_lfo_depth(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_NO_UNIT,false) {} + VMFnResult* exec(VMFnArgs* args) OVERRIDE; + }; + + class InstrumentScriptVMFunction_change_pitch_lfo_freq FINAL : public VMChangeSynthParamFunction { + public: + InstrumentScriptVMFunction_change_pitch_lfo_freq(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_HERTZ,true) {} + VMFnResult* exec(VMFnArgs* args) OVERRIDE; + }; + + class InstrumentScriptVMFunction_change_vol_time FINAL : public VMChangeSynthParamFunction { + public: + InstrumentScriptVMFunction_change_vol_time(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,false,VM_SECOND,true) {} + VMFnResult* exec(VMFnArgs* args) OVERRIDE; + }; + + class InstrumentScriptVMFunction_change_tune_time FINAL : public VMChangeSynthParamFunction { + public: + InstrumentScriptVMFunction_change_tune_time(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,false,VM_SECOND,true) {} + VMFnResult* exec(VMFnArgs* args) OVERRIDE; + }; + + class InstrumentScriptVMFunction_change_pan_time FINAL : public VMChangeSynthParamFunction { + public: + InstrumentScriptVMFunction_change_pan_time(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,false,VM_SECOND,true) {} + VMFnResult* exec(VMFnArgs* args) OVERRIDE; }; class VMChangeFadeCurveFunction : public VMEmptyResultFunction { public: VMChangeFadeCurveFunction(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; } + vmint minRequiredArgs() const OVERRIDE { return 2; } + vmint maxAllowedArgs() const OVERRIDE { return 2; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; + ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } - template + template VMFnResult* execTemplate(VMFnArgs* args, const char* functionName); protected: InstrumentScriptVM* m_vm; }; - class InstrumentScriptVMFunction_change_vol_curve : public VMChangeFadeCurveFunction { + class InstrumentScriptVMFunction_change_vol_curve FINAL : public VMChangeFadeCurveFunction { public: InstrumentScriptVMFunction_change_vol_curve(InstrumentScriptVM* parent) : VMChangeFadeCurveFunction(parent) {} - VMFnResult* exec(VMFnArgs* args); + VMFnResult* exec(VMFnArgs* args) OVERRIDE; }; - class InstrumentScriptVMFunction_change_tune_curve : public VMChangeFadeCurveFunction { + class InstrumentScriptVMFunction_change_tune_curve FINAL : public VMChangeFadeCurveFunction { public: InstrumentScriptVMFunction_change_tune_curve(InstrumentScriptVM* parent) : VMChangeFadeCurveFunction(parent) {} - VMFnResult* exec(VMFnArgs* args); + VMFnResult* exec(VMFnArgs* args) OVERRIDE; + }; + + class InstrumentScriptVMFunction_change_pan_curve FINAL : public VMChangeFadeCurveFunction { + public: + InstrumentScriptVMFunction_change_pan_curve(InstrumentScriptVM* parent) : VMChangeFadeCurveFunction(parent) {} + VMFnResult* exec(VMFnArgs* args) OVERRIDE; }; - class InstrumentScriptVMFunction_fade_in : public VMEmptyResultFunction { + class InstrumentScriptVMFunction_fade_in FINAL : public VMEmptyResultFunction { public: InstrumentScriptVMFunction_fade_in(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); + vmint minRequiredArgs() const OVERRIDE { return 2; } + vmint maxAllowedArgs() const OVERRIDE { return 2; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; + bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE; + bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE; + ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; protected: InstrumentScriptVM* m_vm; }; - class InstrumentScriptVMFunction_fade_out : public VMEmptyResultFunction { + class InstrumentScriptVMFunction_fade_out FINAL : public VMEmptyResultFunction { public: InstrumentScriptVMFunction_fade_out(InstrumentScriptVM* parent); - int minRequiredArgs() const { return 2; } - int maxAllowedArgs() const { return 3; } - bool acceptsArgType(int iArg, ExprType_t type) const; - ExprType_t argType(int iArg) const { return INT_EXPR; } - VMFnResult* exec(VMFnArgs* args); + vmint minRequiredArgs() const OVERRIDE { return 2; } + vmint maxAllowedArgs() const OVERRIDE { return 3; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; + bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE; + bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE; + ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; protected: InstrumentScriptVM* m_vm; }; - class InstrumentScriptVMFunction_get_event_par : public VMIntResultFunction { + class InstrumentScriptVMFunction_get_event_par FINAL : public VMIntResultFunction { public: InstrumentScriptVMFunction_get_event_par(InstrumentScriptVM* parent); - int minRequiredArgs() const { return 2; } - 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); + StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; } + bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; } + vmint minRequiredArgs() const OVERRIDE { return 2; } + vmint maxAllowedArgs() const OVERRIDE { return 2; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;} + ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; protected: InstrumentScriptVM* m_vm; }; - class InstrumentScriptVMFunction_set_event_par : public VMEmptyResultFunction { + class InstrumentScriptVMFunction_set_event_par FINAL : public VMEmptyResultFunction { public: InstrumentScriptVMFunction_set_event_par(InstrumentScriptVM* parent); - int minRequiredArgs() const { return 3; } - int maxAllowedArgs() const { return 3; } - 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); + vmint minRequiredArgs() const OVERRIDE { return 3; } + vmint maxAllowedArgs() const OVERRIDE { return 3; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;} + ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; protected: InstrumentScriptVM* m_vm; }; - class InstrumentScriptVMFunction_change_note : public VMEmptyResultFunction { + class InstrumentScriptVMFunction_change_note FINAL : public VMEmptyResultFunction { public: InstrumentScriptVMFunction_change_note(InstrumentScriptVM* parent); - int minRequiredArgs() const { return 2; } - 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); + vmint minRequiredArgs() const OVERRIDE { return 2; } + vmint maxAllowedArgs() const OVERRIDE { return 2; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;} + ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; protected: InstrumentScriptVM* m_vm; }; - class InstrumentScriptVMFunction_change_velo : public VMEmptyResultFunction { + class InstrumentScriptVMFunction_change_velo FINAL : public VMEmptyResultFunction { public: InstrumentScriptVMFunction_change_velo(InstrumentScriptVM* parent); - int minRequiredArgs() const { return 2; } - 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); + vmint minRequiredArgs() const OVERRIDE { return 2; } + vmint maxAllowedArgs() const OVERRIDE { return 2; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;} + ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; protected: InstrumentScriptVM* m_vm; }; - class InstrumentScriptVMFunction_change_play_pos : public VMEmptyResultFunction { + class InstrumentScriptVMFunction_change_play_pos FINAL : public VMEmptyResultFunction { public: InstrumentScriptVMFunction_change_play_pos(InstrumentScriptVM* parent); - int minRequiredArgs() const { return 2; } - 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); + vmint minRequiredArgs() const OVERRIDE { return 2; } + vmint maxAllowedArgs() const OVERRIDE { return 2; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR; } + bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE; + bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE; + ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; protected: InstrumentScriptVM* m_vm; }; - class InstrumentScriptVMFunction_event_status : public VMIntResultFunction { + class InstrumentScriptVMFunction_event_status FINAL : public VMIntResultFunction { public: InstrumentScriptVMFunction_event_status(InstrumentScriptVM* parent); - int minRequiredArgs() const { return 1; } - int maxAllowedArgs() const { return 1; } - 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); + StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; } + bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; } + vmint minRequiredArgs() const OVERRIDE { return 1; } + vmint maxAllowedArgs() const OVERRIDE { return 1; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;} + ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; protected: InstrumentScriptVM* m_vm; }; - class InstrumentScriptVMFunction_callback_status : public VMIntResultFunction { + class InstrumentScriptVMFunction_callback_status FINAL : public VMIntResultFunction { public: InstrumentScriptVMFunction_callback_status(InstrumentScriptVM* parent); - int minRequiredArgs() const { return 1; } - int maxAllowedArgs() const { return 1; } - 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); + StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; } + bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; } + vmint minRequiredArgs() const OVERRIDE { return 1; } + vmint maxAllowedArgs() const OVERRIDE { return 1; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;} + ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; protected: InstrumentScriptVM* m_vm; }; // overrides core wait() implementation - class InstrumentScriptVMFunction_wait : public CoreVMFunction_wait { + class InstrumentScriptVMFunction_wait FINAL : public CoreVMFunction_wait { public: InstrumentScriptVMFunction_wait(InstrumentScriptVM* parent); - VMFnResult* exec(VMFnArgs* args); + VMFnResult* exec(VMFnArgs* args) OVERRIDE; }; - class InstrumentScriptVMFunction_stop_wait : public VMEmptyResultFunction { + class InstrumentScriptVMFunction_stop_wait FINAL : 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); + vmint minRequiredArgs() const OVERRIDE { return 1; } + vmint maxAllowedArgs() const OVERRIDE { return 2; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;} + ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; protected: InstrumentScriptVM* m_vm; }; - class InstrumentScriptVMFunction_abort : public VMEmptyResultFunction { + class InstrumentScriptVMFunction_abort FINAL : public VMEmptyResultFunction { public: InstrumentScriptVMFunction_abort(InstrumentScriptVM* parent); - int minRequiredArgs() const { return 1; } - int maxAllowedArgs() const { return 1; } - bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR; } - ExprType_t argType(int iArg) const { return INT_EXPR; } + vmint minRequiredArgs() const OVERRIDE { return 1; } + vmint maxAllowedArgs() const OVERRIDE { return 1; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR; } + ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } VMFnResult* exec(VMFnArgs* args) OVERRIDE; protected: InstrumentScriptVM* m_vm; }; - class InstrumentScriptVMFunction_fork : public VMIntResultFunction { + class InstrumentScriptVMFunction_fork FINAL : public VMIntResultFunction { public: InstrumentScriptVMFunction_fork(InstrumentScriptVM* parent); - int minRequiredArgs() const { return 0; } - 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); + StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; } + bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; } + vmint minRequiredArgs() const OVERRIDE { return 0; } + vmint maxAllowedArgs() const OVERRIDE { return 2; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;} + ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; protected: InstrumentScriptVM* m_vm; };