/[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 2942 by schoenebeck, Wed Jul 13 15:51:06 2016 UTC revision 2948 by schoenebeck, Fri Jul 15 15:29:04 2016 UTC
# Line 30  Line 30 
30  #define INSTR_SCRIPT_EVENT_ID_RESERVED_BITS 1  #define INSTR_SCRIPT_EVENT_ID_RESERVED_BITS 1
31    
32  /**  /**
33   * Used to mark IDs (in script scope) to actually be a note ID.   * Used by InstrScriptIDType_T to initialize its constants at compile time.
34     *
35     * This macro is already ready to initialize additional members for
36     * InstrScriptIDType_T (that is more than the currently two enum constants).
37     * Just keep in mind that you also have to increase
38     * INSTR_SCRIPT_EVENT_ID_RESERVED_BITS when you add more!
39     *
40     * @param x - sequential consecutive number (starting with zero)
41   */   */
42  #define INSTR_SCRIPT_NOTE_ID_FLAG   (1 << (sizeof(pool_element_id_t) * 8 - 1))  #define INSTR_SCRIPT_ID_TYPE_FLAG(x) \
43        (x << (sizeof(pool_element_id_t) * 8 - INSTR_SCRIPT_EVENT_ID_RESERVED_BITS))
44    
45    /**
46     * These flags are used to distinguish the individual ID Types in script scope
47     * from each other. They are added as most left bit(s) to each ID in script
48     * scope.
49     */
50    enum InstrScriptIDType_T {
51        /**
52         * Used to mark IDs (in script scope) to actually be a MIDI event ID.
53         */
54        INSTR_SCRIPT_EVENT_ID_FLAG = INSTR_SCRIPT_ID_TYPE_FLAG(0),
55    
56        /**
57         * Used to mark IDs (in script scope) to actually be a note ID.
58         */
59        INSTR_SCRIPT_NOTE_ID_FLAG = INSTR_SCRIPT_ID_TYPE_FLAG(1),
60    };
61    
62  #define INSTR_SCRIPT_EVENT_GROUPS 28  #define INSTR_SCRIPT_EVENT_GROUPS 28
63    
# Line 57  namespace LinuxSampler { Line 82  namespace LinuxSampler {
82       * event_id_t (engine internal scope) -> int (script scope)       * event_id_t (engine internal scope) -> int (script scope)
83       * note_id_t (engine internal scope)  -> int (script scope)       * note_id_t (engine internal scope)  -> int (script scope)
84       * @endcode       * @endcode
85       * This is required because engine internally notes and regular events are       * This is required because engine internally i.e. notes and regular events
86       * using their own, separate ID generating pool, and their ID number set       * are using their own, separate ID generating pool, and their ID number
87       * may thus overlap.       * set may thus overlap and historically there were built-in script
88         * functions in KSP which allow to pass both regular MIDI event IDs, as well
89         * as Note IDs. So we must be able to distinguish between them in our
90         * built-in script function implementations.
91       *       *
92       * @see INSTR_SCRIPT_EVENT_ID_RESERVED_BITS       * @see INSTR_SCRIPT_EVENT_ID_RESERVED_BITS
93       */       */
# Line 80  namespace LinuxSampler { Line 108  namespace LinuxSampler {
108           * internal scope.           * internal scope.
109           */           */
110          inline static ScriptID fromEventID(event_id_t id) {          inline static ScriptID fromEventID(event_id_t id) {
111              return ScriptID(id);              return ScriptID(INSTR_SCRIPT_EVENT_ID_FLAG | id);
112          }          }
113    
114          /**          /**
# Line 228  namespace LinuxSampler { Line 256  namespace LinuxSampler {
256          VMInt8Array  m_KEY_DOWN;          VMInt8Array  m_KEY_DOWN;
257          //VMIntArray m_POLY_AT; //TODO: ...          //VMIntArray m_POLY_AT; //TODO: ...
258          //int m_POLY_AT_NUM; //TODO: ...          //int m_POLY_AT_NUM; //TODO: ...
259            VMIntRelPtr  m_NI_CALLBACK_TYPE;
260            VMIntRelPtr  m_NKSP_IGNORE_WAIT;
261    
262          // buil-in script functions          // buil-in script functions
263          InstrumentScriptVMFunction_play_note m_fnPlayNote;          InstrumentScriptVMFunction_play_note m_fnPlayNote;
# Line 244  namespace LinuxSampler { Line 274  namespace LinuxSampler {
274          InstrumentScriptVMFunction_change_cutoff m_fnChangeCutoff;          InstrumentScriptVMFunction_change_cutoff m_fnChangeCutoff;
275          InstrumentScriptVMFunction_change_reso m_fnChangeReso;          InstrumentScriptVMFunction_change_reso m_fnChangeReso;
276          InstrumentScriptVMFunction_event_status m_fnEventStatus;          InstrumentScriptVMFunction_event_status m_fnEventStatus;
277            InstrumentScriptVMFunction_wait m_fnWait2;
278            InstrumentScriptVMFunction_stop_wait m_fnStopWait;
279          InstrumentScriptVMDynVar_ENGINE_UPTIME m_varEngineUptime;          InstrumentScriptVMDynVar_ENGINE_UPTIME m_varEngineUptime;
280            InstrumentScriptVMDynVar_NI_CALLBACK_ID m_varCallbackID;
281    
282          friend class InstrumentScriptVMFunction_play_note;          friend class InstrumentScriptVMFunction_play_note;
283          friend class InstrumentScriptVMFunction_set_controller;          friend class InstrumentScriptVMFunction_set_controller;
# Line 260  namespace LinuxSampler { Line 293  namespace LinuxSampler {
293          friend class InstrumentScriptVMFunction_change_cutoff;          friend class InstrumentScriptVMFunction_change_cutoff;
294          friend class InstrumentScriptVMFunction_change_reso;          friend class InstrumentScriptVMFunction_change_reso;
295          friend class InstrumentScriptVMFunction_event_status;          friend class InstrumentScriptVMFunction_event_status;
296            friend class InstrumentScriptVMFunction_wait;
297            friend class InstrumentScriptVMFunction_stop_wait;
298          friend class InstrumentScriptVMDynVar_ENGINE_UPTIME;          friend class InstrumentScriptVMDynVar_ENGINE_UPTIME;
299            friend class InstrumentScriptVMDynVar_NI_CALLBACK_ID;
300      };      };
301    
302  } // namespace LinuxSampler  } // namespace LinuxSampler

Legend:
Removed from v.2942  
changed lines
  Added in v.2948

  ViewVC Help
Powered by ViewVC