summaryrefslogtreecommitdiff
path: root/libs/ardour/plugin_insert.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2018-11-04 03:25:36 +0100
committerRobin Gareus <robin@gareus.org>2018-11-04 03:25:36 +0100
commit8d6d0b323268fc779e796e36a4ad69d2ca965324 (patch)
treeb4d3ebb4a3140b8dc9fba20ea2bbef9307c1745e /libs/ardour/plugin_insert.cc
parente4c7cb1e750f835854797d0b765353f187e9f148 (diff)
Prefer const references for Pin/Channel maps
Another micro-optmization shaving off some ten microseconds for every plugin. Also copying maps isn't RT-safe. This may however cause issue if const map references can change while a plugin is running.
Diffstat (limited to 'libs/ardour/plugin_insert.cc')
-rw-r--r--libs/ardour/plugin_insert.cc23
1 files changed, 11 insertions, 12 deletions
diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc
index 23c9f8eb7a..b24d065b5b 100644
--- a/libs/ardour/plugin_insert.cc
+++ b/libs/ardour/plugin_insert.cc
@@ -824,14 +824,14 @@ PluginInsert::inplace_silence_unconnected (BufferSet& bufs, const PinMappings& o
void
PluginInsert::connect_and_run (BufferSet& bufs, samplepos_t start, samplepos_t end, double speed, pframes_t nframes, samplecnt_t offset, bool with_auto)
{
- // TODO: atomically copy maps & _no_inplace
- PinMappings in_map (_in_map);
- PinMappings out_map (_out_map);
- ChanMapping thru_map (_thru_map);
- if (_mapping_changed) { // ToDo use a counters, increment until match.
+ if (_mapping_changed) { // ToDo use a counter, increment until match
_no_inplace = check_inplace ();
_mapping_changed = false;
}
+ // TODO: atomically copy maps & _no_inplace
+ PinMappings in_map (_in_map); // TODO Split case below overrides, use const& in_map
+ PinMappings const& out_map (_out_map);
+ ChanMapping const& thru_map (_thru_map);
if (_latency_changed) {
/* delaylines are configured with the max possible latency (as reported by the plugin)
@@ -1081,14 +1081,13 @@ PluginInsert::bypass (BufferSet& bufs, pframes_t nframes)
/* bypass the plugin(s) not the whole processor.
* -> use mappings just like connect_and_run
*/
-
- // TODO: atomically copy maps & _no_inplace
- const ChanMapping in_map (no_sc_input_map ());
- const ChanMapping out_map (output_map ());
if (_mapping_changed) {
_no_inplace = check_inplace ();
_mapping_changed = false;
}
+ // TODO: atomically copy maps & _no_inplace
+ ChanMapping const& in_map (no_sc_input_map ());
+ ChanMapping const& out_map (output_map ());
bufs.set_count(ChanCount::max(bufs.count(), _configured_internal));
bufs.set_count(ChanCount::max(bufs.count(), _configured_out));
@@ -1198,8 +1197,8 @@ PluginInsert::silence (samplecnt_t nframes, samplepos_t start_sample)
_delaybuffers.flush ();
- ChanMapping in_map (natural_input_streams ());
- ChanMapping out_map (natural_output_streams ());
+ const ChanMapping in_map (natural_input_streams ());
+ const ChanMapping out_map (natural_output_streams ());
ChanCount maxbuf = ChanCount::max (natural_input_streams (), natural_output_streams());
#ifdef MIXBUS
if (is_channelstrip ()) {
@@ -1646,7 +1645,7 @@ PluginInsert::check_inplace ()
*
* but allows in-port 1 -> sink-pin 2 || source-pin 2 -> out port 1
*/
- ChanMapping in_map (input_map ());
+ ChanMapping const& in_map (input_map ());
const ChanMapping::Mappings out_m (output_map ().mappings ());
for (ChanMapping::Mappings::const_iterator t = out_m.begin (); t != out_m.end () && inplace_ok; ++t) {
for (ChanMapping::TypeMapping::const_iterator c = (*t).second.begin (); c != (*t).second.end () ; ++c) {