11 |
#include "../AbstractEngineChannel.h" |
#include "../AbstractEngineChannel.h" |
12 |
#include "../../common/global_private.h" |
#include "../../common/global_private.h" |
13 |
#include "AbstractInstrumentManager.h" |
#include "AbstractInstrumentManager.h" |
14 |
|
#include "MidiKeyboardManager.h" |
15 |
|
|
16 |
namespace LinuxSampler { |
namespace LinuxSampler { |
17 |
|
|
88 |
* to deallocate the parsed script once not used on any engine channel |
* to deallocate the parsed script once not used on any engine channel |
89 |
* anymore. |
* anymore. |
90 |
* |
* |
91 |
* Calling thid method will however not clear the @c code member variable. |
* Calling this method will however not clear the @c code member variable. |
92 |
* Thus, the script can be parsed again afterwards. |
* Thus, the script can be parsed again afterwards. |
93 |
*/ |
*/ |
94 |
void InstrumentScript::unload() { |
void InstrumentScript::unload() { |
95 |
|
//dmsg(1,("InstrumentScript::unload(this=0x%llx)\n", this)); |
96 |
|
|
97 |
if (parserContext) |
if (parserContext) |
98 |
dmsg(1,("Unloading current instrument script.\n")); |
dmsg(1,("Unloading current instrument script.\n")); |
99 |
|
|
148 |
m_EVENT_ID = DECLARE_VMINT(m_event, class ScriptEvent, id); |
m_EVENT_ID = DECLARE_VMINT(m_event, class ScriptEvent, id); |
149 |
m_EVENT_NOTE = DECLARE_VMINT(m_event, class ScriptEvent, cause.Param.Note.Key); |
m_EVENT_NOTE = DECLARE_VMINT(m_event, class ScriptEvent, cause.Param.Note.Key); |
150 |
m_EVENT_VELOCITY = DECLARE_VMINT(m_event, class ScriptEvent, cause.Param.Note.Velocity); |
m_EVENT_VELOCITY = DECLARE_VMINT(m_event, class ScriptEvent, cause.Param.Note.Velocity); |
151 |
|
m_KEY_DOWN.size = 128; |
152 |
} |
} |
153 |
|
|
154 |
VMExecStatus_t InstrumentScriptVM::exec(VMParserContext* parserCtx, ScriptEvent* event) { |
VMExecStatus_t InstrumentScriptVM::exec(VMParserContext* parserCtx, ScriptEvent* event) { |
158 |
// prepare built-in script variables for script execution |
// prepare built-in script variables for script execution |
159 |
m_event = event; |
m_event = event; |
160 |
m_CC.data = (int8_t*) &pEngineChannel->ControllerTable[0]; |
m_CC.data = (int8_t*) &pEngineChannel->ControllerTable[0]; |
161 |
|
m_KEY_DOWN.data = &pEngineChannel->GetMidiKeyboardManager()->KeyDown[0]; |
162 |
|
|
163 |
// if script is in start condition, then do mandatory MIDI event |
// if script is in start condition, then do mandatory MIDI event |
164 |
// preprocessing tasks, which essentially means updating i.e. controller |
// preprocessing tasks, which essentially means updating i.e. controller |
214 |
|
|
215 |
// now add own built-in variables |
// now add own built-in variables |
216 |
m["%CC"] = &m_CC; |
m["%CC"] = &m_CC; |
217 |
//m["%KEY_DOWN"] = &m_KEY_DOWN; |
m["%KEY_DOWN"] = &m_KEY_DOWN; |
218 |
//m["%POLY_AT"] = &m_POLY_AT; |
//m["%POLY_AT"] = &m_POLY_AT; |
219 |
|
|
220 |
return m; |
return m; |