35 |
#include "../common/ResourceManager.h" |
#include "../common/ResourceManager.h" |
36 |
#include "../drivers/audio/AudioOutputDevice.h" |
#include "../drivers/audio/AudioOutputDevice.h" |
37 |
#include "common/Event.h" |
#include "common/Event.h" |
38 |
|
#include "common/Note.h" |
39 |
#include "common/SignalUnitRack.h" |
#include "common/SignalUnitRack.h" |
40 |
#include "common/InstrumentScriptVM.h" |
#include "common/InstrumentScriptVM.h" |
41 |
|
|
75 |
/** |
/** |
76 |
* Returns event with the given event ID. |
* Returns event with the given event ID. |
77 |
*/ |
*/ |
78 |
RTList<Event>::Iterator EventByID(int id) { |
RTList<Event>::Iterator EventByID(event_id_t id) { |
79 |
return pEventPool->fromID(id); |
return pEventPool->fromID(id); |
80 |
} |
} |
81 |
|
|
82 |
|
virtual NoteBase* NoteByID(note_id_t id) = 0; |
83 |
|
|
84 |
float Random() { |
float Random() { |
85 |
RandomSeed = RandomSeed * 1103515245 + 12345; // classic pseudo random number generator |
RandomSeed = RandomSeed * 1103515245 + 12345; // classic pseudo random number generator |
86 |
return RandomSeed / 4294967296.0f; |
return RandomSeed / 4294967296.0f; |
107 |
AudioChannel* pDedicatedVoiceChannelLeft; ///< encapsulates a special audio rendering buffer (left) for rendering and routing audio on a per voice basis (this is a very special case and only used for voices which lie on a note which was set with individual, dedicated FX send level) |
AudioChannel* pDedicatedVoiceChannelLeft; ///< encapsulates a special audio rendering buffer (left) for rendering and routing audio on a per voice basis (this is a very special case and only used for voices which lie on a note which was set with individual, dedicated FX send level) |
108 |
AudioChannel* pDedicatedVoiceChannelRight; ///< encapsulates a special audio rendering buffer (right) for rendering and routing audio on a per voice basis (this is a very special case and only used for voices which lie on a note which was set with individual, dedicated FX send level) |
AudioChannel* pDedicatedVoiceChannelRight; ///< encapsulates a special audio rendering buffer (right) for rendering and routing audio on a per voice basis (this is a very special case and only used for voices which lie on a note which was set with individual, dedicated FX send level) |
109 |
|
|
|
typedef ResourceConsumer<VMParserContext> ScriptConsumer; |
|
|
|
|
|
class ScriptResourceManager : public ResourceManager<String, VMParserContext> { |
|
|
protected: |
|
|
// implementation of derived abstract methods from 'ResourceManager' |
|
|
virtual VMParserContext* Create(String Key, ScriptConsumer* pConsumer, void*& pArg); |
|
|
virtual void Destroy(VMParserContext* pResource, void* pArg); |
|
|
virtual void OnBorrow(VMParserContext* pResource, ScriptConsumer* pConsumer, void*& pArg) {} // ignore |
|
|
public: |
|
|
ScriptResourceManager(AbstractEngine* parent) : parent(parent) {} |
|
|
virtual ~ScriptResourceManager() {} |
|
|
private: |
|
|
AbstractEngine* parent; |
|
|
} scripts; |
|
|
|
|
110 |
friend class AbstractVoice; |
friend class AbstractVoice; |
111 |
friend class AbstractEngineChannel; |
friend class AbstractEngineChannel; |
112 |
template<class V, class R, class I> friend class EngineChannelBase; |
template<class V, class R, class I> friend class EngineChannelBase; |
113 |
template<class EC, class R, class S, class D> friend class VoiceBase; |
template<class EC, class R, class S, class D> friend class VoiceBase; |
114 |
|
|
115 |
protected: |
//protected: |
116 |
ArrayList<EngineChannel*> engineChannels; ///< All engine channels of a Engine instance. |
ArrayList<EngineChannel*> engineChannels; ///< All engine channels of a Engine instance. |
117 |
ConditionServer EngineDisabled; |
ConditionServer EngineDisabled; |
118 |
int8_t ScaleTuning[12]; ///< contains optional detune factors (-64..+63 cents) for all 12 semitones of an octave |
int8_t ScaleTuning[12]; ///< contains optional detune factors (-64..+63 cents) for all 12 semitones of an octave |
152 |
virtual void ProcessChannelPressure(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itChannelPressureEvent) = 0; |
virtual void ProcessChannelPressure(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itChannelPressureEvent) = 0; |
153 |
virtual void ProcessPolyphonicKeyPressure(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itNotePressureEvent) = 0; |
virtual void ProcessPolyphonicKeyPressure(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itNotePressureEvent) = 0; |
154 |
virtual int GetMinFadeOutSamples() = 0; |
virtual int GetMinFadeOutSamples() = 0; |
155 |
virtual InstrumentScriptVM* CreateInstrumentScriptVM(); |
virtual note_id_t LaunchNewNote(LinuxSampler::EngineChannel* pEngineChannel, Event* pNoteOnEvent) = 0; |
156 |
|
virtual void CreateInstrumentScriptVM(); |
157 |
|
|
158 |
private: |
private: |
159 |
static std::map<Format, std::map<AudioOutputDevice*,AbstractEngine*> > engines; |
static std::map<Format, std::map<AudioOutputDevice*,AbstractEngine*> > engines; |