2 Copyright (C) 2004 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include "ardour/linux_vst_support.h"
21 #include "ardour/session.h"
22 #include "ardour/lxvst_plugin.h"
27 using namespace ARDOUR;
30 LXVSTPlugin::LXVSTPlugin (AudioEngine& e, Session& session, VSTHandle* h)
31 : VSTPlugin (e, session, h)
33 /* Instantiate the plugin and return a VSTState* */
35 if ((_state = vstfx_instantiate (_handle, Session::vst_callback, this)) == 0) {
36 throw failed_constructor();
39 set_plugin (_state->plugin);
42 LXVSTPlugin::LXVSTPlugin (const LXVSTPlugin &other)
45 _handle = other._handle;
47 if ((_state = vstfx_instantiate (_handle, Session::vst_callback, this)) == 0) {
48 throw failed_constructor();
50 _plugin = _state->plugin;
52 // Plugin::setup_controls ();
55 LXVSTPlugin::~LXVSTPlugin ()
61 LXVSTPluginInfo::load (Session& session)
66 if (Config->get_use_lxvst()) {
69 handle = vstfx_load(path.c_str());
72 error << string_compose(_("LXVST: cannot load module from \"%1\""), path) << endmsg;
75 plugin.reset (new LXVSTPlugin (session.engine(), session, handle));
79 error << _("You asked ardour to not use any LXVST plugins") << endmsg;
80 return PluginPtr ((Plugin*) 0);
83 plugin->set_info(PluginInfoPtr(new LXVSTPluginInfo(*this)));
87 catch (failed_constructor &err) {
88 return PluginPtr ((Plugin*) 0);
92 LXVSTPluginInfo::LXVSTPluginInfo()