diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-07-27 16:52:14 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-07-27 16:52:14 +0000 |
commit | cc2767caf32486365a33814149e75c6e588e8603 (patch) | |
tree | 9d41c606a20ba2e2bb43be653e42050d38293a2e /libs/ardour/plugin_manager.cc | |
parent | d23fec7b9a0f076256dbd71faae254a78efbe37a (diff) |
added RCU handling of Session route list, and major use of shared_ptr<T> everywhere else. plus a few bug fixes for issues discovered with -Wextra
git-svn-id: svn://localhost/ardour2/trunk@707 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/plugin_manager.cc')
-rw-r--r-- | libs/ardour/plugin_manager.cc | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/libs/ardour/plugin_manager.cc b/libs/ardour/plugin_manager.cc index b096e81785..c8787a7d34 100644 --- a/libs/ardour/plugin_manager.cc +++ b/libs/ardour/plugin_manager.cc @@ -280,13 +280,14 @@ PluginManager::ladspa_discover (string path) return 0; } -Plugin * +boost::shared_ptr<Plugin> PluginManager::load (Session& session, PluginInfo *info) { void *module; - Plugin *plugin = 0; try { + boost::shared_ptr<Plugin> plugin; + if (info->type == PluginInfo::VST) { #ifdef VST_SUPPORT @@ -296,14 +297,14 @@ PluginManager::load (Session& session, PluginInfo *info) if ((handle = fst_load (info->path.c_str())) == 0) { error << string_compose(_("VST: cannot load module from \"%1\""), info->path) << endmsg; } else { - plugin = new VSTPlugin (_engine, session, handle); + plugin.reset (new VSTPlugin (_engine, session, handle)); } } else { error << _("You asked ardour to not use any VST plugins") << endmsg; } #else error << _("This version of ardour has no support for VST plugins") << endmsg; - return 0; + return boost::shared_ptr<Plugin> ((Plugin*) 0); #endif } else { @@ -312,21 +313,20 @@ PluginManager::load (Session& session, PluginInfo *info) error << string_compose(_("LADSPA: cannot load module from \"%1\""), info->path) << endmsg; error << dlerror() << endmsg; } else { - plugin = new LadspaPlugin (module, _engine, session, info->index, session.frame_rate()); + plugin.reset (new LadspaPlugin (module, _engine, session, info->index, session.frame_rate())); } } plugin->set_info(*info); + return plugin; } catch (failed_constructor &err) { - plugin = 0; + return boost::shared_ptr<Plugin> ((Plugin*) 0); } - - return plugin; } -Plugin * +boost::shared_ptr<Plugin> ARDOUR::find_plugin(Session& session, string name, long unique_id, PluginInfo::Type type) { PluginManager *mgr = PluginManager::the_manager(); @@ -343,7 +343,7 @@ ARDOUR::find_plugin(Session& session, string name, long unique_id, PluginInfo::T break; case PluginInfo::AudioUnit: default: - return 0; + return boost::shared_ptr<Plugin> ((Plugin *) 0); } for (i = plugs->begin(); i != plugs->end(); ++i) { @@ -353,7 +353,7 @@ ARDOUR::find_plugin(Session& session, string name, long unique_id, PluginInfo::T } } - return 0; + return boost::shared_ptr<Plugin> ((Plugin*) 0); } string |