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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2935 - (show annotations) (download) (as text)
Sun Jul 10 14:24:13 2016 UTC (7 years, 8 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 8226 byte(s)
* NKSP: Added & implemented built-in script function "change_cutoff()".
* NKSP: Added & implemented built-in script function "change_reso()".
* NKSP: Added & implemented built-in script function "event_status()".
* NKSP: Added built-in script constants "$EVENT_STATUS_INACTIVE" and
  "$EVENT_STATUS_NOTE_QUEUE" both for being used as flags for
  built-in "event_status()" script function.
* NKSP language: Added support for bitwise operators ".or.", ".and."
  and ".not.".
* NKSP language scanner: Fixed IDs matching to require at least one
  character (i.e. when matching function names or variable names).
* NKSP language scanner: disabled unusued rules.
* Bumped version (2.0.0.svn12).

1 /*
2 * Copyright (c) 2014 - 2016 Christian Schoenebeck
3 *
4 * http://www.linuxsampler.org
5 *
6 * This file is part of LinuxSampler and released under the same terms.
7 * See README file for details.
8 */
9
10 #ifndef LS_INSTRSCRIPTVMFUNCTIONS_H
11 #define LS_INSTRSCRIPTVMFUNCTIONS_H
12
13 #include "../../common/global.h"
14 #include "../../scriptvm/CoreVMFunctions.h"
15
16 namespace LinuxSampler {
17
18 class EventGroup;
19 class InstrumentScriptVM;
20
21 class InstrumentScriptVMFunction_play_note : public VMIntResultFunction {
22 public:
23 InstrumentScriptVMFunction_play_note(InstrumentScriptVM* parent);
24 int minRequiredArgs() const { return 1; }
25 int maxAllowedArgs() const { return 4; }
26 bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR;}
27 ExprType_t argType(int iArg) const { return INT_EXPR; }
28 VMFnResult* exec(VMFnArgs* args);
29 protected:
30 InstrumentScriptVM* m_vm;
31 };
32
33 class InstrumentScriptVMFunction_set_controller : public VMIntResultFunction {
34 public:
35 InstrumentScriptVMFunction_set_controller(InstrumentScriptVM* parent);
36 int minRequiredArgs() const { return 2; }
37 int maxAllowedArgs() const { return 2; }
38 bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR;}
39 ExprType_t argType(int iArg) const { return INT_EXPR; }
40 VMFnResult* exec(VMFnArgs* args);
41 protected:
42 InstrumentScriptVM* m_vm;
43 };
44
45 class InstrumentScriptVMFunction_ignore_event : public VMEmptyResultFunction {
46 public:
47 InstrumentScriptVMFunction_ignore_event(InstrumentScriptVM* parent);
48 int minRequiredArgs() const { return 1; }
49 int maxAllowedArgs() const { return 1; }
50 bool acceptsArgType(int iArg, ExprType_t type) const;
51 ExprType_t argType(int iArg) const { return INT_EXPR; }
52 VMFnResult* exec(VMFnArgs* args);
53 protected:
54 InstrumentScriptVM* m_vm;
55 };
56
57 class InstrumentScriptVMFunction_ignore_controller : public VMEmptyResultFunction {
58 public:
59 InstrumentScriptVMFunction_ignore_controller(InstrumentScriptVM* parent);
60 int minRequiredArgs() const { return 0; }
61 int maxAllowedArgs() const { return 1; }
62 bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR;}
63 ExprType_t argType(int iArg) const { return INT_EXPR; }
64 VMFnResult* exec(VMFnArgs* args);
65 protected:
66 InstrumentScriptVM* m_vm;
67 };
68
69 class InstrumentScriptVMFunction_note_off : public VMEmptyResultFunction {
70 public:
71 InstrumentScriptVMFunction_note_off(InstrumentScriptVM* parent);
72 int minRequiredArgs() const { return 1; }
73 int maxAllowedArgs() const { return 2; }
74 bool acceptsArgType(int iArg, ExprType_t type) const;
75 ExprType_t argType(int iArg) const { return INT_EXPR; }
76 VMFnResult* exec(VMFnArgs* args);
77 protected:
78 InstrumentScriptVM* m_vm;
79 };
80
81 class InstrumentScriptVMFunction_set_event_mark : public VMEmptyResultFunction {
82 public:
83 InstrumentScriptVMFunction_set_event_mark(InstrumentScriptVM* parent);
84 int minRequiredArgs() const { return 2; }
85 int maxAllowedArgs() const { return 2; }
86 bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR;}
87 ExprType_t argType(int iArg) const { return INT_EXPR; }
88 VMFnResult* exec(VMFnArgs* args);
89 protected:
90 InstrumentScriptVM* m_vm;
91 };
92
93 class InstrumentScriptVMFunction_delete_event_mark : public VMEmptyResultFunction {
94 public:
95 InstrumentScriptVMFunction_delete_event_mark(InstrumentScriptVM* parent);
96 int minRequiredArgs() const { return 2; }
97 int maxAllowedArgs() const { return 2; }
98 bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR;}
99 ExprType_t argType(int iArg) const { return INT_EXPR; }
100 VMFnResult* exec(VMFnArgs* args);
101 protected:
102 InstrumentScriptVM* m_vm;
103 };
104
105 class InstrumentScriptVMFunction_by_marks : public VMFunction {
106 public:
107 InstrumentScriptVMFunction_by_marks(InstrumentScriptVM* parent);
108 int minRequiredArgs() const { return 1; }
109 int maxAllowedArgs() const { return 1; }
110 bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR;}
111 ExprType_t argType(int iArg) const { return INT_EXPR; }
112 ExprType_t returnType() { return INT_ARR_EXPR; }
113 VMFnResult* exec(VMFnArgs* args);
114 protected:
115 InstrumentScriptVM* m_vm;
116 class Result : public VMFnResult, public VMIntArrayExpr {
117 public:
118 StmtFlags_t flags;
119 EventGroup* eventGroup;
120
121 int arraySize() const OVERRIDE;
122 int evalIntElement(uint i) OVERRIDE;
123 void assignIntElement(uint i, int value) OVERRIDE {} // ignore assignment
124 VMExpr* resultValue() OVERRIDE { return this; }
125 StmtFlags_t resultFlags() { return flags; }
126 } m_result;
127
128 VMFnResult* errorResult();
129 VMFnResult* successResult(EventGroup* eventGroup);
130 };
131
132 class InstrumentScriptVMFunction_change_vol : public VMEmptyResultFunction {
133 public:
134 InstrumentScriptVMFunction_change_vol(InstrumentScriptVM* parent);
135 int minRequiredArgs() const { return 2; }
136 int maxAllowedArgs() const { return 3; }
137 bool acceptsArgType(int iArg, ExprType_t type) const;
138 ExprType_t argType(int iArg) const { return INT_EXPR; }
139 VMFnResult* exec(VMFnArgs* args);
140 protected:
141 InstrumentScriptVM* m_vm;
142 };
143
144 class InstrumentScriptVMFunction_change_tune : public VMEmptyResultFunction {
145 public:
146 InstrumentScriptVMFunction_change_tune(InstrumentScriptVM* parent);
147 int minRequiredArgs() const { return 2; }
148 int maxAllowedArgs() const { return 3; }
149 bool acceptsArgType(int iArg, ExprType_t type) const;
150 ExprType_t argType(int iArg) const { return INT_EXPR; }
151 VMFnResult* exec(VMFnArgs* args);
152 protected:
153 InstrumentScriptVM* m_vm;
154 };
155
156 class InstrumentScriptVMFunction_change_pan : public VMEmptyResultFunction {
157 public:
158 InstrumentScriptVMFunction_change_pan(InstrumentScriptVM* parent);
159 int minRequiredArgs() const { return 2; }
160 int maxAllowedArgs() const { return 3; }
161 bool acceptsArgType(int iArg, ExprType_t type) const;
162 ExprType_t argType(int iArg) const { return INT_EXPR; }
163 VMFnResult* exec(VMFnArgs* args);
164 protected:
165 InstrumentScriptVM* m_vm;
166 };
167
168 class InstrumentScriptVMFunction_change_cutoff : public VMEmptyResultFunction {
169 public:
170 InstrumentScriptVMFunction_change_cutoff(InstrumentScriptVM* parent);
171 int minRequiredArgs() const { return 2; }
172 int maxAllowedArgs() const { return 2; }
173 bool acceptsArgType(int iArg, ExprType_t type) const;
174 ExprType_t argType(int iArg) const { return INT_EXPR; }
175 VMFnResult* exec(VMFnArgs* args);
176 protected:
177 InstrumentScriptVM* m_vm;
178 };
179
180 class InstrumentScriptVMFunction_change_reso : public VMEmptyResultFunction {
181 public:
182 InstrumentScriptVMFunction_change_reso(InstrumentScriptVM* parent);
183 int minRequiredArgs() const { return 2; }
184 int maxAllowedArgs() const { return 2; }
185 bool acceptsArgType(int iArg, ExprType_t type) const;
186 ExprType_t argType(int iArg) const { return INT_EXPR; }
187 VMFnResult* exec(VMFnArgs* args);
188 protected:
189 InstrumentScriptVM* m_vm;
190 };
191
192 class InstrumentScriptVMFunction_event_status : public VMIntResultFunction {
193 public:
194 InstrumentScriptVMFunction_event_status(InstrumentScriptVM* parent);
195 int minRequiredArgs() const { return 1; }
196 int maxAllowedArgs() const { return 1; }
197 bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR;}
198 ExprType_t argType(int iArg) const { return INT_EXPR; }
199 VMFnResult* exec(VMFnArgs* args);
200 protected:
201 InstrumentScriptVM* m_vm;
202 };
203
204 } // namespace LinuxSampler
205
206 #endif // LS_INSTRSCRIPTVMFUNCTIONS_H

  ViewVC Help
Powered by ViewVC