/[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 3585 by schoenebeck, Fri Aug 30 17:51:24 2019 UTC revision 3587 by schoenebeck, Sat Aug 31 12:08:49 2019 UTC
# Line 26  namespace LinuxSampler { Line 26  namespace LinuxSampler {
26          bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }          bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }
27          vmint minRequiredArgs() const OVERRIDE { return 1; }          vmint minRequiredArgs() const OVERRIDE { return 1; }
28          vmint maxAllowedArgs() const OVERRIDE { return 4; }          vmint maxAllowedArgs() const OVERRIDE { return 4; }
29          bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR;}          bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
30            bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
31            bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
32          VMFnResult* exec(VMFnArgs* args) OVERRIDE;          VMFnResult* exec(VMFnArgs* args) OVERRIDE;
33      protected:      protected:
34          InstrumentScriptVM* m_vm;          InstrumentScriptVM* m_vm;
# Line 241  namespace LinuxSampler { Line 243  namespace LinuxSampler {
243    
244      class VMChangeSynthParamFunction : public VMEmptyResultFunction {      class VMChangeSynthParamFunction : public VMEmptyResultFunction {
245      public:      public:
246          VMChangeSynthParamFunction(InstrumentScriptVM* parent, bool acceptFinal, StdUnit_t unit, bool acceptUnitPrefix)          struct Opt_t {
247              : m_vm(parent), m_acceptFinal(acceptFinal), m_acceptUnitPrefix(acceptUnitPrefix), m_unit(unit) {}              InstrumentScriptVM* vm = NULL; ///< Parent object owning the built-in function implementation object.
248                bool acceptFinal = false; ///< Whether built-in function allows 'final' operator for its 2nd function argument.
249                StdUnit_t unit = VM_NO_UNIT; ///< Whether built-in functions accepts a unit type for its 2nd function argument and if yes which one.
250                bool acceptUnitPrefix = false; ///< Whether built-in function accepts metric unit prefix(es) for its 2nd function argument.
251                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).
252            };
253            VMChangeSynthParamFunction(const Opt_t& opt)
254                : m_vm(opt.vm), m_acceptReal(opt.acceptReal),
255                  m_acceptFinal(opt.acceptFinal),
256                  m_acceptUnitPrefix(opt.acceptUnitPrefix), m_unit(opt.unit) {}
257          vmint minRequiredArgs() const OVERRIDE { return 2; }          vmint minRequiredArgs() const OVERRIDE { return 2; }
258          vmint maxAllowedArgs() const OVERRIDE { return 2; }          vmint maxAllowedArgs() const OVERRIDE { return 2; }
259          bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;          bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
# Line 257  namespace LinuxSampler { Line 268  namespace LinuxSampler {
268                  MetricPrefix_t T_unitPrefix0, MetricPrefix_t ... T_unitPrefixN>                  MetricPrefix_t T_unitPrefix0, MetricPrefix_t ... T_unitPrefixN>
269          VMFnResult* execTemplate(VMFnArgs* args, const char* functionName);          VMFnResult* execTemplate(VMFnArgs* args, const char* functionName);
270      protected:      protected:
271          InstrumentScriptVM* m_vm;          InstrumentScriptVM* const m_vm;
272            const bool m_acceptReal;
273          const bool m_acceptFinal;          const bool m_acceptFinal;
274          const bool m_acceptUnitPrefix;          const bool m_acceptUnitPrefix;
275          const StdUnit_t m_unit;          const StdUnit_t m_unit;
# Line 265  namespace LinuxSampler { Line 277  namespace LinuxSampler {
277    
278      class InstrumentScriptVMFunction_change_sustain FINAL : public VMChangeSynthParamFunction {      class InstrumentScriptVMFunction_change_sustain FINAL : public VMChangeSynthParamFunction {
279      public:      public:
280          InstrumentScriptVMFunction_change_sustain(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_BEL,true) {}          InstrumentScriptVMFunction_change_sustain(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
281                .vm = parent,
282                .acceptFinal = true,
283                .unit = VM_BEL,
284                .acceptUnitPrefix = true,
285                .acceptReal = true,
286            }) {}
287          VMFnResult* exec(VMFnArgs* args) OVERRIDE;          VMFnResult* exec(VMFnArgs* args) OVERRIDE;
288      };      };
289    
290      class InstrumentScriptVMFunction_change_cutoff_attack FINAL : public VMChangeSynthParamFunction {      class InstrumentScriptVMFunction_change_cutoff_attack FINAL : public VMChangeSynthParamFunction {
291      public:      public:
292          InstrumentScriptVMFunction_change_cutoff_attack(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_SECOND,true) {}          InstrumentScriptVMFunction_change_cutoff_attack(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
293                .vm = parent,
294                .acceptFinal = true,
295                .unit = VM_SECOND,
296                .acceptUnitPrefix = true,
297                .acceptReal = true,
298            }) {}
299          VMFnResult* exec(VMFnArgs* args) OVERRIDE;          VMFnResult* exec(VMFnArgs* args) OVERRIDE;
300      };      };
301    
302      class InstrumentScriptVMFunction_change_cutoff_decay FINAL : public VMChangeSynthParamFunction {      class InstrumentScriptVMFunction_change_cutoff_decay FINAL : public VMChangeSynthParamFunction {
303      public:      public:
304          InstrumentScriptVMFunction_change_cutoff_decay(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_SECOND,true) {}          InstrumentScriptVMFunction_change_cutoff_decay(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
305                .vm = parent,
306                .acceptFinal = true,
307                .unit = VM_SECOND,
308                .acceptUnitPrefix = true,
309                .acceptReal = true,
310            }) {}
311          VMFnResult* exec(VMFnArgs* args) OVERRIDE;          VMFnResult* exec(VMFnArgs* args) OVERRIDE;
312      };      };
313    
314      class InstrumentScriptVMFunction_change_cutoff_sustain FINAL : public VMChangeSynthParamFunction {      class InstrumentScriptVMFunction_change_cutoff_sustain FINAL : public VMChangeSynthParamFunction {
315      public:      public:
316          InstrumentScriptVMFunction_change_cutoff_sustain(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_BEL,true) {}          InstrumentScriptVMFunction_change_cutoff_sustain(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
317                .vm = parent,
318                .acceptFinal = true,
319                .unit = VM_BEL,
320                .acceptUnitPrefix = true,
321                .acceptReal = true,
322            }) {}
323          VMFnResult* exec(VMFnArgs* args) OVERRIDE;          VMFnResult* exec(VMFnArgs* args) OVERRIDE;
324      };      };
325    
326      class InstrumentScriptVMFunction_change_cutoff_release FINAL : public VMChangeSynthParamFunction {      class InstrumentScriptVMFunction_change_cutoff_release FINAL : public VMChangeSynthParamFunction {
327      public:      public:
328          InstrumentScriptVMFunction_change_cutoff_release(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_SECOND,true) {}          InstrumentScriptVMFunction_change_cutoff_release(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
329                .vm = parent,
330                .acceptFinal = true,
331                .unit = VM_SECOND,
332                .acceptUnitPrefix = true,
333                .acceptReal = true,
334            }) {}
335          VMFnResult* exec(VMFnArgs* args) OVERRIDE;          VMFnResult* exec(VMFnArgs* args) OVERRIDE;
336      };      };
337    
338      class InstrumentScriptVMFunction_change_amp_lfo_depth FINAL : public VMChangeSynthParamFunction {      class InstrumentScriptVMFunction_change_amp_lfo_depth FINAL : public VMChangeSynthParamFunction {
339      public:      public:
340          InstrumentScriptVMFunction_change_amp_lfo_depth(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_NO_UNIT,false) {}          InstrumentScriptVMFunction_change_amp_lfo_depth(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
341                .vm = parent,
342                .acceptFinal = true,
343                .unit = VM_NO_UNIT,
344                .acceptUnitPrefix = false,
345                .acceptReal = false,
346            }) {}
347          VMFnResult* exec(VMFnArgs* args) OVERRIDE;          VMFnResult* exec(VMFnArgs* args) OVERRIDE;
348      };      };
349    
350      class InstrumentScriptVMFunction_change_amp_lfo_freq FINAL : public VMChangeSynthParamFunction {      class InstrumentScriptVMFunction_change_amp_lfo_freq FINAL : public VMChangeSynthParamFunction {
351      public:      public:
352          InstrumentScriptVMFunction_change_amp_lfo_freq(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_HERTZ,true) {}          InstrumentScriptVMFunction_change_amp_lfo_freq(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
353                .vm = parent,
354                .acceptFinal = true,
355                .unit = VM_HERTZ,
356                .acceptUnitPrefix = true,
357                .acceptReal = true,
358            }) {}
359          VMFnResult* exec(VMFnArgs* args) OVERRIDE;          VMFnResult* exec(VMFnArgs* args) OVERRIDE;
360      };      };
361    
362      class InstrumentScriptVMFunction_change_cutoff_lfo_depth FINAL : public VMChangeSynthParamFunction {      class InstrumentScriptVMFunction_change_cutoff_lfo_depth FINAL : public VMChangeSynthParamFunction {
363      public:      public:
364          InstrumentScriptVMFunction_change_cutoff_lfo_depth(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_NO_UNIT,false) {}          InstrumentScriptVMFunction_change_cutoff_lfo_depth(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
365                .vm = parent,
366                .acceptFinal = true,
367                .unit = VM_NO_UNIT,
368                .acceptUnitPrefix = false,
369                .acceptReal = false,
370            }) {}
371          VMFnResult* exec(VMFnArgs* args) OVERRIDE;          VMFnResult* exec(VMFnArgs* args) OVERRIDE;
372      };      };
373    
374      class InstrumentScriptVMFunction_change_cutoff_lfo_freq FINAL : public VMChangeSynthParamFunction {      class InstrumentScriptVMFunction_change_cutoff_lfo_freq FINAL : public VMChangeSynthParamFunction {
375      public:      public:
376          InstrumentScriptVMFunction_change_cutoff_lfo_freq(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_HERTZ,true) {}          InstrumentScriptVMFunction_change_cutoff_lfo_freq(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
377                .vm = parent,
378                .acceptFinal = true,
379                .unit = VM_HERTZ,
380                .acceptUnitPrefix = true,
381                .acceptReal = true,
382            }) {}
383          VMFnResult* exec(VMFnArgs* args) OVERRIDE;          VMFnResult* exec(VMFnArgs* args) OVERRIDE;
384      };      };
385    
386      class InstrumentScriptVMFunction_change_pitch_lfo_depth FINAL : public VMChangeSynthParamFunction {      class InstrumentScriptVMFunction_change_pitch_lfo_depth FINAL : public VMChangeSynthParamFunction {
387      public:      public:
388          InstrumentScriptVMFunction_change_pitch_lfo_depth(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_NO_UNIT,false) {}          InstrumentScriptVMFunction_change_pitch_lfo_depth(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
389                .vm = parent,
390                .acceptFinal = true,
391                .unit = VM_NO_UNIT,
392                .acceptUnitPrefix = false,
393                .acceptReal = false,
394            }) {}
395          VMFnResult* exec(VMFnArgs* args) OVERRIDE;          VMFnResult* exec(VMFnArgs* args) OVERRIDE;
396      };      };
397    
398      class InstrumentScriptVMFunction_change_pitch_lfo_freq FINAL : public VMChangeSynthParamFunction {      class InstrumentScriptVMFunction_change_pitch_lfo_freq FINAL : public VMChangeSynthParamFunction {
399      public:      public:
400          InstrumentScriptVMFunction_change_pitch_lfo_freq(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,true,VM_HERTZ,true) {}          InstrumentScriptVMFunction_change_pitch_lfo_freq(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
401                .vm = parent,
402                .acceptFinal = true,
403                .unit = VM_HERTZ,
404                .acceptUnitPrefix = true,
405                .acceptReal = true,
406            }) {}
407          VMFnResult* exec(VMFnArgs* args) OVERRIDE;          VMFnResult* exec(VMFnArgs* args) OVERRIDE;
408      };      };
409    
410      class InstrumentScriptVMFunction_change_vol_time FINAL : public VMChangeSynthParamFunction {      class InstrumentScriptVMFunction_change_vol_time FINAL : public VMChangeSynthParamFunction {
411      public:      public:
412          InstrumentScriptVMFunction_change_vol_time(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,false,VM_SECOND,true) {}          InstrumentScriptVMFunction_change_vol_time(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
413                .vm = parent,
414                .acceptFinal = false,
415                .unit = VM_SECOND,
416                .acceptUnitPrefix = true,
417                .acceptReal = true,
418            }) {}
419          VMFnResult* exec(VMFnArgs* args) OVERRIDE;          VMFnResult* exec(VMFnArgs* args) OVERRIDE;
420      };      };
421    
422      class InstrumentScriptVMFunction_change_tune_time FINAL : public VMChangeSynthParamFunction {      class InstrumentScriptVMFunction_change_tune_time FINAL : public VMChangeSynthParamFunction {
423      public:      public:
424          InstrumentScriptVMFunction_change_tune_time(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,false,VM_SECOND,true) {}          InstrumentScriptVMFunction_change_tune_time(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
425                .vm = parent,
426                .acceptFinal = false,
427                .unit = VM_SECOND,
428                .acceptUnitPrefix = true,
429                .acceptReal = true,
430            }) {}
431          VMFnResult* exec(VMFnArgs* args) OVERRIDE;          VMFnResult* exec(VMFnArgs* args) OVERRIDE;
432      };      };
433    
434      class InstrumentScriptVMFunction_change_pan_time FINAL : public VMChangeSynthParamFunction {      class InstrumentScriptVMFunction_change_pan_time FINAL : public VMChangeSynthParamFunction {
435      public:      public:
436          InstrumentScriptVMFunction_change_pan_time(InstrumentScriptVM* parent) : VMChangeSynthParamFunction(parent,false,VM_SECOND,true) {}          InstrumentScriptVMFunction_change_pan_time(InstrumentScriptVM* parent) : VMChangeSynthParamFunction({
437                .vm = parent,
438                .acceptFinal = false,
439                .unit = VM_SECOND,
440                .acceptUnitPrefix = true,
441                .acceptReal = true,
442            }) {}
443          VMFnResult* exec(VMFnArgs* args) OVERRIDE;          VMFnResult* exec(VMFnArgs* args) OVERRIDE;
444      };      };
445    
# Line 455  namespace LinuxSampler { Line 551  namespace LinuxSampler {
551          InstrumentScriptVMFunction_change_play_pos(InstrumentScriptVM* parent);          InstrumentScriptVMFunction_change_play_pos(InstrumentScriptVM* parent);
552          vmint minRequiredArgs() const OVERRIDE { return 2; }          vmint minRequiredArgs() const OVERRIDE { return 2; }
553          vmint maxAllowedArgs() const OVERRIDE { return 2; }          vmint maxAllowedArgs() const OVERRIDE { return 2; }
554          bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR; }          bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE;
555          bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;          bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
556          bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;          bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
557          VMFnResult* exec(VMFnArgs* args) OVERRIDE;          VMFnResult* exec(VMFnArgs* args) OVERRIDE;

Legend:
Removed from v.3585  
changed lines
  Added in v.3587

  ViewVC Help
Powered by ViewVC