summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-07-03 04:42:41 +0000
committerDavid Robillard <d@drobilla.net>2007-07-03 04:42:41 +0000
commit0a4dfb16428463d10d12a821afaed866a701550d (patch)
tree7505ff69fa98bea30fd16b8c90a02e77aa1f7b54 /src
parent06548d893646764cbda3bef2f440b953b1716ae5 (diff)
downloadingen-0a4dfb16428463d10d12a821afaed866a701550d.tar.gz
ingen-0a4dfb16428463d10d12a821afaed866a701550d.tar.bz2
ingen-0a4dfb16428463d10d12a821afaed866a701550d.zip
Fix crash on MIDI controller receiving.
Fixed various plugin loading related bugs. Fix strange liblo bug.. maybe.. Little bit of preliminary LV2 GUI stuff. git-svn-id: http://svn.drobilla.net/lad/ingen@561 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/libs/client/PluginModel.cpp29
-rw-r--r--src/libs/client/PluginModel.h2
-rw-r--r--src/libs/engine/MidiControlNode.cpp4
-rw-r--r--src/libs/engine/NodeFactory.cpp50
-rw-r--r--src/libs/engine/OSCEngineReceiver.cpp6
-rw-r--r--src/libs/engine/QueuedEngineInterface.cpp2
-rw-r--r--src/libs/engine/QueuedEventSource.cpp3
-rw-r--r--src/libs/engine/events/LoadPluginsEvent.cpp15
-rw-r--r--src/libs/engine/events/LoadPluginsEvent.h8
-rw-r--r--src/libs/gui/NodeModule.cpp8
10 files changed, 86 insertions, 41 deletions
diff --git a/src/libs/client/PluginModel.cpp b/src/libs/client/PluginModel.cpp
index 24b45179..c8d44837 100644
--- a/src/libs/client/PluginModel.cpp
+++ b/src/libs/client/PluginModel.cpp
@@ -48,6 +48,35 @@ PluginModel::default_node_name(SharedPtr<PatchModel> parent)
return name;
}
+#ifdef HAVE_SLV2
+void*
+PluginModel::gui()
+{
+ assert(_type == LV2);
+
+ SLV2Values gui = slv2_plugin_get_guis(_slv2_plugin);
+ if (slv2_values_size(gui) > 0) {
+ printf("\tGUI:\n");
+ for (unsigned i=0; i < slv2_values_size(gui); ++i) {
+ printf("\t\t%s\n", slv2_value_as_uri(slv2_values_get_at(gui, i)));
+
+ SLV2Value binary = slv2_plugin_get_gui_library_uri(_slv2_plugin, slv2_values_get_at(gui, i));
+
+ printf("\t\t\tType: %s\n", slv2_gui_type_get_uri(slv2_value_as_gui_type(
+ slv2_values_get_at(gui, i))));
+
+ if (binary)
+ printf("\t\t\tBinary: %s\n", slv2_value_as_uri(binary));
+
+ slv2_value_free(binary);
+ }
+ }
+ slv2_values_free(gui);
+
+ return NULL;
+}
+
+#endif
} // namespace Client
} // namespace Ingen
diff --git a/src/libs/client/PluginModel.h b/src/libs/client/PluginModel.h
index 16ad8c48..b7de3101 100644
--- a/src/libs/client/PluginModel.h
+++ b/src/libs/client/PluginModel.h
@@ -106,6 +106,8 @@ public:
slv2_world_load_all(_slv2_world);
_slv2_plugins = slv2_world_get_all_plugins(_slv2_world);
}
+
+ void* gui();
#endif
private:
diff --git a/src/libs/engine/MidiControlNode.cpp b/src/libs/engine/MidiControlNode.cpp
index abe930c8..a90416e2 100644
--- a/src/libs/engine/MidiControlNode.cpp
+++ b/src/libs/engine/MidiControlNode.cpp
@@ -76,10 +76,10 @@ MidiControlNode::process(SampleCount nframes, FrameTime start, FrameTime end)
while (midi_in->get_event(&timestamp, &size, &buffer) < nframes) {
- const FrameTime time = start + (FrameTime)timestamp;
+ //const FrameTime time = start + (FrameTime)timestamp;
if (size >= 3 && (buffer[0] & 0xF0) == MIDI_CMD_CONTROL)
- control(buffer[1], buffer[2], time);
+ control(buffer[1], buffer[2], (SampleCount)timestamp);
}
NodeBase::post_process(nframes, start, end);
diff --git a/src/libs/engine/NodeFactory.cpp b/src/libs/engine/NodeFactory.cpp
index 04d349e3..28afb67a 100644
--- a/src/libs/engine/NodeFactory.cpp
+++ b/src/libs/engine/NodeFactory.cpp
@@ -32,6 +32,7 @@
#ifdef HAVE_SLV2
#include "LV2Node.h"
#include <slv2/slv2.h>
+#include <slv2/util.h> // old slv2 compat
#endif
#ifdef HAVE_LADSPA
#include "LADSPANode.h"
@@ -271,43 +272,42 @@ NodeFactory::load_lv2_plugins()
{
SLV2Plugins plugins = slv2_world_get_all_plugins(_world);
- //cerr << "[NodeFactory] Found " << slv2_plugins_get_length(plugins) << " LV2 plugins." << endl;
-
+ cerr << "[NodeFactory] Found " << slv2_plugins_size(plugins) << " LV2 plugins:" << endl;
+
for (unsigned i=0; i < slv2_plugins_size(plugins); ++i) {
-
+
SLV2Plugin lv2_plug = slv2_plugins_get_at(plugins, i);
-
-
- //om_plug->library(plugin_library);
-
+
const char* uri = (const char*)slv2_plugin_get_uri(lv2_plug);
- //cerr << "LV2 plugin: " << uri << endl;
+ assert(uri);
+ cerr << "\t" << uri << endl;
+
+ Plugin* plug = NULL;
bool found = false;
for (list<Plugin*>::const_iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
if (!strcmp((*i)->uri().c_str(), uri)) {
- cerr << "Warning: Duplicate LV2 plugin (" << uri << ").\nUsing "
- << (*i)->lib_path() << " version." << endl;
+ plug = (*i);
found = true;
break;
}
}
- if (!found) {
- //printf("[NodeFactory] Found LV2 plugin %s\n", uri);
- Plugin* om_plug = new Plugin(Plugin::LV2, uri);
- om_plug->slv2_plugin(lv2_plug);
- // FIXME FIXME FIXME temporary hack
- om_plug->module(NULL);
- om_plug->lib_path("FIXME/Some/path");
- om_plug->plug_label("FIXMElabel");
- char* name = slv2_plugin_get_name(lv2_plug);
- om_plug->name(name);
- free(name);
- om_plug->type(Plugin::LV2);
- _plugins.push_back(om_plug);
- }
+
+ if (!found)
+ plug = new Plugin(Plugin::LV2, uri);
+
+ plug->slv2_plugin(lv2_plug);
+ plug->module(NULL); // FIXME?
+ plug->lib_path(slv2_uri_to_path(slv2_plugin_get_library_uri(lv2_plug)));
+ char* name = slv2_plugin_get_name(lv2_plug);
+ assert(name);
+ plug->name(name);
+ free(name);
+
+ if (!found)
+ _plugins.push_back(plug);
}
-
+
slv2_plugins_free(_world, plugins);
}
diff --git a/src/libs/engine/OSCEngineReceiver.cpp b/src/libs/engine/OSCEngineReceiver.cpp
index 260721d4..8b0ef103 100644
--- a/src/libs/engine/OSCEngineReceiver.cpp
+++ b/src/libs/engine/OSCEngineReceiver.cpp
@@ -129,6 +129,7 @@ OSCEngineReceiver::OSCEngineReceiver(Engine& engine, size_t queue_size, uint16_t
OSCEngineReceiver::~OSCEngineReceiver()
{
deactivate();
+ stop();
if (_server != NULL) {
lo_server_free(_server);
@@ -163,6 +164,11 @@ OSCEngineReceiver::_run()
* they all get executed in the same cycle */
while (true) {
+ if ( ! _server) {
+ cout << "[OSCEngineReceiver] Server is NULL, exiting" << endl;
+ break;
+ }
+
assert( ! unprepared_events());
// Wait on a message and enqueue it
diff --git a/src/libs/engine/QueuedEngineInterface.cpp b/src/libs/engine/QueuedEngineInterface.cpp
index 8ee3851b..4641f108 100644
--- a/src/libs/engine/QueuedEngineInterface.cpp
+++ b/src/libs/engine/QueuedEngineInterface.cpp
@@ -92,7 +92,7 @@ QueuedEngineInterface::unregister_client(ClientKey key)
void
QueuedEngineInterface::load_plugins()
{
- push_queued(new LoadPluginsEvent(_engine, _responder, now()));
+ push_queued(new LoadPluginsEvent(_engine, _responder, now(), this));
}
diff --git a/src/libs/engine/QueuedEventSource.cpp b/src/libs/engine/QueuedEventSource.cpp
index 885e475f..19bd5880 100644
--- a/src/libs/engine/QueuedEventSource.cpp
+++ b/src/libs/engine/QueuedEventSource.cpp
@@ -164,7 +164,8 @@ QueuedEventSource::_whipped()
{
QueuedEvent* const ev = _events[_prepared_back];
- assert(ev);
+ if (!ev)
+ return;
assert(!ev->is_prepared());
ev->pre_process();
diff --git a/src/libs/engine/events/LoadPluginsEvent.cpp b/src/libs/engine/events/LoadPluginsEvent.cpp
index a126e3b2..b06d1817 100644
--- a/src/libs/engine/events/LoadPluginsEvent.cpp
+++ b/src/libs/engine/events/LoadPluginsEvent.cpp
@@ -20,6 +20,7 @@
#include "Engine.h"
#include "NodeFactory.h"
#include "ClientBroadcaster.h"
+#include "QueuedEventSource.h"
#include <iostream>
using std::cerr;
@@ -27,9 +28,10 @@ using std::cerr;
namespace Ingen {
-LoadPluginsEvent::LoadPluginsEvent(Engine& engine, SharedPtr<Shared::Responder> responder, SampleCount timestamp)
-: QueuedEvent(engine, responder, timestamp)
+LoadPluginsEvent::LoadPluginsEvent(Engine& engine, SharedPtr<Shared::Responder> responder, SampleCount timestamp, QueuedEventSource* source)
+: QueuedEvent(engine, responder, timestamp, true, source)
{
+ /* Not sure why this has to be blocking, but it fixes some nasty bugs.. */
}
void
@@ -37,18 +39,15 @@ LoadPluginsEvent::pre_process()
{
_engine.node_factory()->load_plugins();
- // FIXME: send the changes (added and removed plugins) instead of the entire list each time
-
- // Take a copy to send in the post processing thread (to avoid problems
- // because std::list isn't thread safe)
- _plugins = _engine.node_factory()->plugins();
-
QueuedEvent::pre_process();
}
void
LoadPluginsEvent::post_process()
{
+ if (_source)
+ _source->unblock();
+
_responder->respond_ok();
}
diff --git a/src/libs/engine/events/LoadPluginsEvent.h b/src/libs/engine/events/LoadPluginsEvent.h
index b6de5e5c..e56de796 100644
--- a/src/libs/engine/events/LoadPluginsEvent.h
+++ b/src/libs/engine/events/LoadPluginsEvent.h
@@ -33,13 +33,13 @@ class Plugin;
class LoadPluginsEvent : public QueuedEvent
{
public:
- LoadPluginsEvent(Engine& engine, SharedPtr<Shared::Responder> responder, SampleCount timestamp);
+ LoadPluginsEvent(Engine& engine,
+ SharedPtr<Shared::Responder> responder,
+ SampleCount timestamp,
+ QueuedEventSource* source);
void pre_process();
void post_process();
-
-private:
- std::list<Plugin*> _plugins;
};
diff --git a/src/libs/gui/NodeModule.cpp b/src/libs/gui/NodeModule.cpp
index 188e3a42..61c937a8 100644
--- a/src/libs/gui/NodeModule.cpp
+++ b/src/libs/gui/NodeModule.cpp
@@ -110,6 +110,14 @@ NodeModule::remove_port(SharedPtr<PortModel> port)
void
NodeModule::show_control_window()
{
+ if (_node->plugin()->type() == PluginModel::LV2) {
+ GtkWidget* gui = (GtkWidget*)_node->plugin()->gui();
+ if (gui) {
+ cerr << "GUI!\n";
+ } else {
+ cerr << "No gui :(\n";
+ }
+ }
App::instance().window_factory()->present_controls(_node);
}