comparison vamp-sdk/hostext/PluginLoader.cpp @ 61:97c5ac99d725 host-factory-stuff

* install hostext headers to vamp-sdk/hostext/ rather than vamp-sdk/ * adjust timestamps in input-domain adapter so as to centre them on block as required by Plugin documentation * better handling for frequency-domain plugins that want non-power-of-two blocksizes (can't handle them, but at least try offering them a power-of-two alternative) * couple of Plugin doc additions * make PluginLoader capable of returning ready-wrapped plugins
author cannam
date Fri, 01 Jun 2007 13:53:42 +0000
parents fa79c4ec847d
children
comparison
equal deleted inserted replaced
60:087c16cca0d6 61:97c5ac99d725
34 authorization. 34 authorization.
35 */ 35 */
36 36
37 #include "vamp-sdk/PluginHostAdapter.h" 37 #include "vamp-sdk/PluginHostAdapter.h"
38 #include "PluginLoader.h" 38 #include "PluginLoader.h"
39 #include "PluginInputDomainAdapter.h"
40 #include "PluginChannelAdapter.h"
39 41
40 #include <fstream> 42 #include <fstream>
41 43
42 #ifdef _WIN32 44 #ifdef _WIN32
43 45
169 if (m_pluginLibraryNameMap.find(plugin) == m_pluginLibraryNameMap.end()) return ""; 171 if (m_pluginLibraryNameMap.find(plugin) == m_pluginLibraryNameMap.end()) return "";
170 return m_pluginLibraryNameMap[plugin]; 172 return m_pluginLibraryNameMap[plugin];
171 } 173 }
172 174
173 Plugin * 175 Plugin *
174 PluginLoader::loadPlugin(PluginKey key, float inputSampleRate) 176 PluginLoader::loadPlugin(PluginKey key, float inputSampleRate, int adapterFlags)
175 { 177 {
176 string fullPath = getLibraryPathForPlugin(key); 178 string fullPath = getLibraryPathForPlugin(key);
177 if (fullPath == "") return 0; 179 if (fullPath == "") return 0;
178 180
179 string::size_type ki = key.find(':'); 181 string::size_type ki = key.find(':');
204 if (string(descriptor->identifier) == identifier) { 206 if (string(descriptor->identifier) == identifier) {
205 207
206 Vamp::PluginHostAdapter *plugin = 208 Vamp::PluginHostAdapter *plugin =
207 new Vamp::PluginHostAdapter(descriptor, inputSampleRate); 209 new Vamp::PluginHostAdapter(descriptor, inputSampleRate);
208 210
209 PluginDeletionNotifyAdapter *adapter = 211 Plugin *adapter = new PluginDeletionNotifyAdapter(plugin, this);
210 new PluginDeletionNotifyAdapter(plugin, this);
211 212
212 m_pluginLibraryHandleMap[adapter] = handle; 213 m_pluginLibraryHandleMap[adapter] = handle;
214
215 if (adapterFlags & ADAPT_INPUT_DOMAIN) {
216 if (adapter->getInputDomain() == Plugin::FrequencyDomain) {
217 adapter = new PluginInputDomainAdapter(adapter);
218 }
219 }
220
221 if (adapterFlags & ADAPT_CHANNEL_COUNT) {
222 adapter = new PluginChannelAdapter(adapter);
223 }
224
213 return adapter; 225 return adapter;
214 } 226 }
215 227
216 ++index; 228 ++index;
217 } 229 }