Mercurial > hg > vamp-plugin-sdk
comparison src/vamp-hostsdk/PluginLoader.cpp @ 466:a94ab90dfd53 vampipe
Remove RequestResponse, PluginConfiguration and PluginStaticData again. I don't think they are proving general enough to be worth adding to this SDK at this point. Will try them out in piper-cpp instead.
| author | Chris Cannam | 
|---|---|
| date | Thu, 13 Oct 2016 17:06:53 +0100 | 
| parents | 85dadd0d482f | 
| children | 0545cd3f1738 | 
   comparison
  equal
  deleted
  inserted
  replaced
| 465:e32815f133d6 | 466:a94ab90dfd53 | 
|---|---|
| 60 Impl(); | 60 Impl(); | 
| 61 virtual ~Impl(); | 61 virtual ~Impl(); | 
| 62 | 62 | 
| 63 PluginKeyList listPlugins(); | 63 PluginKeyList listPlugins(); | 
| 64 | 64 | 
| 65 ListResponse listPluginData(); | |
| 66 | |
| 67 Plugin *loadPlugin(PluginKey key, | 65 Plugin *loadPlugin(PluginKey key, | 
| 68 float inputSampleRate, | 66 float inputSampleRate, | 
| 69 int adapterFlags); | 67 int adapterFlags); | 
| 70 | |
| 71 LoadResponse loadPlugin(LoadRequest req); | |
| 72 | |
| 73 ConfigurationResponse configurePlugin(ConfigurationRequest req); | |
| 74 | 68 | 
| 75 PluginKey composePluginKey(string libraryName, string identifier); | 69 PluginKey composePluginKey(string libraryName, string identifier); | 
| 76 | 70 | 
| 77 PluginCategoryHierarchy getPluginCategory(PluginKey key); | 71 PluginCategoryHierarchy getPluginCategory(PluginKey key); | 
| 78 | 72 | 
| 148 PluginLoader::listPlugins() | 142 PluginLoader::listPlugins() | 
| 149 { | 143 { | 
| 150 return m_impl->listPlugins(); | 144 return m_impl->listPlugins(); | 
| 151 } | 145 } | 
| 152 | 146 | 
| 153 ListResponse | |
| 154 PluginLoader::listPluginData() | |
| 155 { | |
| 156 return m_impl->listPluginData(); | |
| 157 } | |
| 158 | |
| 159 Plugin * | 147 Plugin * | 
| 160 PluginLoader::loadPlugin(PluginKey key, | 148 PluginLoader::loadPlugin(PluginKey key, | 
| 161 float inputSampleRate, | 149 float inputSampleRate, | 
| 162 int adapterFlags) | 150 int adapterFlags) | 
| 163 { | 151 { | 
| 164 return m_impl->loadPlugin(key, inputSampleRate, adapterFlags); | 152 return m_impl->loadPlugin(key, inputSampleRate, adapterFlags); | 
| 165 } | 153 } | 
| 166 | 154 | 
| 167 LoadResponse | |
| 168 PluginLoader::loadPlugin(LoadRequest req) | |
| 169 { | |
| 170 return m_impl->loadPlugin(req); | |
| 171 } | |
| 172 | |
| 173 ConfigurationResponse | |
| 174 PluginLoader::configurePlugin(ConfigurationRequest req) | |
| 175 { | |
| 176 return m_impl->configurePlugin(req); | |
| 177 } | |
| 178 | |
| 179 PluginLoader::PluginKey | 155 PluginLoader::PluginKey | 
| 180 PluginLoader::composePluginKey(string libraryName, string identifier) | 156 PluginLoader::composePluginKey(string libraryName, string identifier) | 
| 181 { | 157 { | 
| 182 return m_impl->composePluginKey(libraryName, identifier); | 158 return m_impl->composePluginKey(libraryName, identifier); | 
| 183 } | 159 } | 
| 219 mi != m_pluginLibraryNameMap.end(); ++mi) { | 195 mi != m_pluginLibraryNameMap.end(); ++mi) { | 
| 220 plugins.push_back(mi->first); | 196 plugins.push_back(mi->first); | 
| 221 } | 197 } | 
| 222 | 198 | 
| 223 return plugins; | 199 return plugins; | 
| 224 } | |
| 225 | |
| 226 ListResponse | |
| 227 PluginLoader::Impl::listPluginData() | |
| 228 { | |
| 229 PluginKeyList keys = listPlugins(); | |
| 230 ListResponse response; | |
| 231 | |
| 232 for (PluginKeyList::const_iterator ki = keys.begin(); ki != keys.end(); ++ki) { | |
| 233 string key = *ki; | |
| 234 Plugin *p = loadPlugin(key, 44100, 0); | |
| 235 if (p) { | |
| 236 PluginCategoryHierarchy category = getPluginCategory(key); | |
| 237 response.available.push_back | |
| 238 (PluginStaticData::fromPlugin(key, category, p)); | |
| 239 } | |
| 240 delete p; | |
| 241 } | |
| 242 | |
| 243 return response; | |
| 244 } | 200 } | 
| 245 | 201 | 
| 246 void | 202 void | 
| 247 PluginLoader::Impl::enumeratePlugins(PluginKey forPlugin) | 203 PluginLoader::Impl::enumeratePlugins(PluginKey forPlugin) | 
| 248 { | 204 { | 
| 424 << fullPath << "\"" << endl; | 380 << fullPath << "\"" << endl; | 
| 425 | 381 | 
| 426 return 0; | 382 return 0; | 
| 427 } | 383 } | 
| 428 | 384 | 
| 429 LoadResponse | |
| 430 PluginLoader::Impl::loadPlugin(LoadRequest req) | |
| 431 { | |
| 432 Plugin *plugin = loadPlugin(req.pluginKey, | |
| 433 req.inputSampleRate, | |
| 434 req.adapterFlags); | |
| 435 LoadResponse response; | |
| 436 response.plugin = plugin; | |
| 437 if (!plugin) return response; | |
| 438 | |
| 439 response.plugin = plugin; | |
| 440 response.staticData = PluginStaticData::fromPlugin | |
| 441 (req.pluginKey, | |
| 442 getPluginCategory(req.pluginKey), | |
| 443 plugin); | |
| 444 | |
| 445 int defaultChannels = 0; | |
| 446 if (plugin->getMinChannelCount() == plugin->getMaxChannelCount()) { | |
| 447 defaultChannels = plugin->getMinChannelCount(); | |
| 448 } | |
| 449 | |
| 450 response.defaultConfiguration = PluginConfiguration::fromPlugin | |
| 451 (plugin, | |
| 452 defaultChannels, | |
| 453 plugin->getPreferredStepSize(), | |
| 454 plugin->getPreferredBlockSize()); | |
| 455 | |
| 456 return response; | |
| 457 } | |
| 458 | |
| 459 ConfigurationResponse | |
| 460 PluginLoader::Impl::configurePlugin(ConfigurationRequest req) | |
| 461 { | |
| 462 for (PluginConfiguration::ParameterMap::const_iterator i = | |
| 463 req.configuration.parameterValues.begin(); | |
| 464 i != req.configuration.parameterValues.end(); ++i) { | |
| 465 req.plugin->setParameter(i->first, i->second); | |
| 466 } | |
| 467 | |
| 468 if (req.configuration.currentProgram != "") { | |
| 469 req.plugin->selectProgram(req.configuration.currentProgram); | |
| 470 } | |
| 471 | |
| 472 ConfigurationResponse response; | |
| 473 | |
| 474 response.plugin = req.plugin; | |
| 475 | |
| 476 if (req.plugin->initialise(req.configuration.channelCount, | |
| 477 req.configuration.stepSize, | |
| 478 req.configuration.blockSize)) { | |
| 479 response.outputs = req.plugin->getOutputDescriptors(); | |
| 480 } | |
| 481 | |
| 482 return response; | |
| 483 } | |
| 484 | |
| 485 void | 385 void | 
| 486 PluginLoader::Impl::generateTaxonomy() | 386 PluginLoader::Impl::generateTaxonomy() | 
| 487 { | 387 { | 
| 488 // cerr << "PluginLoader::Impl::generateTaxonomy" << endl; | 388 // cerr << "PluginLoader::Impl::generateTaxonomy" << endl; | 
| 489 | 389 | 
