/[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 2629 by schoenebeck, Thu Jun 12 18:25:11 2014 UTC revision 2630 by schoenebeck, Fri Jun 13 15:01:06 2014 UTC
# Line 11  Line 11 
11  #define LS_INSTRUMENT_SCRIPT_VM_H  #define LS_INSTRUMENT_SCRIPT_VM_H
12    
13  #include "../../common/global.h"  #include "../../common/global.h"
14    #include "../../common/ConstCapacityArray.h"
15  #include "../../scriptvm/ScriptVM.h"  #include "../../scriptvm/ScriptVM.h"
16  #include "Event.h"  #include "Event.h"
17  #include "../../common/Pool.h"  #include "../../common/Pool.h"
18  #include "InstrumentScriptVMFunctions.h"  #include "InstrumentScriptVMFunctions.h"
19    
20    #define INSTR_SCRIPT_EVENT_GROUPS 28
21    
22  namespace LinuxSampler {  namespace LinuxSampler {
23    
24      class AbstractEngineChannel;      class AbstractEngineChannel;
25        class InstrumentScript;
26    
27        /** @brief List of Event IDs.
28         *
29         * Used for built-in script functions:
30         *     by_marks(), set_event_mark(), delete_event_mark()
31         */
32        class EventGroup : protected ConstCapacityArray<int> {
33        public:
34            EventGroup() : ConstCapacityArray<int>(CONFIG_MAX_EVENTS_PER_FRAGMENT), m_script(NULL) {}
35            void insert(int eventID);
36            void erase(int eventID);
37            void setScript(InstrumentScript* pScript) { m_script = pScript; }
38            inline int size() const { return ConstCapacityArray<int>::size(); }
39            inline int& operator[](uint index) { return ConstCapacityArray<int>::operator[](index); }
40            inline const int& operator[](uint index) const { return ConstCapacityArray<int>::operator[](index); }
41        protected:
42            InstrumentScript* m_script;
43            StmtFlags_t flags;
44        };
45    
46      /** @brief Real-time instrument script VM representation.      /** @brief Real-time instrument script VM representation.
47       *       *
# Line 35  namespace LinuxSampler { Line 58  namespace LinuxSampler {
58          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.          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.
59          AbstractEngineChannel* pEngineChannel;          AbstractEngineChannel* pEngineChannel;
60          String                code; ///< Source code of the instrument script. Used in case the sampler engine is changed, in that case a new ScriptVM object is created for the engine and VMParserContext object for this script needs to be recreated as well. Thus the script is then parsed again by passing the source code to recreate the parser context.          String                code; ///< Source code of the instrument script. Used in case the sampler engine is changed, in that case a new ScriptVM object is created for the engine and VMParserContext object for this script needs to be recreated as well. Thus the script is then parsed again by passing the source code to recreate the parser context.
61            EventGroup            eventGroups[INSTR_SCRIPT_EVENT_GROUPS]; ///< Used for built-in script functions: by_event_marks(), set_event_mark(), delete_event_mark().
62    
63          InstrumentScript(AbstractEngineChannel* pEngineChannel) {          InstrumentScript(AbstractEngineChannel* pEngineChannel);
             parserContext = NULL;  
             bHasValidScript = false;  
             handlerInit = NULL;  
             handlerNote = NULL;  
             handlerRelease = NULL;  
             handlerController = NULL;  
             pEvents = NULL;  
             this->pEngineChannel = pEngineChannel;  
         }  
64    
65          ~InstrumentScript() {          ~InstrumentScript() {
66              resetAll();              resetAll();
# Line 93  namespace LinuxSampler { Line 108  namespace LinuxSampler {
108          InstrumentScriptVMFunction_ignore_event m_fnIgnoreEvent;          InstrumentScriptVMFunction_ignore_event m_fnIgnoreEvent;
109          InstrumentScriptVMFunction_ignore_controller m_fnIgnoreController;          InstrumentScriptVMFunction_ignore_controller m_fnIgnoreController;
110          InstrumentScriptVMFunction_note_off m_fnNoteOff;          InstrumentScriptVMFunction_note_off m_fnNoteOff;
111            InstrumentScriptVMFunction_set_event_mark m_fnSetEventMark;
112            InstrumentScriptVMFunction_delete_event_mark m_fnDeleteEventMark;
113            InstrumentScriptVMFunction_by_marks m_fnByMarks;
114    
115          friend class InstrumentScriptVMFunction_play_note;          friend class InstrumentScriptVMFunction_play_note;
116          friend class InstrumentScriptVMFunction_set_controller;          friend class InstrumentScriptVMFunction_set_controller;
117          friend class InstrumentScriptVMFunction_ignore_event;          friend class InstrumentScriptVMFunction_ignore_event;
118          friend class InstrumentScriptVMFunction_ignore_controller;          friend class InstrumentScriptVMFunction_ignore_controller;
119          friend class InstrumentScriptVMFunction_note_off;          friend class InstrumentScriptVMFunction_note_off;
120            friend class InstrumentScriptVMFunction_set_event_mark;
121            friend class InstrumentScriptVMFunction_delete_event_mark;
122            friend class InstrumentScriptVMFunction_by_marks;
123      };      };
124    
125  } // namespace LinuxSampler  } // namespace LinuxSampler

Legend:
Removed from v.2629  
changed lines
  Added in v.2630

  ViewVC Help
Powered by ViewVC