LV2: amend previous commit, respect replicated plugin instances
When a plugin is replicated (eg. mono plugin on a stereo-track), configure_io() is only called for the first instance. The 2nd instance will not have dedicated buffers but re-use copies of the first instance. Should the 2nd instance use a LV2 worker-thread or local communication ports they can not be shared with the first instance. -> this patch allocates Atom-buffers for each instance. PS. this still needs more work; there is only one UI instance for all plugin instances. messages from the UI should go to all instances. git-svn-id: svn://localhost/ardour2/branches/3.0@13148 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
198efb82bc
commit
322f1c7d0d
@ -89,7 +89,6 @@ class LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee
|
|||||||
void cleanup ();
|
void cleanup ();
|
||||||
|
|
||||||
int set_block_size (pframes_t /*nframes*/) { return 0; }
|
int set_block_size (pframes_t /*nframes*/) { return 0; }
|
||||||
bool configure_io (ChanCount in, ChanCount out);
|
|
||||||
|
|
||||||
int connect_and_run (BufferSet& bufs,
|
int connect_and_run (BufferSet& bufs,
|
||||||
ChanMapping in, ChanMapping out,
|
ChanMapping in, ChanMapping out,
|
||||||
@ -242,6 +241,7 @@ class LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee
|
|||||||
const char* path);
|
const char* path);
|
||||||
|
|
||||||
void init (const void* c_plugin, framecnt_t rate);
|
void init (const void* c_plugin, framecnt_t rate);
|
||||||
|
void allocate_atom_event_buffers ();
|
||||||
void run (pframes_t nsamples);
|
void run (pframes_t nsamples);
|
||||||
|
|
||||||
void latency_compute_run ();
|
void latency_compute_run ();
|
||||||
|
@ -541,6 +541,7 @@ LV2Plugin::init(const void* c_plugin, framecnt_t rate)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
allocate_atom_event_buffers();
|
||||||
latency_compute_run();
|
latency_compute_run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1393,8 +1394,8 @@ LV2Plugin::cleanup()
|
|||||||
_impl->instance = NULL;
|
_impl->instance = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
void
|
||||||
LV2Plugin::configure_io (ChanCount in, ChanCount out) {
|
LV2Plugin::allocate_atom_event_buffers () {
|
||||||
/* reserve local scratch buffers for ATOM event-queues */
|
/* reserve local scratch buffers for ATOM event-queues */
|
||||||
const LilvPlugin* p = _impl->plugin;
|
const LilvPlugin* p = _impl->plugin;
|
||||||
|
|
||||||
@ -1430,7 +1431,7 @@ LV2Plugin::configure_io (ChanCount in, ChanCount out) {
|
|||||||
|
|
||||||
const int total_atom_buffers = (count_atom_in + count_atom_out);
|
const int total_atom_buffers = (count_atom_in + count_atom_out);
|
||||||
if (_atom_ev_buffers || total_atom_buffers == 0) {
|
if (_atom_ev_buffers || total_atom_buffers == 0) {
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_TRACE(DEBUG::LV2, string_compose("allocate %1 atom_ev_buffers\n", total_atom_buffers));
|
DEBUG_TRACE(DEBUG::LV2, string_compose("allocate %1 atom_ev_buffers\n", total_atom_buffers));
|
||||||
@ -1440,7 +1441,7 @@ LV2Plugin::configure_io (ChanCount in, ChanCount out) {
|
|||||||
LV2Plugin::_chunk_type, LV2Plugin::_sequence_type);
|
LV2Plugin::_chunk_type, LV2Plugin::_sequence_type);
|
||||||
}
|
}
|
||||||
_atom_ev_buffers[total_atom_buffers] = 0;
|
_atom_ev_buffers[total_atom_buffers] = 0;
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -1511,16 +1512,15 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
|
|||||||
buf = lv2_evbuf_get_buffer(_ev_buffers[port_index]);
|
buf = lv2_evbuf_get_buffer(_ev_buffers[port_index]);
|
||||||
}
|
}
|
||||||
} else if (flags & (PORT_ATOM)) {
|
} else if (flags & (PORT_ATOM)) {
|
||||||
|
assert(_atom_ev_buffers && _atom_ev_buffers[atom_port_index]);
|
||||||
if (flags & PORT_INPUT) {
|
if (flags & PORT_INPUT) {
|
||||||
lv2_evbuf_reset(_atom_ev_buffers[atom_port_index], true);
|
lv2_evbuf_reset(_atom_ev_buffers[atom_port_index], true);
|
||||||
_ev_buffers[port_index] = _atom_ev_buffers[atom_port_index++];
|
_ev_buffers[port_index] = _atom_ev_buffers[atom_port_index++];
|
||||||
buf = lv2_evbuf_get_buffer(_ev_buffers[port_index]);
|
|
||||||
} else {
|
} else {
|
||||||
lv2_evbuf_reset(_atom_ev_buffers[atom_port_index], false);
|
lv2_evbuf_reset(_atom_ev_buffers[atom_port_index], false);
|
||||||
_ev_buffers[port_index] = _atom_ev_buffers[atom_port_index++];
|
_ev_buffers[port_index] = _atom_ev_buffers[atom_port_index++];
|
||||||
buf = lv2_evbuf_get_buffer(_ev_buffers[port_index]);
|
|
||||||
}
|
}
|
||||||
assert(_ev_buffers[port_index]);
|
buf = lv2_evbuf_get_buffer(_ev_buffers[port_index]);
|
||||||
assert(buf);
|
assert(buf);
|
||||||
} else {
|
} else {
|
||||||
continue; // Control port, leave buffer alone
|
continue; // Control port, leave buffer alone
|
||||||
|
Loading…
Reference in New Issue
Block a user