add a dedicated channel map per plugin

This commit is contained in:
Robin Gareus 2016-03-25 20:34:42 +01:00
parent 8af8fcab84
commit 5fb5a20e08
2 changed files with 27 additions and 30 deletions

View file

@ -216,8 +216,8 @@ class LIBARDOUR_API PluginInsert : public Processor
/** details of the match currently being used */ /** details of the match currently being used */
Match _match; Match _match;
ARDOUR::ChanMapping _in_map; std::map <int, ARDOUR::ChanMapping> _in_map;
ARDOUR::ChanMapping _out_map; std::map <int, ARDOUR::ChanMapping> _out_map;
void automation_run (BufferSet& bufs, framepos_t start, pframes_t nframes); void automation_run (BufferSet& bufs, framepos_t start, pframes_t nframes);
void connect_and_run (BufferSet& bufs, pframes_t nframes, framecnt_t offset, bool with_auto, framepos_t now = 0); void connect_and_run (BufferSet& bufs, pframes_t nframes, framecnt_t offset, bool with_auto, framepos_t now = 0);

View file

@ -376,14 +376,15 @@ PluginInsert::connect_and_run (BufferSet& bufs, pframes_t nframes, framecnt_t of
bool valid; bool valid;
if (_match.method == Split) { if (_match.method == Split) {
assert (_in_map.size () == 1);
/* fix the input mapping so that we have maps for each of the plugin's inputs */ /* fix the input mapping so that we have maps for each of the plugin's inputs */
/* copy the first stream's buffer contents to the others */ /* copy the first stream's buffer contents to the others */
/* XXX: audio only */ /* XXX: audio only */
uint32_t first_idx = _in_map.get (DataType::AUDIO, 0, &valid); uint32_t first_idx = _in_map[0].get (DataType::AUDIO, 0, &valid);
if (valid) { if (valid) {
for (uint32_t i = in_streams.n_audio(); i < natural_input_streams().n_audio(); ++i) { for (uint32_t i = in_streams.n_audio(); i < natural_input_streams().n_audio(); ++i) {
bufs.get_audio(_in_map.get (DataType::AUDIO, i, &valid)).read_from(bufs.get_audio(first_idx), nframes, offset, offset); bufs.get_audio(_in_map[0].get (DataType::AUDIO, i, &valid)).read_from(bufs.get_audio(first_idx), nframes, offset, offset);
} }
} }
} }
@ -443,20 +444,11 @@ PluginInsert::connect_and_run (BufferSet& bufs, pframes_t nframes, framecnt_t of
} }
uint32_t pc = 0;
// copy - for now - since the map is offset below for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i, ++pc) {
// TODO: use dedicated maps per plugin if ((*i)->connect_and_run(bufs, _in_map[pc], _out_map[pc], nframes, offset)) {
ChanMapping in_map (_in_map);
ChanMapping out_map (_out_map);
for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
if ((*i)->connect_and_run(bufs, in_map, out_map, nframes, offset)) {
deactivate (); deactivate ();
} }
for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
in_map.offset_to(*t, natural_input_streams().get(*t));
out_map.offset_to(*t, natural_output_streams().get(*t));
}
} }
if (collect_signal_nframes > 0) { if (collect_signal_nframes > 0) {
@ -494,8 +486,11 @@ PluginInsert::silence (framecnt_t nframes)
return; return;
} }
ChanMapping in_map (natural_input_streams ());
ChanMapping out_map (natural_output_streams ());
for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
(*i)->connect_and_run (_session.get_scratch_buffers ((*i)->get_info()->n_inputs, true), _in_map, _out_map, nframes, 0); (*i)->connect_and_run (_session.get_scratch_buffers ((*i)->get_info()->n_inputs, true), in_map, out_map, nframes, 0);
} }
} }
@ -752,20 +747,22 @@ PluginInsert::configure_io (ChanCount in, ChanCount out)
break; break;
} }
if (_match.method == Split) { // TODO make configurable
/* fix the input mapping so that we have maps for each of the plugin's inputs */ uint32_t pc = 0;
_in_map = ChanMapping (natural_input_streams ()); for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i, ++pc) {
} else { if (_match.method == Split) {
_in_map = ChanMapping (input_streams ()); /* TODO see PluginInsert::connect_and_run, channel replication */
} _in_map[pc] = ChanMapping (natural_input_streams ());
_out_map = ChanMapping (output_streams()); } else {
_in_map[pc] = ChanMapping (input_streams ());
}
_out_map[pc] = ChanMapping (output_streams());
#if 0 for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
cout << "Set Channel Maps:" << name () << " " << this _in_map[pc].offset_to(*t, pc * natural_input_streams().get(*t));
<< "\nin:\n" << _in_map _out_map[pc].offset_to(*t, pc * natural_output_streams().get(*t));
<< "\nout:\n" << _out_map }
<< "\n"; }
#endif
if ( (old_match.method != _match.method && (old_match.method == Split || _match.method == Split)) if ( (old_match.method != _match.method && (old_match.method == Split || _match.method == Split))