bool VampEffectsModule::IsPluginValid(const PluginID & ID, const wxString & path) { Vamp::HostExt::PluginLoader *loader = Vamp::HostExt::PluginLoader::getInstance(); Vamp::Plugin *plug = loader->loadPlugin(ID.ToUTF8().data(), 48000); // rate doesn't matter here if (plug) { delete plug; return true; } return false; }
VampEffect::VampEffect(Vamp::HostExt::PluginLoader::PluginKey key, int output, bool hasParameters, wxString name, wxString category) : mKey(key), mOutput(output), mHasParameters(hasParameters), mName(name), mRate(0), mCategory(category), mPlugin(NULL) { Vamp::HostExt::PluginLoader *loader = Vamp::HostExt::PluginLoader::getInstance(); mPlugin = loader->loadPlugin(mKey, 48000); // rate doesn't matter here SetEffectFlags(PLUGIN_EFFECT | ANALYZE_EFFECT); }
bool VampEffect::Init() { Vamp::HostExt::PluginLoader *loader = Vamp::HostExt::PluginLoader::getInstance(); delete mPlugin; mPlugin = 0; TrackListIterator iter(mWaveTracks); WaveTrack *left = (WaveTrack *)iter.First(); mRate = 0.0; while (left) { if (mRate == 0.0) mRate = left->GetRate(); if (left->GetLinked()) { WaveTrack *right = (WaveTrack *)iter.Next(); if (left->GetRate() != right->GetRate()) { wxMessageBox(_("Sorry, Vamp Plug-ins cannot be run on stereo tracks where the individual channels of the track do not match.")); return false; } } left = (WaveTrack *)iter.Next(); } if (mRate <= 0.0) mRate = mProjectRate; mPlugin = loader->loadPlugin (mKey, mRate, Vamp::HostExt::PluginLoader::ADAPT_ALL); if (!mPlugin) { wxMessageBox(_("Sorry, failed to load Vamp Plug-in.")); return false; } return true; }
bool VampEffect::Init() { mRate = 0.0; // PRL: this loop checked that channels of a track have the same rate, // but there was no check that all tracks have one rate, and only the first // is remembered in mRate. Is that correct? for (auto leader : inputTracks()->Leaders<const WaveTrack>()) { auto channelGroup = TrackList::Channels( leader ); auto rate = (*channelGroup.first++) -> GetRate(); for(auto channel : channelGroup) { if (rate != channel->GetRate()) // PRL: Track rate might not match individual clip rates. // So is this check not adequate? { // TODO: more-than-two-channels-message Effect::MessageBox(_("Sorry, Vamp Plug-ins cannot be run on stereo tracks where the individual channels of the track do not match.")); return false; } } if (mRate == 0.0) mRate = rate; } if (mRate <= 0.0) { mRate = mProjectRate; } // The plugin must be reloaded to allow changing parameters Vamp::HostExt::PluginLoader *loader = Vamp::HostExt::PluginLoader::getInstance(); mPlugin.reset(loader->loadPlugin(mKey, mRate, Vamp::HostExt::PluginLoader::ADAPT_ALL)); if (!mPlugin) { Effect::MessageBox(_("Sorry, failed to load Vamp Plug-in.")); return false; } return true; }
wxString VampEffect::GetPath() { Vamp::HostExt::PluginLoader *loader = Vamp::HostExt::PluginLoader::getInstance(); return LAT1CTOWX(loader->getLibraryPathForPlugin(mKey).c_str()); }