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

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

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

revision 2598 by schoenebeck, Fri Jun 6 12:38:54 2014 UTC revision 2611 by schoenebeck, Mon Jun 9 19:20:37 2014 UTC
# Line 13  Line 13 
13  #include "../../common/global.h"  #include "../../common/global.h"
14  #include "../../scriptvm/ScriptVM.h"  #include "../../scriptvm/ScriptVM.h"
15  #include "Event.h"  #include "Event.h"
16    #include "../../common/Pool.h"
17  #include "InstrumentScriptVMFunctions.h"  #include "InstrumentScriptVMFunctions.h"
18    
19  namespace LinuxSampler {  namespace LinuxSampler {
20    
21        class AbstractEngineChannel;
22    
23        /** @brief Real-time instrument script VM representation.
24         *
25         * Holds the VM representation of all event handlers of the currently loaded
26         * script, ready to be executed by the sampler engine.
27         */
28        struct InstrumentScript {
29            VMParserContext*      parserContext; ///< VM represenation of the currently loaded script or NULL if not script was loaded. Note that it is also not NULL if parser errors occurred!
30            bool                  bHasValidScript; ///< True in case there is a valid script currently loaded, false if script processing shall be skipped.
31            VMEventHandler*       handlerInit; ///< VM representation of script's initilization callback or NULL if current script did not define such an init handler.
32            VMEventHandler*       handlerNote; ///< VM representation of script's MIDI note on callback or NULL if current script did not define such an event handler.
33            VMEventHandler*       handlerRelease; ///< VM representation of script's MIDI note off callback or NULL if current script did not define such an event handler.
34            VMEventHandler*       handlerController; ///< VM representation of script's MIDI controller callback or NULL if current script did not define such an event handler.
35            Pool<ScriptEvent>*    pEvents; ///< Pool of all available script execution instances. ScriptEvents available to be allocated from the Pool are currently unused / not executiong, whereas the ScriptEvents allocated on the list are currently suspended / have not finished execution yet.
36            AbstractEngineChannel* pEngineChannel;
37    
38            InstrumentScript(AbstractEngineChannel* pEngineChannel) {
39                parserContext = NULL;
40                bHasValidScript = false;
41                handlerInit = NULL;
42                handlerNote = NULL;
43                handlerRelease = NULL;
44                handlerController = NULL;
45                pEvents = NULL;
46                this->pEngineChannel = pEngineChannel;
47            }
48    
49            ~InstrumentScript() {
50                reset();
51            }
52    
53            void load(const String& text);
54            void reset();
55        };
56    
57      /** @brief Real-time instrument script virtual machine.      /** @brief Real-time instrument script virtual machine.
58       *       *
59       * Extends the core ScriptVM implementation with MIDI specific built-in       * Extends the core ScriptVM implementation with MIDI specific built-in
# Line 50  namespace LinuxSampler { Line 87  namespace LinuxSampler {
87    
88          // buil-in script functions          // buil-in script functions
89          InstrumentScriptVMFunction_play_note m_fnPlayNote;          InstrumentScriptVMFunction_play_note m_fnPlayNote;
90          InstrumentScriptVMFunction_play_note m_fnIgnoreEvent;          InstrumentScriptVMFunction_set_controller m_fnSetController;
91          InstrumentScriptVMFunction_play_note m_fnIgnoreController;          InstrumentScriptVMFunction_ignore_event m_fnIgnoreEvent;
92            InstrumentScriptVMFunction_ignore_controller m_fnIgnoreController;
93    
94          friend class InstrumentScriptVMFunction_play_note;          friend class InstrumentScriptVMFunction_play_note;
95            friend class InstrumentScriptVMFunction_set_controller;
96          friend class InstrumentScriptVMFunction_ignore_event;          friend class InstrumentScriptVMFunction_ignore_event;
97          friend class InstrumentScriptVMFunction_ignore_controller;          friend class InstrumentScriptVMFunction_ignore_controller;
98      };      };

Legend:
Removed from v.2598  
changed lines
  Added in v.2611

  ViewVC Help
Powered by ViewVC