35 |
|
|
36 |
std::map<AbstractEngine::Format, std::map<AudioOutputDevice*,AbstractEngine*> > AbstractEngine::engines; |
std::map<AbstractEngine::Format, std::map<AudioOutputDevice*,AbstractEngine*> > AbstractEngine::engines; |
37 |
|
|
|
VMParserContext* AbstractEngine::ScriptResourceManager::Create(String Key, ScriptConsumer* pConsumer, void*& pArg) { |
|
|
return parent->pScriptVM->loadScript(Key); |
|
|
} |
|
|
|
|
|
void AbstractEngine::ScriptResourceManager::Destroy(VMParserContext* pResource, void* pArg) { |
|
|
delete pResource; |
|
|
} |
|
|
|
|
38 |
/** |
/** |
39 |
* Get an AbstractEngine object for the given AbstractEngineChannel and the |
* Get an AbstractEngine object for the given AbstractEngineChannel and the |
40 |
* given AudioOutputDevice. All engine channels which are connected to |
* given AudioOutputDevice. All engine channels which are connected to |
61 |
} else { // create a new engine (and disk thread) instance for the given audio output device |
} else { // create a new engine (and disk thread) instance for the given audio output device |
62 |
dmsg(4,("Creating new Engine.\n")); |
dmsg(4,("Creating new Engine.\n")); |
63 |
pEngine = (AbstractEngine*) EngineFactory::Create(pChannel->EngineName()); |
pEngine = (AbstractEngine*) EngineFactory::Create(pChannel->EngineName()); |
64 |
|
pEngine->CreateInstrumentScriptVM(); |
65 |
pEngine->Connect(pDevice); |
pEngine->Connect(pDevice); |
66 |
engines[pChannel->GetEngineFormat()][pDevice] = pEngine; |
engines[pChannel->GetEngineFormat()][pDevice] = pEngine; |
67 |
} |
} |
73 |
return pEngine; |
return pEngine; |
74 |
} |
} |
75 |
|
|
76 |
AbstractEngine::AbstractEngine() : scripts(this) { |
AbstractEngine::AbstractEngine() { |
77 |
pAudioOutputDevice = NULL; |
pAudioOutputDevice = NULL; |
78 |
pEventGenerator = NULL; |
pEventGenerator = NULL; |
79 |
pSysexBuffer = new RingBuffer<uint8_t,false>(CONFIG_SYSEX_BUFFER_SIZE, 0); |
pSysexBuffer = new RingBuffer<uint8_t,false>(CONFIG_SYSEX_BUFFER_SIZE, 0); |
83 |
FrameTime = 0; |
FrameTime = 0; |
84 |
RandomSeed = 0; |
RandomSeed = 0; |
85 |
pDedicatedVoiceChannelLeft = pDedicatedVoiceChannelRight = NULL; |
pDedicatedVoiceChannelLeft = pDedicatedVoiceChannelRight = NULL; |
86 |
pScriptVM = CreateInstrumentScriptVM(); |
pScriptVM = NULL; |
87 |
} |
} |
88 |
|
|
89 |
AbstractEngine::~AbstractEngine() { |
AbstractEngine::~AbstractEngine() { |
98 |
Unregister(); |
Unregister(); |
99 |
} |
} |
100 |
|
|
101 |
/** |
void AbstractEngine::CreateInstrumentScriptVM() { |
102 |
* Allocates a sampler format independent real-time instrument script |
dmsg(2,("Created sampler format independent instrument script VM.\n")); |
103 |
* runner. This method is overriden by sampler engines in case they have |
if (pScriptVM) return; |
104 |
* their own implementation of the script VM, with script feature extensions |
pScriptVM = new InstrumentScriptVM; // format independent script runner |
|
* required for their sampler format. |
|
|
*/ |
|
|
InstrumentScriptVM* AbstractEngine::CreateInstrumentScriptVM() { |
|
|
return new InstrumentScriptVM; // format independent script runner |
|
105 |
} |
} |
106 |
|
|
107 |
/** |
/** |