summaryrefslogtreecommitdiffstats
path: root/src/server
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-01-08 04:05:01 +0000
committerDavid Robillard <d@drobilla.net>2013-01-08 04:05:01 +0000
commitac408e8d4ce77389e65d69e9a1ff30fd54a25ada (patch)
tree27d3f568c8a8040c345dd61a890dabd08549cd5c /src/server
parent63d21b23d262b0c5169d54822aa5723b6200c764 (diff)
downloadingen-ac408e8d4ce77389e65d69e9a1ff30fd54a25ada.tar.gz
ingen-ac408e8d4ce77389e65d69e9a1ff30fd54a25ada.tar.bz2
ingen-ac408e8d4ce77389e65d69e9a1ff30fd54a25ada.zip
Add support for URID ports.
Fix glib errors when resetting properties dialog. Move RDFS domain/range/classes/etc code to reusable location. Add preliminary "mesp" (message processing) plugin package. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4903 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server')
-rw-r--r--src/server/Buffer.hpp2
-rw-r--r--src/server/BufferFactory.cpp6
-rw-r--r--src/server/BufferFactory.hpp3
-rw-r--r--src/server/LV2Block.cpp25
-rw-r--r--src/server/LV2Info.cpp2
-rw-r--r--src/server/LV2Info.hpp1
-rw-r--r--src/server/events/SetPortValue.cpp2
7 files changed, 37 insertions, 4 deletions
diff --git a/src/server/Buffer.hpp b/src/server/Buffer.hpp
index 0f237e67..c710f4df 100644
--- a/src/server/Buffer.hpp
+++ b/src/server/Buffer.hpp
@@ -54,6 +54,8 @@ public:
inline LV2_URID type() const { return _type; }
inline uint32_t capacity() const { return _capacity; }
+ inline void set_type(LV2_URID t) { _type = t; }
+
inline bool is_audio() const {
return _type == _factory.uris().atom_Sound;
}
diff --git a/src/server/BufferFactory.cpp b/src/server/BufferFactory.cpp
index da459705..064b5080 100644
--- a/src/server/BufferFactory.cpp
+++ b/src/server/BufferFactory.cpp
@@ -38,6 +38,7 @@ BufferFactory::~BufferFactory()
_silent_buffer.reset();
free_list(_free_audio.get());
free_list(_free_control.get());
+ free_list(_free_sequence.get());
free_list(_free_object.get());
}
@@ -77,6 +78,8 @@ BufferFactory::default_size(LV2_URID type) const
return sizeof(LV2_Atom_Float);
} else if (type == _uris.atom_Sound) {
return audio_buffer_size(_engine.driver()->block_length());
+ } else if (type == _uris.atom_URID) {
+ return sizeof(LV2_Atom_URID);
} else if (type == _uris.atom_Sequence) {
if (_seq_size == 0) {
return _engine.driver()->block_length() * SEQ_BYTES_PER_FRAME;
@@ -95,7 +98,7 @@ BufferFactory::get(LV2_URID type,
bool force_create)
{
Raul::AtomicPtr<Buffer>& head_ptr = free_list(type);
- Buffer* try_head = NULL;
+ Buffer* try_head = NULL;
if (!force_create) {
Buffer* next;
@@ -117,6 +120,7 @@ BufferFactory::get(LV2_URID type,
}
try_head->_next = NULL;
+ try_head->set_type(type);
return BufferRef(try_head);
}
diff --git a/src/server/BufferFactory.hpp b/src/server/BufferFactory.hpp
index e466e969..1fe3a91e 100644
--- a/src/server/BufferFactory.hpp
+++ b/src/server/BufferFactory.hpp
@@ -74,6 +74,8 @@ private:
return _free_control;
} else if (type == _uris.atom_Sound) {
return _free_audio;
+ } else if (type == _uris.atom_Sequence) {
+ return _free_sequence;
} else {
return _free_object;
}
@@ -83,6 +85,7 @@ private:
Raul::AtomicPtr<Buffer> _free_audio;
Raul::AtomicPtr<Buffer> _free_control;
+ Raul::AtomicPtr<Buffer> _free_sequence;
Raul::AtomicPtr<Buffer> _free_object;
Glib::Mutex _mutex;
diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp
index 47a0af4f..e334c1f9 100644
--- a/src/server/LV2Block.cpp
+++ b/src/server/LV2Block.cpp
@@ -282,6 +282,13 @@ LV2Block::instantiate(BufferFactory& bufs)
}
uint32_t port_buffer_size = bufs.default_size(buffer_type);
+ if (port_buffer_size == 0) {
+ parent_graph()->engine().log().error(
+ Raul::fmt("<%1%> port `%2%' has unknown buffer type\n")
+ % _lv2_plugin->uri().c_str() % port_sym.c_str());
+ ret = false;
+ break;
+ }
if (port_type == PortType::ATOM) {
// Get default value, and its length
@@ -293,10 +300,18 @@ LV2Block::instantiate(BufferFactory& bufs)
const uint32_t str_val_len = strlen(str_val);
val = forge.alloc(str_val);
port_buffer_size = std::max(port_buffer_size, str_val_len);
+ } else if (lilv_node_is_uri(d)) {
+ const char* uri_val = lilv_node_as_uri(d);
+ val = forge.make_urid(
+ bufs.engine().world()->uri_map().map_uri(uri_val));
}
}
lilv_nodes_free(defaults);
+ if (!val.type() && buffer_type == _uris.atom_URID) {
+ val = forge.make_urid(0);
+ }
+
// Get minimum size, if set in data
LilvNodes* sizes = lilv_port_get_value(plug, id, info->rsz_minimumSize);
LILV_FOREACH(nodes, i, sizes) {
@@ -318,14 +333,15 @@ LV2Block::instantiate(BufferFactory& bufs)
if (port_type == PortType::UNKNOWN || direction == UNKNOWN) {
parent_graph()->engine().log().error(
- Raul::fmt("<%1%> port %2% has unknown type or direction\n")
+ Raul::fmt("<%1%> port `%2%' has unknown type or direction\n")
% _lv2_plugin->uri().c_str() % port_sym.c_str());
ret = false;
break;
}
- if (!val.type())
+ if (!val.type() && port_type != PortType::ATOM) {
val = forge.make(isnan(def_values[j]) ? 0.0f : def_values[j]);
+ }
PortImpl* port = (direction == INPUT)
? static_cast<PortImpl*>(
@@ -350,7 +366,10 @@ LV2Block::instantiate(BufferFactory& bufs)
}
// Inherit certain properties from plugin port
- LilvNode* preds[] = { info->lv2_portProperty, info->atom_supports, 0 };
+ const LilvNode* preds[] = { info->lv2_designation,
+ info->lv2_portProperty,
+ info->atom_supports,
+ 0 };
for (int p = 0; preds[p]; ++p) {
LilvNodes* values = lilv_port_get_value(plug, id, preds[p]);
LILV_FOREACH(nodes, v, values) {
diff --git a/src/server/LV2Info.cpp b/src/server/LV2Info.cpp
index 744a30b2..841ee0fd 100644
--- a/src/server/LV2Info.cpp
+++ b/src/server/LV2Info.cpp
@@ -40,6 +40,7 @@ LV2Info::LV2Info(Ingen::World* world)
, lv2_InputPort(lilv_new_uri(world->lilv_world(), LV2_CORE__InputPort))
, lv2_OutputPort(lilv_new_uri(world->lilv_world(), LV2_CORE__OutputPort))
, lv2_default(lilv_new_uri(world->lilv_world(), LV2_CORE__default))
+ , lv2_designation(lilv_new_uri(world->lilv_world(), LV2_CORE__designation))
, lv2_portProperty(lilv_new_uri(world->lilv_world(), LV2_CORE__portProperty))
, lv2_sampleRate(lilv_new_uri(world->lilv_world(), LV2_CORE__sampleRate))
, morph_AutoMorphPort(lilv_new_uri(world->lilv_world(), LV2_MORPH__AutoMorphPort))
@@ -64,6 +65,7 @@ LV2Info::~LV2Info()
lilv_node_free(lv2_InputPort);
lilv_node_free(lv2_OutputPort);
lilv_node_free(lv2_default);
+ lilv_node_free(lv2_designation);
lilv_node_free(lv2_portProperty);
lilv_node_free(lv2_sampleRate);
lilv_node_free(morph_AutoMorphPort);
diff --git a/src/server/LV2Info.hpp b/src/server/LV2Info.hpp
index fd70ea83..1d38b4e1 100644
--- a/src/server/LV2Info.hpp
+++ b/src/server/LV2Info.hpp
@@ -40,6 +40,7 @@ public:
LilvNode* const lv2_InputPort;
LilvNode* const lv2_OutputPort;
LilvNode* const lv2_default;
+ LilvNode* const lv2_designation;
LilvNode* const lv2_portProperty;
LilvNode* const lv2_sampleRate;
LilvNode* const morph_AutoMorphPort;
diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp
index 14919cee..b3481861 100644
--- a/src/server/events/SetPortValue.cpp
+++ b/src/server/events/SetPortValue.cpp
@@ -104,6 +104,8 @@ SetPortValue::apply(Context& context)
} else {
_status = NO_SPACE;
}
+ } else if (buf->type() == uris.atom_URID) {
+ ((LV2_Atom_URID*)buf->atom())->body = _value.get_int32();
} else {
_status = BAD_VALUE_TYPE;
}