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

Diff of /linuxsampler/trunk/src/engines/AbstractEngineChannel.h

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

revision 2593 by schoenebeck, Sun May 18 17:38:25 2014 UTC revision 2594 by schoenebeck, Thu Jun 5 00:16:25 2014 UTC
# Line 32  Line 32 
32  #include "../common/Pool.h"  #include "../common/Pool.h"
33  #include "../common/RingBuffer.h"  #include "../common/RingBuffer.h"
34    
35    #define CTRL_TABLE_IDX_AFTERTOUCH   128
36    #define CTRL_TABLE_IDX_PITCHBEND    129
37    
38  namespace LinuxSampler {  namespace LinuxSampler {
39    
40      class AbstractEngineChannel: public EngineChannel {      class AbstractEngineChannel: public EngineChannel, public AbstractEngine::ScriptConsumer {
41          public:          public:
42              // implementation of abstract methods derived from interface class 'LinuxSampler::EngineChannel'              // implementation of abstract methods derived from interface class 'LinuxSampler::EngineChannel'
43              virtual void    PrepareLoadInstrument(const char* FileName, uint Instrument) OVERRIDE;              virtual void    PrepareLoadInstrument(const char* FileName, uint Instrument) OVERRIDE;
# Line 83  namespace LinuxSampler { Line 86  namespace LinuxSampler {
86              virtual void    Connect(VirtualMidiDevice* pDevice) OVERRIDE;              virtual void    Connect(VirtualMidiDevice* pDevice) OVERRIDE;
87              virtual void    Disconnect(VirtualMidiDevice* pDevice) OVERRIDE;              virtual void    Disconnect(VirtualMidiDevice* pDevice) OVERRIDE;
88    
89                // implementation of abstract methods derived from AbstractEngine::ScriptConsumer
90                virtual void ResourceToBeUpdated(VMParserContext* pResource, void*& pUpdateArg) OVERRIDE {}
91                virtual void ResourceUpdated(VMParserContext* pOldResource, VMParserContext* pNewResource, void* pUpdateArg) OVERRIDE {}
92                virtual void OnResourceProgress(float fProgress) OVERRIDE {}
93    
94              virtual AbstractEngine::Format GetEngineFormat() = 0;              virtual AbstractEngine::Format GetEngineFormat() = 0;
95    
96              AudioOutputDevice* GetAudioOutputDeviceSafe();              AudioOutputDevice* GetAudioOutputDeviceSafe();
97                void loadInstrumentScript(const String& text);
98                void unloadCurrentInstrumentScript();
99    
100              friend class AbstractVoice;              friend class AbstractVoice;
101              friend class AbstractEngine;              friend class AbstractEngine;
102              template<class TV, class TRR, class TR, class TD, class TIM, class TI> friend class EngineBase;              template<class TV, class TRR, class TR, class TD, class TIM, class TI> friend class EngineBase;
103              template<class EC, class R, class S, class D> friend class VoiceBase;              template<class EC, class R, class S, class D> friend class VoiceBase;
104    
105          protected:          //protected:
106              AbstractEngineChannel();              AbstractEngineChannel();
107              virtual ~AbstractEngineChannel();              virtual ~AbstractEngineChannel();
108    
# Line 101  namespace LinuxSampler { Line 110  namespace LinuxSampler {
110              Mutex                     EngineMutex; ///< protects the Engine from access by the instrument loader thread when lscp is disconnecting              Mutex                     EngineMutex; ///< protects the Engine from access by the instrument loader thread when lscp is disconnecting
111              Mutex                     MidiInputMutex; ///< Introduced when support for multiple MIDI inputs per engine channel was added: protects the MIDI event input ringbuffer on this engine channel to be accessed concurrently by multiple midi input threads. As alternative one might also move the ringbuffer from this engine channel to the individual MIDI ports/devices and let the sampler engine read the events from there instead of receiving them here.              Mutex                     MidiInputMutex; ///< Introduced when support for multiple MIDI inputs per engine channel was added: protects the MIDI event input ringbuffer on this engine channel to be accessed concurrently by multiple midi input threads. As alternative one might also move the ringbuffer from this engine channel to the individual MIDI ports/devices and let the sampler engine read the events from there instead of receiving them here.
112    
113          protected:          //protected:
114              AudioChannel*             pChannelLeft;             ///< encapsulates the audio rendering buffer (left)              AudioChannel*             pChannelLeft;             ///< encapsulates the audio rendering buffer (left)
115              AudioChannel*             pChannelRight;            ///< encapsulates the audio rendering buffer (right)              AudioChannel*             pChannelRight;            ///< encapsulates the audio rendering buffer (right)
116              int                       AudioDeviceChannelLeft;   ///< audio device channel number to which the left channel is connected to              int                       AudioDeviceChannelLeft;   ///< audio device channel number to which the left channel is connected to
# Line 110  namespace LinuxSampler { Line 119  namespace LinuxSampler {
119              midi_chan_t               midiChannel;              ///< MIDI channel(s) on which this engine channel listens to (on all MIDI input ports).              midi_chan_t               midiChannel;              ///< MIDI channel(s) on which this engine channel listens to (on all MIDI input ports).
120              RingBuffer<Event,false>*  pEventQueue;              ///< Input event queue.              RingBuffer<Event,false>*  pEventQueue;              ///< Input event queue.
121              RTList<Event>*            pEvents;                  ///< All engine channel specific events for the current audio fragment.              RTList<Event>*            pEvents;                  ///< All engine channel specific events for the current audio fragment.
122              uint8_t                   ControllerTable[129];     ///< Reflects the current values (0-127) of all MIDI controllers for this engine / sampler channel. Number 128 is for channel pressure (mono aftertouch).              uint8_t                   ControllerTable[130];     ///< Reflects the current values (0-127) of all MIDI controllers for this engine / sampler channel. Number 128 is for channel pressure (mono aftertouch), 129 for pitch bend.
123              String                    InstrumentFile;              String                    InstrumentFile;
124              int                       InstrumentIdx;              int                       InstrumentIdx;
125              String                    InstrumentIdxName;              String                    InstrumentIdxName;
# Line 128  namespace LinuxSampler { Line 137  namespace LinuxSampler {
137              int                       iEngineIndexSelf;         ///< Reflects the index of this EngineChannel in the Engine's ArrayList.              int                       iEngineIndexSelf;         ///< Reflects the index of this EngineChannel in the Engine's ArrayList.
138              bool                      bStatusChanged;           ///< true in case an engine parameter has changed (e.g. new instrument, another volumet)              bool                      bStatusChanged;           ///< true in case an engine parameter has changed (e.g. new instrument, another volumet)
139              uint32_t                  RoundRobinIndex;          ///< counter for round robin sample selection, incremented for each note on              uint32_t                  RoundRobinIndex;          ///< counter for round robin sample selection, incremented for each note on
140                Pool<ScriptEvent>*        pScriptEvents;            ///< 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.
141                struct _Script {
142                    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!
143                    bool                  bHasValidScript; ///< True in case there is a valid script currently loaded, false if script processing shall be skipped.
144                    VMEventHandler*       handlerInit; ///< VM representation of script's initilization callback or NULL if current script did not define such an init handler.
145                    VMEventHandler*       handlerNote; ///< VM representation of script's MIDI note callback or NULL if current script did not define such an event handler.
146                    VMEventHandler*       handlerController; ///< VM representation of script's MIDI controller callback or NULL if current script did not define such an event handler.
147                    _Script() {
148                        parserContext = NULL;
149                        bHasValidScript = false;
150                        handlerNote = handlerController = NULL;
151                    }
152                } script;
153    
154              SynchronizedConfig< ArrayList<VirtualMidiDevice*> > virtualMidiDevices;              SynchronizedConfig< ArrayList<VirtualMidiDevice*> > virtualMidiDevices;
155              SynchronizedConfig< ArrayList<VirtualMidiDevice*> >::Reader virtualMidiDevicesReader_AudioThread;              SynchronizedConfig< ArrayList<VirtualMidiDevice*> >::Reader virtualMidiDevicesReader_AudioThread;

Legend:
Removed from v.2593  
changed lines
  Added in v.2594

  ViewVC Help
Powered by ViewVC