31 |
|
|
32 |
#include "../common/Pool.h" |
#include "../common/Pool.h" |
33 |
#include "../common/RingBuffer.h" |
#include "../common/RingBuffer.h" |
34 |
|
#include "../common/ResourceManager.h" |
35 |
|
#include "common/AbstractInstrumentManager.h" |
36 |
|
#include "common/InstrumentScriptVM.h" |
37 |
|
|
38 |
#define CTRL_TABLE_IDX_AFTERTOUCH 128 |
#define CTRL_TABLE_IDX_AFTERTOUCH 128 |
39 |
#define CTRL_TABLE_IDX_PITCHBEND 129 |
#define CTRL_TABLE_IDX_PITCHBEND 129 |
40 |
|
|
41 |
namespace LinuxSampler { |
namespace LinuxSampler { |
42 |
|
|
43 |
class AbstractEngineChannel: public EngineChannel, public AbstractEngine::ScriptConsumer { |
class MidiKeyboardManagerBase; |
44 |
|
|
45 |
|
class AbstractEngineChannel: public EngineChannel, public InstrumentScriptConsumer { |
46 |
public: |
public: |
47 |
// implementation of abstract methods derived from interface class 'LinuxSampler::EngineChannel' |
// implementation of abstract methods derived from interface class 'LinuxSampler::EngineChannel' |
48 |
virtual void PrepareLoadInstrument(const char* FileName, uint Instrument) OVERRIDE; |
virtual void PrepareLoadInstrument(const char* FileName, uint Instrument) OVERRIDE; |
97 |
virtual void OnResourceProgress(float fProgress) OVERRIDE {} |
virtual void OnResourceProgress(float fProgress) OVERRIDE {} |
98 |
|
|
99 |
virtual AbstractEngine::Format GetEngineFormat() = 0; |
virtual AbstractEngine::Format GetEngineFormat() = 0; |
100 |
|
virtual MidiKeyboardManagerBase* GetMidiKeyboardManager() = 0; |
101 |
|
|
102 |
AudioOutputDevice* GetAudioOutputDeviceSafe(); |
AudioOutputDevice* GetAudioOutputDeviceSafe(); |
|
void loadInstrumentScript(const String& text); |
|
|
void unloadCurrentInstrumentScript(); |
|
103 |
|
|
104 |
friend class AbstractVoice; |
friend class AbstractVoice; |
105 |
friend class AbstractEngine; |
friend class AbstractEngine; |
141 |
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. |
142 |
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) |
143 |
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 |
144 |
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. |
InstrumentScript* pScript; ///< Points to the real-time instrument script(s) to be executed, NULL if current instrument does not have an instrument script. Even though the underlying VM representation of the script is shared among multiple sampler channels, the InstrumentScript object here is not shared though, it exists for each sampler channel separately. |
|
struct _Script { |
|
|
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! |
|
|
bool bHasValidScript; ///< True in case there is a valid script currently loaded, false if script processing shall be skipped. |
|
|
VMEventHandler* handlerInit; ///< VM representation of script's initilization callback or NULL if current script did not define such an init handler. |
|
|
VMEventHandler* handlerNote; ///< VM representation of script's MIDI note on callback or NULL if current script did not define such an event handler. |
|
|
VMEventHandler* handlerRelease; ///< VM representation of script's MIDI note off callback or NULL if current script did not define such an event handler. |
|
|
VMEventHandler* handlerController; ///< VM representation of script's MIDI controller callback or NULL if current script did not define such an event handler. |
|
|
_Script() { |
|
|
parserContext = NULL; |
|
|
bHasValidScript = false; |
|
|
handlerInit = NULL; |
|
|
handlerNote = NULL; |
|
|
handlerRelease = NULL; |
|
|
handlerController = NULL; |
|
|
} |
|
|
} script; |
|
145 |
|
|
146 |
SynchronizedConfig< ArrayList<VirtualMidiDevice*> > virtualMidiDevices; |
SynchronizedConfig< ArrayList<VirtualMidiDevice*> > virtualMidiDevices; |
147 |
SynchronizedConfig< ArrayList<VirtualMidiDevice*> >::Reader virtualMidiDevicesReader_AudioThread; |
SynchronizedConfig< ArrayList<VirtualMidiDevice*> >::Reader virtualMidiDevicesReader_AudioThread; |
170 |
virtual void RemoveAllFxSends(); |
virtual void RemoveAllFxSends(); |
171 |
|
|
172 |
void ImportEvents(uint Samples); |
void ImportEvents(uint Samples); |
173 |
void ScheduleEvent(const Event* pEvent, int delay); //TODO: delay not implemented yet |
int ScheduleEvent(const Event* pEvent, int delay); //TODO: delay not implemented yet |
174 |
|
void IgnoreEvent(int id); |
175 |
|
|
176 |
void AddGroup(uint group); |
void AddGroup(uint group); |
177 |
void HandleKeyGroupConflicts(uint KeyGroup, Pool<Event>::Iterator& itNoteOnEvent); |
void HandleKeyGroupConflicts(uint KeyGroup, Pool<Event>::Iterator& itNoteOnEvent); |