summaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-10-17 01:11:29 +0000
committerDavid Robillard <d@drobilla.net>2010-10-17 01:11:29 +0000
commit5a1ccca68baf9e8efffe3e0297730a911617693d (patch)
tree675764eb06e152f09b1d97c317d445a8050f253a /src/engine
parent78f786d90943cd63eb5db761e910169990c66d93 (diff)
downloadingen-5a1ccca68baf9e8efffe3e0297730a911617693d.tar.gz
ingen-5a1ccca68baf9e8efffe3e0297730a911617693d.tar.bz2
ingen-5a1ccca68baf9e8efffe3e0297730a911617693d.zip
Support current versions of LV2 atom, atom-port, and context extensions.
Working use case in this revision: lolep.parse => lolep.print (set parse input to some string, it will be parsed, send to print as an LV2 atom, then printed to the console by print). git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2631 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/AudioBuffer.cpp4
-rw-r--r--src/engine/AudioBuffer.hpp6
-rw-r--r--src/engine/BufferFactory.cpp4
-rw-r--r--src/engine/ConnectionImpl.cpp22
-rw-r--r--src/engine/InputPort.cpp6
-rw-r--r--src/engine/LV2BlobFeature.hpp34
-rw-r--r--src/engine/LV2Info.cpp6
-rw-r--r--src/engine/LV2Node.cpp14
-rw-r--r--src/engine/ObjectBuffer.cpp4
-rw-r--r--src/engine/PortImpl.cpp2
10 files changed, 59 insertions, 43 deletions
diff --git a/src/engine/AudioBuffer.cpp b/src/engine/AudioBuffer.cpp
index 56ae2b57..33394254 100644
--- a/src/engine/AudioBuffer.cpp
+++ b/src/engine/AudioBuffer.cpp
@@ -55,7 +55,7 @@ AudioBuffer::AudioBuffer(BufferFactory& bufs, Shared::PortType type, size_t size
} else {
assert(type == PortType::AUDIO);
atom()->type = 0;//map->vector_type;
- LV2_Vector_Body* body = (LV2_Vector_Body*)atom()->body;
+ LV2_Atom_Vector* body = (LV2_Atom_Vector*)atom()->body;
body->elem_count = size / sizeof(Sample);
body->elem_type = 0;//map->float_type;
}
@@ -75,7 +75,7 @@ void
AudioBuffer::resize(size_t size)
{
if (_type == PortType::AUDIO) {
- ObjectBuffer::resize(size + sizeof(LV2_Vector_Body));
+ ObjectBuffer::resize(size + sizeof(LV2_Atom_Vector));
vector()->elem_count = size / sizeof(Sample);
}
clear();
diff --git a/src/engine/AudioBuffer.hpp b/src/engine/AudioBuffer.hpp
index 7c6115e2..38623696 100644
--- a/src/engine/AudioBuffer.hpp
+++ b/src/engine/AudioBuffer.hpp
@@ -48,13 +48,13 @@ public:
inline Sample* data() const {
return (is_control())
? (Sample*)atom()->body
- : (Sample*)(atom()->body + sizeof(LV2_Vector_Body));
+ : (Sample*)(atom()->body + sizeof(LV2_Atom_Vector));
}
inline SampleCount nframes() const {
return (is_control())
? 1
- : (_size - sizeof(LV2_Atom) - sizeof(LV2_Vector_Body)) / sizeof(Sample);
+ : (_size - sizeof(LV2_Atom) - sizeof(LV2_Atom_Vector)) / sizeof(Sample);
}
inline Sample& value_at(size_t offset) const
@@ -68,7 +68,7 @@ public:
private:
enum State { OK, HALF_SET_CYCLE_1, HALF_SET_CYCLE_2 };
- LV2_Vector_Body* vector() { return(LV2_Vector_Body*)atom()->body; }
+ LV2_Atom_Vector* vector() { return(LV2_Atom_Vector*)atom()->body; }
State _state; ///< State of buffer for setting values next cycle
Sample _set_value; ///< Value set by set_value (for completing the set next cycle)
diff --git a/src/engine/BufferFactory.cpp b/src/engine/BufferFactory.cpp
index b048be28..75803649 100644
--- a/src/engine/BufferFactory.cpp
+++ b/src/engine/BufferFactory.cpp
@@ -70,7 +70,7 @@ BufferFactory::set_block_length(SampleCount block_length)
size_t
BufferFactory::audio_buffer_size(SampleCount nframes)
{
- return sizeof(LV2_Atom) + sizeof(LV2_Vector_Body) + (nframes * sizeof(float));
+ return sizeof(LV2_Atom) + sizeof(LV2_Atom_Vector) + (nframes * sizeof(float));
}
@@ -134,7 +134,7 @@ BufferFactory::create(Shared::PortType type, size_t size)
if (type.is_control()) {
AudioBuffer* ret = new AudioBuffer(*this, type, size);
ret->atom()->type = _uris->object_class_vector.id;
- ((LV2_Vector_Body*)ret->atom()->body)->elem_type = _uris->object_class_float32.id;
+ ((LV2_Atom_Vector*)ret->atom()->body)->elem_type = _uris->object_class_float32.id;
buffer = ret;
} else if (type.is_audio()) {
AudioBuffer* ret = new AudioBuffer(*this, type, size);
diff --git a/src/engine/ConnectionImpl.cpp b/src/engine/ConnectionImpl.cpp
index c308cea5..43f9136a 100644
--- a/src/engine/ConnectionImpl.cpp
+++ b/src/engine/ConnectionImpl.cpp
@@ -129,16 +129,28 @@ ConnectionImpl::can_connect(const OutputPort* src, const InputPort* dst)
{
const LV2URIMap& uris = src->bufs().uris();
return (
+ // (Audio | Control) => (Audio | Control)
( (src->is_a(PortType::CONTROL) || src->is_a(PortType::AUDIO))
&& (dst->is_a(PortType::CONTROL) || dst->is_a(PortType::AUDIO)))
- || ( src->is_a(PortType::EVENTS) && src->context() == Context::AUDIO
- && dst->is_a(PortType::MESSAGE) && dst->context() == Context::MESSAGE)
- || ( src->is_a(PortType::MESSAGE) && src->context() == Context::MESSAGE
- && dst->is_a(PortType::EVENTS) && dst->context() == Context::AUDIO)
- || (src->is_a(PortType::EVENTS) && dst->is_a(PortType::EVENTS))
+
+ // (Events | Message) => (Events | Message)
+ || ( (src->is_a(PortType::EVENTS) || src->is_a(PortType::MESSAGE))
+ && (dst->is_a(PortType::EVENTS) || dst->is_a(PortType::MESSAGE)))
+
+ // (Message | Value) => (Message | Value)
+ || ( (src->is_a(PortType::MESSAGE) || src->is_a(PortType::VALUE))
+ && (dst->is_a(PortType::MESSAGE) || dst->is_a(PortType::VALUE)))
+
+ // Control => atom:Float32 Value
|| (src->is_a(PortType::CONTROL) && dst->supports(uris.object_class_float32))
+
+ // Audio => atom:Vector Value
|| (src->is_a(PortType::AUDIO) && dst->supports(uris.object_class_vector))
+
+ // atom:Float32 Value => Control
|| (src->supports(uris.object_class_float32) && dst->is_a(PortType::CONTROL))
+
+ // atom:Vector Value => Audio
|| (src->supports(uris.object_class_vector) && dst->is_a(PortType::AUDIO)));
}
diff --git a/src/engine/InputPort.cpp b/src/engine/InputPort.cpp
index 95ff2d37..0cd6e87a 100644
--- a/src/engine/InputPort.cpp
+++ b/src/engine/InputPort.cpp
@@ -217,8 +217,10 @@ InputPort::post_process(Context& context)
bool
InputPort::direct_connect() const
{
- return _connections.size() == 1 && !_connections.front()->must_mix()
- && !_connections.front()->must_queue();
+ return (context() == Context::AUDIO)
+ && _connections.size() == 1
+ && !_connections.front()->must_mix()
+ && !_connections.front()->must_queue();
}
diff --git a/src/engine/LV2BlobFeature.hpp b/src/engine/LV2BlobFeature.hpp
index 78ed1ac0..b071a067 100644
--- a/src/engine/LV2BlobFeature.hpp
+++ b/src/engine/LV2BlobFeature.hpp
@@ -25,31 +25,31 @@ namespace Ingen {
struct BlobFeature : public Shared::LV2Features::Feature {
BlobFeature() {
LV2_Blob_Support* data = (LV2_Blob_Support*)malloc(sizeof(LV2_Blob_Support));
- data->data = NULL;
- data->reference_size = sizeof(LV2_Blob*);
- data->lv2_blob_new = &blob_new;
- data->lv2_reference_get = &reference_get;
- data->lv2_reference_copy = &reference_copy;
- data->lv2_reference_reset = &reference_reset;
- _feature.URI = LV2_BLOB_SUPPORT_URI;
- _feature.data = data;
+ data->data = NULL;
+ data->ref_size = sizeof(LV2_Blob*);
+ data->blob_new = &blob_new;
+ data->ref_get = &ref_get;
+ data->ref_copy = &ref_copy;
+ data->ref_reset = &ref_reset;
+ _feature.URI = LV2_BLOB_SUPPORT_URI;
+ _feature.data = data;
}
static void blob_new(LV2_Blob_Support_Data data,
- LV2_Reference* reference,
- LV2_Blob_Destroy destroy_func,
+ LV2_Atom* reference,
+ LV2_Blob_Destroy destroy,
uint32_t type,
size_t size) {}
- static LV2_Blob* reference_get(LV2_Blob_Support_Data data,
- LV2_Reference* ref) { return 0; }
+ static LV2_Blob* ref_get(LV2_Blob_Support_Data data,
+ LV2_Atom* ref) { return 0; }
- static void reference_copy(LV2_Blob_Support_Data data,
- LV2_Reference* dst,
- LV2_Reference* src) {}
+ static void ref_copy(LV2_Blob_Support_Data data,
+ LV2_Atom* dst,
+ LV2_Atom* src) {}
- static void reference_reset(LV2_Blob_Support_Data data,
- LV2_Reference* ref) {}
+ static void ref_reset(LV2_Blob_Support_Data data,
+ LV2_Atom* ref) {}
SharedPtr<LV2_Feature> feature(Shared::Node*) {
return SharedPtr<LV2_Feature>(&_feature, NullDeleter<LV2_Feature>);
diff --git a/src/engine/LV2Info.cpp b/src/engine/LV2Info.cpp
index 0c226c65..c96d5874 100644
--- a/src/engine/LV2Info.cpp
+++ b/src/engine/LV2Info.cpp
@@ -36,8 +36,10 @@ LV2Info::LV2Info(Ingen::Shared::World* world)
, control_class(slv2_value_new_uri(world->slv2_world(), SLV2_PORT_CLASS_CONTROL))
, audio_class(slv2_value_new_uri(world->slv2_world(), SLV2_PORT_CLASS_AUDIO))
, event_class(slv2_value_new_uri(world->slv2_world(), SLV2_PORT_CLASS_EVENT))
- , value_port_class(slv2_value_new_uri(world->slv2_world(), LV2_ATOM_URI "#ValuePort"))
- , message_port_class(slv2_value_new_uri(world->slv2_world(), LV2_ATOM_URI "#MessagePort"))
+ , value_port_class(slv2_value_new_uri(world->slv2_world(),
+ "http://lv2plug.in/ns/ext/atom-port#ValuePort"))
+ , message_port_class(slv2_value_new_uri(world->slv2_world(),
+ "http://lv2plug.in/ns/ext/atom-port#MessagePort"))
, _world(world)
{
assert(world);
diff --git a/src/engine/LV2Node.cpp b/src/engine/LV2Node.cpp
index 872a7b83..e2b4b2cd 100644
--- a/src/engine/LV2Node.cpp
+++ b/src/engine/LV2Node.cpp
@@ -160,7 +160,8 @@ LV2Node::instantiate(BufferFactory& bufs)
slv2_instance_free);
if (!instance(i)) {
- error << "Failed to instantiate plugin" << endl;
+ error << "Failed to instantiate plugin " << _lv2_plugin->uri()
+ << " voice " << i << endl;
return false;
}
@@ -203,7 +204,7 @@ LV2Node::instantiate(BufferFactory& bufs)
"http://lv2plug.in/ns/lv2core#portProperty");
SLV2Value supports_pred = slv2_value_new_uri(info->lv2_world(),
- LV2_ATOM_URI "#supports");
+ "http://lv2plug.in/ns/ext/atom-port#supports");
//SLV2Value as_large_as_pred = slv2_value_new_uri(info->lv2_world(),
// "http://lv2plug.in/ns/ext/resize-port#asLargeAs");
@@ -273,6 +274,7 @@ LV2Node::instantiate(BufferFactory& bufs)
}
if (data_type == PortType::UNKNOWN || direction == UNKNOWN) {
+ warn << "Unknown type or direction for port `" << port_name << "'" << endl;
ret = false;
break;
}
@@ -306,14 +308,12 @@ LV2Node::instantiate(BufferFactory& bufs)
}
}
- // Set obj:supports properties
+ // Set aport:supports properties
SLV2Values types = slv2_port_get_value(plug, id, supports_pred);
for (uint32_t i = 0; i < slv2_values_size(types); ++i) {
SLV2Value type = slv2_values_get_at(types, i);
- Raul::info << path() << " port " << id << " supports " <<
- slv2_value_as_uri(type) << std::endl;
if (slv2_value_is_uri(type)) {
- port->add_property(uris.obj_supports, Raul::URI(slv2_value_as_uri(type)));
+ port->add_property(uris.aport_supports, Raul::URI(slv2_value_as_uri(type)));
}
}
@@ -390,7 +390,7 @@ LV2Node::message_run(MessageContext& context)
_valid_ports = calloc(num_ports() / 8, 1);
if (_message_funcs)
- (*_message_funcs->message_run)(instance(0)->lv2_handle, _valid_ports, _valid_ports);
+ (*_message_funcs->run)(instance(0)->lv2_handle, _valid_ports, _valid_ports);
}
diff --git a/src/engine/ObjectBuffer.cpp b/src/engine/ObjectBuffer.cpp
index aabe2be3..9ae153f5 100644
--- a/src/engine/ObjectBuffer.cpp
+++ b/src/engine/ObjectBuffer.cpp
@@ -111,7 +111,7 @@ ObjectBuffer::port_data(PortType port_type, SampleCount offset)
case PortType::CONTROL:
return (float*)atom()->body;
case PortType::AUDIO:
- return (float*)((LV2_Vector_Body*)atom()->body)->elems + offset;
+ return (float*)((LV2_Atom_Vector*)atom()->body)->elems + offset;
default:
warn << "Audio data requested from non-audio buffer" << endl;
return NULL;
@@ -133,7 +133,7 @@ ObjectBuffer::port_data(PortType port_type, SampleCount offset) const
case PortType::CONTROL:
return (float*)atom()->body;
case PortType::AUDIO:
- return (float*)((LV2_Vector_Body*)atom()->body)->elems + offset;
+ return (float*)((LV2_Atom_Vector*)atom()->body)->elems + offset;
default:
warn << "Audio data requested from non-audio buffer" << endl;
return NULL;
diff --git a/src/engine/PortImpl.cpp b/src/engine/PortImpl.cpp
index 32105dfe..60d2ea26 100644
--- a/src/engine/PortImpl.cpp
+++ b/src/engine/PortImpl.cpp
@@ -88,7 +88,7 @@ PortImpl::~PortImpl()
bool
PortImpl::supports(const Raul::URI& value_type) const
{
- return has_property(_bufs.uris().obj_supports, value_type);
+ return has_property(_bufs.uris().aport_supports, value_type);
}