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.
This commit is contained in:
parent
e4c7cb1e75
commit
8d6d0b3232
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user