MCPcopy Create free account
hub / github.com/audacity/audacity / FindPlugin

Method FindPlugin

src/effects/vamp/LoadVamp.cpp:251–325  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249// VampEffectsModule implementation
250
251std::unique_ptr<Vamp::Plugin> VampEffectsModule::FindPlugin(const PluginPath & path,
252 int & output,
253 bool & hasParameters)
254{
255 PluginLoader::PluginKey key = path.BeforeFirst(wxT('/')).ToUTF8().data();
256
257 std::unique_ptr<Plugin> vp{ PluginLoader::getInstance()->loadPlugin(key, 48000) }; // rate doesn't matter here
258 if (!vp)
259 {
260 return nullptr;
261 }
262
263 // We limit the listed plugin outputs to those whose results can
264 // readily be displayed in an Audacity label track.
265 //
266 // - Any output whose features have no values (time instants only),
267 // with or without duration, is fine
268 //
269 // - Any output whose features have more than one value, or an
270 // unknown or variable number of values, is right out
271 //
272 // - Any output whose features have exactly one value, with
273 // variable sample rate or with duration, should be OK --
274 // this implies a sparse feature, of which the time and/or
275 // duration are significant aspects worth displaying
276 //
277 // - An output whose features have exactly one value, with
278 // fixed sample rate and no duration, cannot be usefully
279 // displayed -- the value is the only significant piece of
280 // data there and we have no good value plot
281
282 Plugin::OutputList outputs = vp->getOutputDescriptors();
283
284 output = 0;
285
286 hasParameters = !vp->getParameterDescriptors().empty();
287
288 for (Plugin::OutputList::iterator j = outputs.begin(); j != outputs.end(); ++j)
289 {
290 if (j->sampleType == Plugin::OutputDescriptor::FixedSampleRate ||
291 j->sampleType == Plugin::OutputDescriptor::OneSamplePerStep ||
292 !j->hasFixedBinCount ||
293 j->binCount > 1)
294 {
295 // All of these qualities disqualify (see notes above)
296
297 ++output;
298 continue;
299 }
300
301 wxString name = wxString::FromUTF8(vp->getName().c_str());
302
303 if (outputs.size() > 1)
304 {
305 // This is not the plugin's only output.
306 // Use "plugin name: output name" as the effect name,
307 // unless the output name is the same as the plugin name
308 wxString outputName = wxString::FromUTF8(j->name.c_str());

Callers

nothing calls this directly

Calls 10

loadPluginMethod · 0.80
dataMethod · 0.45
getOutputDescriptorsMethod · 0.45
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
c_strMethod · 0.45
getNameMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected