1 |
schoenebeck |
2594 |
/* |
2 |
|
|
* Copyright (c) 2014 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_INSTRUMENT_SCRIPT_VM_H |
11 |
|
|
#define LS_INSTRUMENT_SCRIPT_VM_H |
12 |
|
|
|
13 |
|
|
#include "../../common/global.h" |
14 |
|
|
#include "../../scriptvm/ScriptVM.h" |
15 |
|
|
#include "Event.h" |
16 |
schoenebeck |
2596 |
#include "InstrumentScriptVMFunctions.h" |
17 |
schoenebeck |
2594 |
|
18 |
|
|
namespace LinuxSampler { |
19 |
|
|
|
20 |
|
|
/** @brief Real-time instrument script virtual machine. |
21 |
|
|
* |
22 |
|
|
* Extends the core ScriptVM implementation with MIDI specific built-in |
23 |
|
|
* script functions and MIDI specific built-in script variables required |
24 |
|
|
* for MIDI processing by instrument script for all sampler engine |
25 |
|
|
* implementations (sampler formats) of this sampler. |
26 |
|
|
* |
27 |
|
|
* Note that this class is currently re-entrant safe, but @b not thread |
28 |
|
|
* safe! See also comments of base class ScriptVM regarding this issue. |
29 |
|
|
*/ |
30 |
|
|
class InstrumentScriptVM : public ScriptVM { |
31 |
|
|
public: |
32 |
|
|
InstrumentScriptVM(); |
33 |
|
|
VMExecStatus_t exec(VMParserContext* parserCtx, ScriptEvent* event); |
34 |
schoenebeck |
2596 |
VMFunction* functionByName(const String& name) OVERRIDE; |
35 |
schoenebeck |
2594 |
std::map<String,VMIntRelPtr*> builtInIntVariables() OVERRIDE; |
36 |
|
|
std::map<String,VMInt8Array*> builtInIntArrayVariables() OVERRIDE; |
37 |
|
|
std::map<String,int> builtInConstIntVariables() OVERRIDE; |
38 |
|
|
protected: |
39 |
|
|
ScriptEvent* m_event; ///< The event currently executed by exec(). |
40 |
|
|
|
41 |
|
|
// buil-in script variables |
42 |
|
|
VMInt8Array m_CC; |
43 |
|
|
VMInt8RelPtr m_CC_NUM; |
44 |
schoenebeck |
2598 |
VMIntRelPtr m_EVENT_ID; |
45 |
schoenebeck |
2594 |
VMInt8RelPtr m_EVENT_NOTE; |
46 |
|
|
VMInt8RelPtr m_EVENT_VELOCITY; |
47 |
|
|
//VMIntArray m_KEY_DOWN; //TODO: ... |
48 |
|
|
//VMIntArray m_POLY_AT; //TODO: ... |
49 |
|
|
//int m_POLY_AT_NUM; //TODO: ... |
50 |
schoenebeck |
2596 |
|
51 |
|
|
// buil-in script functions |
52 |
|
|
InstrumentScriptVMFunction_play_note m_fnPlayNote; |
53 |
schoenebeck |
2600 |
InstrumentScriptVMFunction_set_controller m_fnSetController; |
54 |
|
|
InstrumentScriptVMFunction_ignore_event m_fnIgnoreEvent; |
55 |
|
|
InstrumentScriptVMFunction_ignore_controller m_fnIgnoreController; |
56 |
schoenebeck |
2596 |
|
57 |
|
|
friend class InstrumentScriptVMFunction_play_note; |
58 |
schoenebeck |
2600 |
friend class InstrumentScriptVMFunction_set_controller; |
59 |
schoenebeck |
2598 |
friend class InstrumentScriptVMFunction_ignore_event; |
60 |
|
|
friend class InstrumentScriptVMFunction_ignore_controller; |
61 |
schoenebeck |
2594 |
}; |
62 |
|
|
|
63 |
|
|
} // namespace LinuxSampler |
64 |
|
|
|
65 |
|
|
#endif // LS_INSTRUMENT_SCRIPT_VM_H |