aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-05-27 01:27:21 +0000
committerDavid Robillard <d@drobilla.net>2013-05-27 01:27:21 +0000
commit6ec945342aac10c99b88a25b732b3bb989ebca9d (patch)
tree0034c0f150def5e21b4353f5788a617d5428b368 /src
parent181d5f98ca3e6fe9730ae799328edda66b0cbfb0 (diff)
downloadjalv-6ec945342aac10c99b88a25b732b3bb989ebca9d.tar.gz
jalv-6ec945342aac10c99b88a25b732b3bb989ebca9d.tar.bz2
jalv-6ec945342aac10c99b88a25b732b3bb989ebca9d.zip
Support rsz:minimumSize for atom and event ports.
git-svn-id: http://svn.drobilla.net/lad/trunk/jalv@5114 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/jalv.c16
-rw-r--r--src/jalv_internal.h3
2 files changed, 17 insertions, 2 deletions
diff --git a/src/jalv.c b/src/jalv.c
index 6f8d07c..7e8097a 100644
--- a/src/jalv.c
+++ b/src/jalv.c
@@ -179,7 +179,7 @@ die(const char* msg)
/**
Create a port structure from data description. This is called before plugin
and Jack instantiation. The remaining instance-specific setup
- (e.g. buffers) is done later in expose_port().
+ (e.g. buffers) is done later in activate_port().
*/
static void
create_port(Jalv* jalv,
@@ -191,6 +191,7 @@ create_port(Jalv* jalv,
port->lilv_port = lilv_plugin_get_port_by_index(jalv->plugin, port_index);
port->jack_port = NULL;
port->evbuf = NULL;
+ port->buf_size = 0;
port->index = port_index;
port->control = 0.0f;
port->flow = FLOW_UNKNOWN;
@@ -231,6 +232,13 @@ create_port(Jalv* jalv,
die("Mandatory port has unknown data type");
}
+ LilvNode* min_size = lilv_port_get(
+ jalv->plugin, port->lilv_port, jalv->nodes.rsz_minimumSize);
+ if (min_size && lilv_node_is_int(min_size)) {
+ port->buf_size = lilv_node_as_int(min_size);
+ }
+ lilv_node_free(min_size);
+
const size_t sym_len = strlen(lilv_node_as_string(symbol));
if (sym_len > jalv->longest_sym) {
jalv->longest_sym = sym_len;
@@ -273,8 +281,11 @@ jalv_allocate_port_buffers(Jalv* jalv)
switch (port->type) {
case TYPE_EVENT:
lv2_evbuf_free(port->evbuf);
+ const size_t buf_size = (port->buf_size > 0)
+ ? port->buf_size
+ : jalv->midi_buf_size;
port->evbuf = lv2_evbuf_new(
- jalv->midi_buf_size,
+ buf_size,
port->old_api ? LV2_EVBUF_EVENT : LV2_EVBUF_ATOM,
jalv->map.map(jalv->map.handle,
lilv_node_as_string(jalv->nodes.atom_Chunk)),
@@ -884,6 +895,7 @@ main(int argc, char** argv)
jalv.nodes.pg_group = lilv_new_uri(world, LV2_PORT_GROUPS__group);
jalv.nodes.pset_Preset = lilv_new_uri(world, LV2_PRESETS__Preset);
jalv.nodes.rdfs_label = lilv_new_uri(world, LILV_NS_RDFS "label");
+ jalv.nodes.rsz_minimumSize = lilv_new_uri(world, LV2_RESIZE_PORT__minimumSize);
jalv.nodes.work_interface = lilv_new_uri(world, LV2_WORKER__interface);
jalv.nodes.work_schedule = lilv_new_uri(world, LV2_WORKER__schedule);
jalv.nodes.end = NULL;
diff --git a/src/jalv_internal.h b/src/jalv_internal.h
index 1eb6899..619be63 100644
--- a/src/jalv_internal.h
+++ b/src/jalv_internal.h
@@ -31,6 +31,7 @@
#include "lv2/lv2plug.in/ns/ext/atom/forge.h"
#include "lv2/lv2plug.in/ns/ext/log/log.h"
#include "lv2/lv2plug.in/ns/ext/midi/midi.h"
+#include "lv2/lv2plug.in/ns/ext/resize-port/resize-port.h"
#include "lv2/lv2plug.in/ns/ext/state/state.h"
#include "lv2/lv2plug.in/ns/ext/urid/urid.h"
#include "lv2/lv2plug.in/ns/ext/worker/worker.h"
@@ -67,6 +68,7 @@ struct Port {
jack_port_t* jack_port; ///< For audio/MIDI ports, otherwise NULL
LV2_Evbuf* evbuf; ///< For MIDI ports, otherwise NULL
void* widget; ///< Control widget, if applicable
+ size_t buf_size; ///< Custom buffer size, or 0
uint32_t index; ///< Port index
float control; ///< For control ports, otherwise 0.0f
bool old_api; ///< True for event, false for atom
@@ -131,6 +133,7 @@ typedef struct {
LilvNode* pg_group;
LilvNode* pset_Preset;
LilvNode* rdfs_label;
+ LilvNode* rsz_minimumSize;
LilvNode* work_interface;
LilvNode* work_schedule;
LilvNode* end; ///< NULL terminator for easy freeing of entire structure