aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rw-r--r--src/jalv.c16
-rw-r--r--src/jalv_internal.h3
3 files changed, 19 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index adbd21b..3a6d67f 100644
--- a/NEWS
+++ b/NEWS
@@ -2,11 +2,12 @@ jalv (1.4.1) unstable;
* Fix crash when running "jalv" with bad command line arguments
* Add command-line option to control UI update frequency
+ * Support rsz:minimumSize for atom and event ports
* Fix default setting for non-sequential enumeration ports
(patch from Robin Gareus)
* Work around Gtk bug for labels on sliders (patch from Robin Gareus)
- -- David Robillard <d@drobilla.net> Sun, 26 May 2013 15:36:05 -0400
+ -- David Robillard <d@drobilla.net> Sun, 26 May 2013 21:25:21 -0400
jalv (1.4.0) stable;
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