summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-03-24 15:48:34 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-03-24 15:48:34 +0000
commitdfe26ae407b199b23d010c9cb4f9b616b5fb1e0d (patch)
treebd8134347c55914258f60cb1ddcd448bb1eb314f /libs/ardour
parent21571906411af0f88344a3baf306ecfda408e15d (diff)
VST omnibus commit edition: use wine_pthread_create() everywhere instead of pthread_create; properly handle events when editor windows are closed, thus avoiding deadlock when deleting a VST plugin; actually delete plugins (of any kind) when requested to do so and there is an editor - this was a bug that has been around for quite a long time in 2.X; some extensions to the vestige header that might be legally dubious
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4889 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/audioengine.cc2
-rw-r--r--libs/ardour/globals.cc3
-rw-r--r--libs/ardour/insert.cc10
-rw-r--r--libs/ardour/osc.cc2
-rw-r--r--libs/ardour/plugin_manager.cc1
-rw-r--r--libs/ardour/route.cc2
-rw-r--r--libs/ardour/session_vst.cc23
-rw-r--r--libs/ardour/vst_plugin.cc20
8 files changed, 48 insertions, 15 deletions
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc
index cba634ccbf..001a4d4568 100644
--- a/libs/ardour/audioengine.cc
+++ b/libs/ardour/audioengine.cc
@@ -450,7 +450,7 @@ AudioEngine::set_session (Session *s)
/* page in as much of the session process code as we
can before we really start running.
*/
-
+
session->process (blocksize);
session->process (blocksize);
session->process (blocksize);
diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc
index 9ae697fd3b..65740d5a5d 100644
--- a/libs/ardour/globals.cc
+++ b/libs/ardour/globals.cc
@@ -378,6 +378,9 @@ ARDOUR::cleanup ()
delete Library;
lrdf_cleanup ();
delete &ControlProtocolManager::instance();
+#ifdef VST_SUPPORT
+ fst_exit ();
+#endif
return 0;
}
diff --git a/libs/ardour/insert.cc b/libs/ardour/insert.cc
index be4de27b01..dee63944c0 100644
--- a/libs/ardour/insert.cc
+++ b/libs/ardour/insert.cc
@@ -281,6 +281,8 @@ PluginInsert::connect_and_run (vector<Sample*>& bufs, uint32_t nbufs, nframes_t
be able to handle in-place processing.
*/
+ // cerr << "Connect and run for " << _plugins[0]->name() << " auto ? " << with_auto << endl;
+
if (with_auto) {
vector<AutomationList*>::iterator li;
@@ -293,11 +295,11 @@ PluginInsert::connect_and_run (vector<Sample*>& bufs, uint32_t nbufs, nframes_t
if (alist && alist->automation_playback()) {
bool valid;
- float val = alist->rt_safe_eval (now, valid);
+ // float val = alist->rt_safe_eval (now, valid);
if (valid) {
/* set the first plugin, the others will be set via signals */
- _plugins[0]->set_parameter (n, val);
+ // _plugins[0]->set_parameter (n, val);
}
}
@@ -309,6 +311,7 @@ PluginInsert::connect_and_run (vector<Sample*>& bufs, uint32_t nbufs, nframes_t
}
/* leave remaining channel buffers alone */
+ // cerr << "--- and out\n";
}
void
@@ -679,8 +682,7 @@ PluginInsert::set_state(const XMLNode& node)
*/
if (type == ARDOUR::VST) {
- if (prop = node.property ("id")) {
- }
+ prop = node.property ("id");
}
#endif
/* recheck */
diff --git a/libs/ardour/osc.cc b/libs/ardour/osc.cc
index 384e77aa3d..ab611d0ee7 100644
--- a/libs/ardour/osc.cc
+++ b/libs/ardour/osc.cc
@@ -241,7 +241,7 @@ OSC::init_osc_thread ()
pthread_attr_init(&attr);
pthread_attr_setstacksize(&attr, 500000);
- pthread_create (&_osc_thread, &attr, &OSC::_osc_receiver, this);
+ pthread_create_and_store (X_("OSC"), &_osc_thread, &attr, &OSC::_osc_receiver, this);
if (!_osc_thread) {
return false;
}
diff --git a/libs/ardour/plugin_manager.cc b/libs/ardour/plugin_manager.cc
index 7a3caf44c4..a069dd1762 100644
--- a/libs/ardour/plugin_manager.cc
+++ b/libs/ardour/plugin_manager.cc
@@ -309,7 +309,6 @@ PluginManager::ladspa_discover (string path)
const LADSPA_Descriptor *descriptor;
LADSPA_Descriptor_Function dfunc;
const char *errstr;
- bool first = true;
if ((module = dlopen (path.c_str(), RTLD_NOW)) == 0) {
error << string_compose(_("LADSPA: cannot load module \"%1\" (%2)"), path, dlerror()) << endmsg;
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 47b94432e4..91c3423388 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -1152,8 +1152,8 @@ Route::remove_redirect (boost::shared_ptr<Redirect> redirect, void *src, uint32_
}
redirect->drop_references ();
-
redirects_changed (src); /* EMIT SIGNAL */
+
return 0;
}
diff --git a/libs/ardour/session_vst.cc b/libs/ardour/session_vst.cc
index 87930d9934..b70b75a403 100644
--- a/libs/ardour/session_vst.cc
+++ b/libs/ardour/session_vst.cc
@@ -29,10 +29,11 @@
#include "i18n.h"
-#undef DEBUG_CALLBACKS
+#define DEBUG_CALLBACKS
+static int debug_callbacks = -1;
#ifdef DEBUG_CALLBACKS
-#define SHOW_CALLBACK printf
+#define SHOW_CALLBACK if (debug_callbacks) printf
#else
#define SHOW_CALLBACK(...)
#endif
@@ -50,15 +51,18 @@ long Session::vst_callback (AEffect* effect,
VSTPlugin* plug;
Session* session;
+ if (debug_callbacks < 0) {
+ debug_callbacks = (getenv ("ARDOUR_DEBUG_VST_CALLBACKS") != 0);
+ }
if (effect && effect->user) {
plug = (VSTPlugin*) (effect->user);
session = &plug->session();
- SHOW_CALLBACK ("am callback %d, opcode = %ld, plugin = \"%s\" ", pthread_self(), opcode, plug->name());
+ SHOW_CALLBACK ("am callback 0x%x, opcode = %ld, plugin = \"%s\" ", pthread_self(), opcode, plug->name());
} else {
plug = 0;
session = 0;
- SHOW_CALLBACK ("am callback %d, opcode = %ld", pthread_self(), opcode);
+ SHOW_CALLBACK ("am callback 0x%x, opcode = %ld", pthread_self(), opcode);
}
switch(opcode){
@@ -174,7 +178,10 @@ long Session::vst_callback (AEffect* effect,
case audioMasterNeedIdle:
SHOW_CALLBACK ("amc: audioMasterNeedIdle\n");
- // plug needs idle calls (outside its editor window)
+ // plug needs idle calls (outside its editor window)
+ if (plug) {
+ plug->fst()->wantIdle = 1;
+ }
return 0;
case audioMasterSizeWindow:
@@ -184,10 +191,16 @@ long Session::vst_callback (AEffect* effect,
case audioMasterGetSampleRate:
SHOW_CALLBACK ("amc: audioMasterGetSampleRate\n");
+ if (session) {
+ return session->frame_rate();
+ }
return 0;
case audioMasterGetBlockSize:
SHOW_CALLBACK ("amc: audioMasterGetBlockSize\n");
+ if (session) {
+ return session->get_block_size();
+ }
return 0;
case audioMasterGetInputLatency:
diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc
index ec30087ee1..7fcb65e445 100644
--- a/libs/ardour/vst_plugin.cc
+++ b/libs/ardour/vst_plugin.cc
@@ -70,13 +70,16 @@ VSTPlugin::VSTPlugin (AudioEngine& e, Session& session, FSTHandle* h)
/* set rate and blocksize */
+ //cerr << "Dispatch " << "effSetSampleRate" << " for " << name() << endl;
_plugin->dispatcher (_plugin, effSetSampleRate, 0, 0, NULL,
(float) session.frame_rate());
+ //cerr << "Dispatch " << "effSetBlockSize" << " for " << name() << endl;
_plugin->dispatcher (_plugin, effSetBlockSize, 0,
session.get_block_size(), NULL, 0.0f);
/* set program to zero */
+ //cerr << "Dispatch " << "effSetProgram" << " for " << name() << endl;
_plugin->dispatcher (_plugin, effSetProgram, 0, 0, NULL, 0.0f);
Plugin::setup_controls ();
@@ -106,6 +109,7 @@ void
VSTPlugin::set_block_size (nframes_t nframes)
{
deactivate ();
+ //cerr << "Dispatch effSetBlockSize for " << name() << endl;
_plugin->dispatcher (_plugin, effSetBlockSize, 0, nframes, NULL, 0.0f);
activate ();
}
@@ -119,13 +123,17 @@ VSTPlugin::default_value (uint32_t port)
void
VSTPlugin::set_parameter (uint32_t which, float val)
{
+ // cerr << "SetParameter for " << name() << endl;
_plugin->setParameter (_plugin, which, val);
+ // cerr << "signal param change\n";
ParameterChanged (which, val); /* EMIT SIGNAL */
+ // cerr << "change done\n";
}
float
VSTPlugin::get_parameter (uint32_t which) const
{
+ // cerr << "GetParameter for " << name() << endl;
return _plugin->getParameter (_plugin, which);
}
@@ -150,6 +158,7 @@ VSTPlugin::get_state()
guchar* data;
long data_size;
+ //cerr << "Dispatch getChunk for " << name() << endl;
if ((data_size = _plugin->dispatcher (_plugin, 23 /* effGetChunk */, 0, 0, &data, false)) == 0) {
return *root;
}
@@ -202,6 +211,7 @@ VSTPlugin::set_state(const XMLNode& node)
if ((*n)->is_content ()) {
gsize chunk_size = 0;
guchar * data = g_base64_decode ((*n)->content ().c_str (), &chunk_size);
+ //cerr << "Dispatch setChunk for " << name() << endl;
if (_plugin->dispatcher (_plugin, 24 /* effSetChunk */, 0, chunk_size, data, 0) == 0) {
g_free (data);
return 0;
@@ -224,6 +234,7 @@ VSTPlugin::set_state(const XMLNode& node)
sscanf ((*i)->name().c_str(), "param_%ld", &param);
sscanf ((*i)->value().c_str(), "%f", &val);
+ // cerr << "setParameter for " << name() << endl;
_plugin->setParameter (_plugin, param, val);
}
@@ -241,9 +252,9 @@ VSTPlugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor& desc)
desc.min_unbound = false;
desc.max_unbound = false;
+ //cerr << "Dispatch getParameterProperties for " << name() << endl;
if (_plugin->dispatcher (_plugin, effGetParameterProperties, which, 0, &prop, 0)) {
-#ifdef VESTIGE_COMPLETE
/* i have yet to find or hear of a VST plugin that uses this */
if (prop.flags & kVstParameterUsesIntegerMinMax) {
@@ -279,7 +290,6 @@ VSTPlugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor& desc)
desc.logarithmic = false;
desc.sr_dependent = false;
desc.label = prop.label;
-#endif
} else {
@@ -288,6 +298,7 @@ VSTPlugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor& desc)
char label[64];
label[0] = '\0';
+ // cerr << "Dispatch paramName for " << name() << endl;
_plugin->dispatcher (_plugin, effGetParamName, which, 0, label, 0);
desc.label = label;
@@ -333,6 +344,7 @@ string
VSTPlugin::describe_parameter (uint32_t param)
{
char name[64];
+ // cerr << "Dispatch effGetParamName for " << this->name() << endl;
_plugin->dispatcher (_plugin, effGetParamName, param, 0, name, 0);
return name;
}
@@ -390,6 +402,7 @@ VSTPlugin::connect_and_run (vector<Sample*>& bufs, uint32_t maxbuf, int32_t& in_
/* we already know it can support processReplacing */
+ // cerr << "!ProcessReplacing for " << name() << endl;
_plugin->processReplacing (_plugin, ins, outs, nframes);
return 0;
@@ -398,12 +411,14 @@ VSTPlugin::connect_and_run (vector<Sample*>& bufs, uint32_t maxbuf, int32_t& in_
void
VSTPlugin::deactivate ()
{
+ //cerr << "Dispatch effMainsChanged for " << name() << endl;
_plugin->dispatcher (_plugin, effMainsChanged, 0, 0, NULL, 0.0f);
}
void
VSTPlugin::activate ()
{
+ //cerr << "Dispatch effMainsChanged for " << name() << endl;
_plugin->dispatcher (_plugin, effMainsChanged, 0, 1, NULL, 0.0f);
}
@@ -455,6 +470,7 @@ VSTPlugin::print_parameter (uint32_t param, char *buf, uint32_t len) const
{
char *first_nonws;
+ //cerr << "Dispatch getParamDisplay for " << name() << endl;
_plugin->dispatcher (_plugin, 7 /* effGetParamDisplay */, param, 0, buf, 0);
if (buf[0] == '\0') {