/[svn]/linuxsampler/trunk/src/engines/common/InstrumentScriptVMFunctions.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/engines/common/InstrumentScriptVMFunctions.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2945 by schoenebeck, Thu Jul 14 00:22:26 2016 UTC revision 3193 by schoenebeck, Sat May 20 12:28:57 2017 UTC
# Line 1  Line 1 
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   *   *
# Line 12  Line 12 
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    
# Line 105  namespace LinuxSampler { Line 106  namespace LinuxSampler {
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 {
# Line 123  namespace LinuxSampler { Line 124  namespace LinuxSampler {
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    
# Line 190  namespace LinuxSampler { Line 191  namespace LinuxSampler {
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                     bool T_isNormalizedParam, int T_maxValue, int T_minValue>
241            VMFnResult* execTemplate(VMFnArgs* args, const char* functionName);
242        protected:
243            InstrumentScriptVM* m_vm;
244        };
245    
246        class InstrumentScriptVMFunction_change_amp_lfo_depth : public VMChangeSynthParamFunction {
247        public:
248            InstrumentScriptVMFunction_change_amp_lfo_depth(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent) {}
249            VMFnResult* exec(VMFnArgs* args);
250        };
251    
252        class InstrumentScriptVMFunction_change_amp_lfo_freq : public VMChangeSynthParamFunction {
253        public:
254            InstrumentScriptVMFunction_change_amp_lfo_freq(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent) {}
255            VMFnResult* exec(VMFnArgs* args);
256        };
257    
258        class InstrumentScriptVMFunction_change_pitch_lfo_depth : public VMChangeSynthParamFunction {
259        public:
260            InstrumentScriptVMFunction_change_pitch_lfo_depth(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent) {}
261            VMFnResult* exec(VMFnArgs* args);
262        };
263    
264        class InstrumentScriptVMFunction_change_pitch_lfo_freq : public VMChangeSynthParamFunction {
265        public:
266            InstrumentScriptVMFunction_change_pitch_lfo_freq(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent) {}
267            VMFnResult* exec(VMFnArgs* args);
268        };
269    
270        class InstrumentScriptVMFunction_change_vol_time : public VMChangeSynthParamFunction {
271        public:
272            InstrumentScriptVMFunction_change_vol_time(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent) {}
273            VMFnResult* exec(VMFnArgs* args);
274        };
275    
276        class InstrumentScriptVMFunction_change_tune_time : public VMChangeSynthParamFunction {
277        public:
278            InstrumentScriptVMFunction_change_tune_time(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent) {}
279            VMFnResult* exec(VMFnArgs* args);
280        };
281    
282        class InstrumentScriptVMFunction_fade_in : public VMEmptyResultFunction {
283        public:
284            InstrumentScriptVMFunction_fade_in(InstrumentScriptVM* parent);
285            int minRequiredArgs() const { return 2; }
286            int maxAllowedArgs() const { return 2; }
287            bool acceptsArgType(int iArg, ExprType_t type) const;
288            ExprType_t argType(int iArg) const { return INT_EXPR; }
289            VMFnResult* exec(VMFnArgs* args);
290        protected:
291            InstrumentScriptVM* m_vm;
292        };
293    
294        class InstrumentScriptVMFunction_fade_out : public VMEmptyResultFunction {
295        public:
296            InstrumentScriptVMFunction_fade_out(InstrumentScriptVM* parent);
297            int minRequiredArgs() const { return 2; }
298            int maxAllowedArgs() const { return 3; }
299            bool acceptsArgType(int iArg, ExprType_t type) const;
300            ExprType_t argType(int iArg) const { return INT_EXPR; }
301            VMFnResult* exec(VMFnArgs* args);
302        protected:
303            InstrumentScriptVM* m_vm;
304        };
305    
306        class InstrumentScriptVMFunction_get_event_par : public VMIntResultFunction {
307        public:
308            InstrumentScriptVMFunction_get_event_par(InstrumentScriptVM* parent);
309            int minRequiredArgs() const { return 2; }
310            int maxAllowedArgs() const { return 2; }
311            bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR;}
312            ExprType_t argType(int iArg) const { return INT_EXPR; }
313            VMFnResult* exec(VMFnArgs* args);
314        protected:
315            InstrumentScriptVM* m_vm;
316        };
317    
318        class InstrumentScriptVMFunction_set_event_par : public VMEmptyResultFunction {
319        public:
320            InstrumentScriptVMFunction_set_event_par(InstrumentScriptVM* parent);
321            int minRequiredArgs() const { return 3; }
322            int maxAllowedArgs() const { return 3; }
323            bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR;}
324            ExprType_t argType(int iArg) const { return INT_EXPR; }
325            VMFnResult* exec(VMFnArgs* args);
326        protected:
327            InstrumentScriptVM* m_vm;
328        };
329    
330      class InstrumentScriptVMFunction_event_status : public VMIntResultFunction {      class InstrumentScriptVMFunction_event_status : public VMIntResultFunction {
331      public:      public:
# Line 199  namespace LinuxSampler { Line 335  namespace LinuxSampler {
335          bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR;}          bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR;}
336          ExprType_t argType(int iArg) const { return INT_EXPR; }          ExprType_t argType(int iArg) const { return INT_EXPR; }
337          VMFnResult* exec(VMFnArgs* args);          VMFnResult* exec(VMFnArgs* args);
338        protected:
339            InstrumentScriptVM* m_vm;
340        };
341    
342        // overrides core wait() implementation
343        class InstrumentScriptVMFunction_wait : public CoreVMFunction_wait {
344        public:
345            InstrumentScriptVMFunction_wait(InstrumentScriptVM* parent);
346            VMFnResult* exec(VMFnArgs* args);
347        };
348    
349        class InstrumentScriptVMFunction_stop_wait : public VMEmptyResultFunction {
350        public:
351            InstrumentScriptVMFunction_stop_wait(InstrumentScriptVM* parent);
352            int minRequiredArgs() const { return 1; }
353            int maxAllowedArgs() const { return 2; }
354            bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR;}
355            ExprType_t argType(int iArg) const { return INT_EXPR; }
356            VMFnResult* exec(VMFnArgs* args);
357      protected:      protected:
358          InstrumentScriptVM* m_vm;          InstrumentScriptVM* m_vm;
359      };      };

Legend:
Removed from v.2945  
changed lines
  Added in v.3193

  ViewVC Help
Powered by ViewVC