diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/jalv.c | 25 |
1 files changed, 12 insertions, 13 deletions
@@ -263,25 +263,24 @@ jalv_create_ports(Jalv* jalv) void jalv_allocate_port_buffers(Jalv* jalv) { + const LV2_URID atom_Chunk = jalv->map.map( + jalv->map.handle, lilv_node_as_string(jalv->nodes.atom_Chunk)); + + const LV2_URID atom_Sequence = jalv->map.map( + jalv->map.handle, lilv_node_as_string(jalv->nodes.atom_Sequence)); + for (uint32_t i = 0; i < jalv->num_ports; ++i) { struct Port* const port = &jalv->ports[i]; - switch (port->type) { - case TYPE_EVENT: { + if (port->type == 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( - buf_size, - jalv->map.map(jalv->map.handle, - lilv_node_as_string(jalv->nodes.atom_Chunk)), - jalv->map.map(jalv->map.handle, - lilv_node_as_string(jalv->nodes.atom_Sequence))); + + const size_t size = port->buf_size ? port->buf_size : jalv->midi_buf_size; + + port->evbuf = lv2_evbuf_new(size, atom_Chunk, atom_Sequence); + lilv_instance_connect_port( jalv->instance, i, lv2_evbuf_get_buffer(port->evbuf)); } - default: - break; - } } } |