summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-07-23 06:08:11 +0000
committerDavid Robillard <d@drobilla.net>2007-07-23 06:08:11 +0000
commitf2ff7dd066743dbe80de630a96f61fdab5bedef0 (patch)
treec6e98605b8ae32e076039695f7cf09d08e897e32
parente2cfcb6288b000abccb15831e9dde8b8283eb36e (diff)
downloadingen-f2ff7dd066743dbe80de630a96f61fdab5bedef0.tar.gz
ingen-f2ff7dd066743dbe80de630a96f61fdab5bedef0.tar.bz2
ingen-f2ff7dd066743dbe80de630a96f61fdab5bedef0.zip
Fixed OSC printer bugs, instantiates correctly now.
Made input port on OSC printer connectionOptional. Stub LV2 OSC support in Ingen (plugins loadable, ports show up, no data flow yet). git-svn-id: http://svn.drobilla.net/lad/ingen@601 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/libs/engine/Engine.cpp7
-rw-r--r--src/libs/engine/Engine.h3
-rw-r--r--src/libs/engine/LV2Node.cpp49
-rw-r--r--src/libs/engine/events/AddPortEvent.cpp18
4 files changed, 54 insertions, 23 deletions
diff --git a/src/libs/engine/Engine.cpp b/src/libs/engine/Engine.cpp
index f76790ff..e80bcafe 100644
--- a/src/libs/engine/Engine.cpp
+++ b/src/libs/engine/Engine.cpp
@@ -31,6 +31,7 @@
#include "Patch.h"
#include "ObjectStore.h"
#include "MidiDriver.h"
+#include "OSCDriver.h"
#include "QueuedEventSource.h"
#include "PostProcessor.h"
#include "CreatePatchEvent.h"
@@ -49,6 +50,7 @@ namespace Ingen {
Engine::Engine()
: _midi_driver(NULL),
+ _osc_driver(NULL),
_maid(new Raul::Maid(maid_queue_size)),
_post_processor(new PostProcessor(*_maid, post_processor_queue_size)),
_broadcaster(new ClientBroadcaster()),
@@ -79,6 +81,7 @@ Engine::~Engine()
delete _broadcaster;
delete _node_factory;
delete _midi_driver;
+ delete _osc_driver;
delete _maid;
@@ -93,6 +96,8 @@ Engine::driver(DataType type)
return _audio_driver.get();
else if (type == DataType::MIDI)
return _midi_driver;
+ else if (type == DataType::OSC)
+ return _osc_driver;
else
return NULL;
}
@@ -154,6 +159,8 @@ Engine::start_osc_driver(int port)
_event_source = SharedPtr<EventSource>(new OSCEngineReceiver(
*this, pre_processor_queue_size, port));
+
+ //_osc_driver = _event_source;
}
diff --git a/src/libs/engine/Engine.h b/src/libs/engine/Engine.h
index bdb6cdfb..6fe61582 100644
--- a/src/libs/engine/Engine.h
+++ b/src/libs/engine/Engine.h
@@ -31,6 +31,7 @@ namespace Ingen {
class AudioDriver;
class MidiDriver;
+class OSCDriver;
class NodeFactory;
class ClientBroadcaster;
class Patch;
@@ -80,6 +81,7 @@ public:
EventSource* event_source() const { return _event_source.get(); }
AudioDriver* audio_driver() const { return _audio_driver.get(); }
MidiDriver* midi_driver() const { return _midi_driver; }
+ OSCDriver* osc_driver() const { return _osc_driver; }
PostProcessor* post_processor() const { return _post_processor; }
ClientBroadcaster* broadcaster() const { return _broadcaster; }
ObjectStore* object_store() const { return _object_store; }
@@ -93,6 +95,7 @@ private:
SharedPtr<EventSource> _event_source;
SharedPtr<AudioDriver> _audio_driver;
MidiDriver* _midi_driver;
+ OSCDriver* _osc_driver;
Raul::Maid* _maid;
PostProcessor* _post_processor;
ClientBroadcaster* _broadcaster;
diff --git a/src/libs/engine/LV2Node.cpp b/src/libs/engine/LV2Node.cpp
index 4aef8d69..7310e86b 100644
--- a/src/libs/engine/LV2Node.cpp
+++ b/src/libs/engine/LV2Node.cpp
@@ -91,27 +91,44 @@ LV2Node::instantiate()
port_path = path() + "/" + port_name;
- SLV2PortClass port_class = slv2_port_get_class(_lv2_plugin, id);
+ SLV2PortDirection port_direction = slv2_port_get_direction(_lv2_plugin, id);
+ SLV2PortType port_type = slv2_port_get_type(_lv2_plugin, id);
- // FIXME: MIDI buffer size?
- if (port_class == SLV2_AUDIO_INPUT || port_class == SLV2_AUDIO_OUTPUT
- || port_class == SLV2_MIDI_INPUT || port_class == SLV2_MIDI_OUTPUT)
+ // FIXME: MIDI/OSC buffer size?
+ if (port_type != SLV2_PORT_TYPE_CONTROL)
port_buffer_size = _buffer_size;
else
port_buffer_size = 1;
- if (port_class == SLV2_CONTROL_INPUT || port_class == SLV2_AUDIO_INPUT)
- port = new InputPort(this, port_name, j, _poly, DataType::FLOAT, port_buffer_size);
- else if (port_class == SLV2_CONTROL_OUTPUT || port_class == SLV2_AUDIO_OUTPUT)
- port = new OutputPort(this, port_name, j, _poly, DataType::FLOAT, port_buffer_size);
- else if (port_class == SLV2_MIDI_INPUT)
- port = new InputPort(this, port_name, j, _poly, DataType::MIDI, port_buffer_size);
- else if (port_class == SLV2_MIDI_OUTPUT)
- port = new OutputPort(this, port_name, j, _poly, DataType::MIDI, port_buffer_size);
-
- assert(port);
-
- if (port_class == SLV2_CONTROL_INPUT)
+ DataType data_type = DataType::UNKNOWN;
+ switch (port_type) {
+ case SLV2_PORT_TYPE_CONTROL:
+ case SLV2_PORT_TYPE_AUDIO:
+ data_type = DataType::FLOAT; break;
+ case SLV2_PORT_TYPE_MIDI:
+ data_type = DataType::MIDI; break;
+ case SLV2_PORT_TYPE_OSC:
+ data_type = DataType::OSC;
+ default:
+ break;
+ }
+
+ if (data_type == DataType::UNKNOWN || port_direction == SLV2_PORT_DIRECTION_UNKNOWN) {
+ delete _ports;
+ _ports = NULL;
+ delete _instances;
+ _instances = NULL;
+ return false;
+ }
+
+ bool is_input = (port_direction == SLV2_PORT_DIRECTION_INPUT);
+
+ if (is_input)
+ port = new InputPort(this, port_name, j, _poly, data_type, port_buffer_size);
+ else
+ port = new OutputPort(this, port_name, j, _poly, data_type, port_buffer_size);
+
+ if (is_input && port_type == SLV2_PORT_TYPE_CONTROL)
((AudioBuffer*)port->buffer(0))->set(slv2_port_get_default_value(_lv2_plugin, id), 0);
_ports->at(j) = port;
diff --git a/src/libs/engine/events/AddPortEvent.cpp b/src/libs/engine/events/AddPortEvent.cpp
index 82cd4ded..c2ec9326 100644
--- a/src/libs/engine/events/AddPortEvent.cpp
+++ b/src/libs/engine/events/AddPortEvent.cpp
@@ -15,26 +15,25 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "AddPortEvent.h"
+#include <raul/Path.h>
+#include <raul/Array.h>
+#include <raul/List.h>
+#include <raul/Maid.h>
#include "interface/Responder.h"
+#include "AddPortEvent.h"
#include "Patch.h"
#include "Tree.h"
#include "Plugin.h"
#include "Engine.h"
#include "Patch.h"
-#include <raul/Maid.h>
-#include <raul/Path.h>
#include "QueuedEventSource.h"
#include "ObjectStore.h"
#include "ClientBroadcaster.h"
-#include <raul/Path.h>
#include "Port.h"
#include "AudioDriver.h"
#include "MidiDriver.h"
-#include <raul/List.h>
-#include "Driver.h"
+#include "OSCDriver.h"
#include "DuplexPort.h"
-#include <raul/Array.h>
namespace Ingen {
@@ -121,6 +120,11 @@ AddPortEvent::pre_process()
dynamic_cast<DuplexPort*>(_patch_port));
}
+ if (_type == "ingen:osc" && _engine.osc_driver()) {
+ _driver_port = _engine.osc_driver()->create_port(
+ dynamic_cast<DuplexPort*>(_patch_port));
+ }
+
assert(_ports_array->size() == _patch->num_ports());
}