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.
22 #include "ardour/windows_vst_plugin.h"
23 #include "ardour/session.h"
28 using namespace ARDOUR;
31 WindowsVSTPlugin::WindowsVSTPlugin (AudioEngine& e, Session& session, VSTHandle* h, int unique_id)
32 : VSTPlugin (e, session, h)
34 Session::vst_current_loading_id = unique_id;
35 if ((_state = fst_instantiate (_handle, Session::vst_callback, this)) == 0) {
36 throw failed_constructor();
38 Session::vst_current_loading_id = 0;
40 set_plugin (_state->plugin);
43 WindowsVSTPlugin::WindowsVSTPlugin (const WindowsVSTPlugin &other)
46 _handle = other._handle;
48 Session::vst_current_loading_id = PBD::atoi(other.unique_id());
49 if ((_state = fst_instantiate (_handle, Session::vst_callback, this)) == 0) {
50 throw failed_constructor();
52 Session::vst_current_loading_id = 0;
54 _plugin = _state->plugin;
57 WindowsVSTPlugin::~WindowsVSTPlugin ()
64 WindowsVSTPluginInfo::load (Session& session)
69 if (Config->get_use_windows_vst ()) {
72 handle = fst_load(path.c_str());
75 error << string_compose(_("VST: cannot load module from \"%1\""), path) << endmsg;
77 plugin.reset (new WindowsVSTPlugin (session.engine(), session, handle, PBD::atoi(unique_id)));
80 error << _("You asked ardour to not use any VST plugins") << endmsg;
81 return PluginPtr ((Plugin*) 0);
84 plugin->set_info(PluginInfoPtr(new WindowsVSTPluginInfo(*this)));
88 catch (failed_constructor &err) {
89 return PluginPtr ((Plugin*) 0);
93 WindowsVSTPluginInfo::WindowsVSTPluginInfo()
95 type = ARDOUR::Windows_VST;