From 903c3ec5a0491b3e504a81bddeb7fe7c429e2a7e Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 26 Sep 2019 18:39:46 -0600 Subject: [PATCH] rename BufferSet::get* to BufferSet::get_available* This tries to make it clear what the BufferSet limit semantics really are --- libs/ardour/ardour/buffer_set.h | 18 ++++++++--------- libs/ardour/buffer_set.cc | 4 ++-- libs/ardour/capturing_processor.cc | 2 +- libs/ardour/delivery.cc | 2 +- libs/ardour/dsp_filter.cc | 4 ++-- libs/ardour/plugin_insert.cc | 32 +++++++++++++++--------------- libs/ardour/process_thread.cc | 6 +++--- libs/ardour/sidechain.cc | 2 +- 8 files changed, 35 insertions(+), 35 deletions(-) diff --git a/libs/ardour/ardour/buffer_set.h b/libs/ardour/ardour/buffer_set.h index 5808358173..4c92849843 100644 --- a/libs/ardour/ardour/buffer_set.h +++ b/libs/ardour/ardour/buffer_set.h @@ -97,23 +97,23 @@ public: size_t buffer_capacity(DataType type) const; - Buffer& get(DataType type, size_t i); - const Buffer& get(DataType type, size_t i) const; - AudioBuffer& get_audio(size_t i) { - return (AudioBuffer&)get(DataType::AUDIO, i); + return (AudioBuffer&)get_available (DataType::AUDIO, i); } const AudioBuffer& get_audio(size_t i) const { - return (const AudioBuffer&)get(DataType::AUDIO, i); + return (const AudioBuffer&)get_available(DataType::AUDIO, i); } MidiBuffer& get_midi(size_t i) { - return (MidiBuffer&)get(DataType::MIDI, i); + return (MidiBuffer&)get_available(DataType::MIDI, i); } const MidiBuffer& get_midi(size_t i) const { - return (const MidiBuffer&)get(DataType::MIDI, i); + return (const MidiBuffer&)get_available(DataType::MIDI, i); } + Buffer& get_available(DataType type, size_t i); + const Buffer& get_available(DataType type, size_t i) const; + #ifdef LV2_SUPPORT /** Get a MIDI buffer translated into an LV2 MIDI buffer for use with * plugins. The index here corresponds directly to MIDI buffer numbers @@ -144,8 +144,8 @@ public: template class iterator_base { public: - B& operator*() { return (B&)_set.get(_type, _index); } - B* operator->() { return &(B&)_set.get(_type, _index); } + B& operator*() { return (B&)_set.get_available(_type, _index); } + B* operator->() { return &(B&)_set.get_available(_type, _index); } iterator_base& operator++() { ++_index; return *this; } // yes, prefix only bool operator==(const iterator_base& other) { return (_index == other._index); } bool operator!=(const iterator_base& other) { return (_index != other._index); } diff --git a/libs/ardour/buffer_set.cc b/libs/ardour/buffer_set.cc index 8bdd18e0fa..9ad69216d3 100644 --- a/libs/ardour/buffer_set.cc +++ b/libs/ardour/buffer_set.cc @@ -248,14 +248,14 @@ BufferSet::buffer_capacity(DataType type) const } Buffer& -BufferSet::get(DataType type, size_t i) +BufferSet::get_available(DataType type, size_t i) { assert(i < _available.get(type)); return *_buffers[type][i]; } const Buffer& -BufferSet::get(DataType type, size_t i) const +BufferSet::get_available(DataType type, size_t i) const { assert(i < _available.get(type)); return *_buffers[type][i]; diff --git a/libs/ardour/capturing_processor.cc b/libs/ardour/capturing_processor.cc index c6471426c9..f90c670fa6 100644 --- a/libs/ardour/capturing_processor.cc +++ b/libs/ardour/capturing_processor.cc @@ -55,7 +55,7 @@ CapturingProcessor::run (BufferSet& bufs, samplepos_t, samplepos_t, double, pfra } for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) { for (uint32_t b = 0; b < bufs.count().get (*t); ++b) { - _delaybuffers.delay (*t, b, capture_buffers.get (*t, b), bufs.get (*t, b), nframes, 0, 0); + _delaybuffers.delay (*t, b, capture_buffers.get_available (*t, b), bufs.get_available (*t, b), nframes, 0, 0); } } } diff --git a/libs/ardour/delivery.cc b/libs/ardour/delivery.cc index b4b0237739..463bfce88b 100644 --- a/libs/ardour/delivery.cc +++ b/libs/ardour/delivery.cc @@ -349,7 +349,7 @@ Delivery::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample if (outs.count ().get (*t) <= n) { continue; } - b->read_from (outs.get (*t, n++), nframes, (*t == DataType::AUDIO ? 0 : -Port::port_offset())); + b->read_from (outs.get_available (*t, n++), nframes, (*t == DataType::AUDIO ? 0 : -Port::port_offset())); } } } diff --git a/libs/ardour/dsp_filter.cc b/libs/ardour/dsp_filter.cc index a644e1dd6f..1462fba431 100644 --- a/libs/ardour/dsp_filter.cc +++ b/libs/ardour/dsp_filter.cc @@ -85,7 +85,7 @@ ARDOUR::DSP::process_map (BufferSet* bufs, const ChanMapping& in, const ChanMapp bool valid; const uint32_t idx = out.get (dt, i->second, &valid); if (valid && idx != i->first) { - bufs->get (dt, idx).read_from (bufs->get (dt, i->first), nframes, offset, offset); + bufs->get_available (dt, idx).read_from (bufs->get_available (dt, i->first), nframes, offset, offset); } } } @@ -95,7 +95,7 @@ ARDOUR::DSP::process_map (BufferSet* bufs, const ChanMapping& in, const ChanMapp bool valid; in.get_src (dt, i->first, &valid); if (!valid) { - bufs->get (dt, i->second).silence (nframes, offset); + bufs->get_available (dt, i->second).silence (nframes, offset); } } } diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc index ac2b43b3b9..8d4fa47ac4 100644 --- a/libs/ardour/plugin_insert.cc +++ b/libs/ardour/plugin_insert.cc @@ -834,7 +834,7 @@ PluginInsert::inplace_silence_unconnected (BufferSet& bufs, const PinMappings& o } } if (!mapped) { - bufs.get (*t, out).silence (nframes, offset); + bufs.get_available (*t, out).silence (nframes, offset); } } } @@ -886,7 +886,7 @@ PluginInsert::connect_and_run (BufferSet& bufs, samplepos_t start, samplepos_t e uint32_t idx = in_map.p(0).get (*t, i, &valid); if (valid) { assert (idx == 0); - bufs.get (*t, i).read_from (bufs.get (*t, first_idx), nframes, offset, offset); + bufs.get_available (*t, i).read_from (bufs.get_available (*t, first_idx), nframes, offset, offset); } } } @@ -969,7 +969,7 @@ PluginInsert::connect_and_run (BufferSet& bufs, samplepos_t start, samplepos_t e uint32_t in_idx = thru_map.get (*t, out, &valid); uint32_t m = out + natural_input_streams ().get (*t); if (valid) { - _delaybuffers.delay (*t, out, inplace_bufs.get (*t, m), bufs.get (*t, in_idx), nframes, offset, offset); + _delaybuffers.delay (*t, out, inplace_bufs.get_available (*t, m), bufs.get_available (*t, in_idx), nframes, offset, offset); used_outputs.set (*t, out, 1); // mark as used } else { used_outputs.get (*t, out, &valid); @@ -977,7 +977,7 @@ PluginInsert::connect_and_run (BufferSet& bufs, samplepos_t start, samplepos_t e /* the plugin is expected to write here, but may not :( * (e.g. drumgizmo w/o kit loaded) */ - inplace_bufs.get (*t, m).silence (nframes); + inplace_bufs.get_available (*t, m).silence (nframes); } } } @@ -997,9 +997,9 @@ PluginInsert::connect_and_run (BufferSet& bufs, samplepos_t start, samplepos_t e uint32_t in_idx = in_map.p(pc).get (*t, in, &valid); uint32_t m = mapped.get (*t); if (valid) { - inplace_bufs.get (*t, m).read_from (bufs.get (*t, in_idx), nframes, offset, offset); + inplace_bufs.get_available (*t, m).read_from (bufs.get_available (*t, in_idx), nframes, offset, offset); } else { - inplace_bufs.get (*t, m).silence (nframes, offset); + inplace_bufs.get_available (*t, m).silence (nframes, offset); } mapped.set (*t, m + 1); } @@ -1028,11 +1028,11 @@ PluginInsert::connect_and_run (BufferSet& bufs, samplepos_t start, samplepos_t e if (!valid) { nonzero_out.get (*t, out, &valid); if (!valid) { - bufs.get (*t, out).silence (nframes, offset); + bufs.get_available (*t, out).silence (nframes, offset); } } else { uint32_t m = out + natural_input_streams ().get (*t); - bufs.get (*t, out).read_from (inplace_bufs.get (*t, m), nframes, offset, offset); + bufs.get_available (*t, out).read_from (inplace_bufs.get_available (*t, m), nframes, offset, offset); } } } @@ -1105,7 +1105,7 @@ PluginInsert::bypass (BufferSet& bufs, pframes_t nframes) // copy all inputs for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) { for (uint32_t in = 0; in < _configured_internal.get (*t); ++in) { - inplace_bufs.get (*t, in).read_from (bufs.get (*t, in), nframes, 0, 0); + inplace_bufs.get_available (*t, in).read_from (bufs.get_available (*t, in), nframes, 0, 0); } } ARDOUR::ChanMapping used_outputs; @@ -1115,7 +1115,7 @@ PluginInsert::bypass (BufferSet& bufs, pframes_t nframes) bool valid; uint32_t in_idx = thru_map.get (*t, out, &valid); if (valid) { - bufs.get (*t, out).read_from (inplace_bufs.get (*t, in_idx), nframes, 0, 0); + bufs.get_available (*t, out).read_from (inplace_bufs.get_available (*t, in_idx), nframes, 0, 0); used_outputs.set (*t, out, 1); // mark as used } } @@ -1132,7 +1132,7 @@ PluginInsert::bypass (BufferSet& bufs, pframes_t nframes) if (!valid) { continue; } - bufs.get (*t, out).read_from (inplace_bufs.get (*t, in_idx), nframes, 0, 0); + bufs.get_available (*t, out).read_from (inplace_bufs.get_available (*t, in_idx), nframes, 0, 0); used_outputs.set (*t, out, 1); // mark as used } } @@ -1145,7 +1145,7 @@ PluginInsert::bypass (BufferSet& bufs, pframes_t nframes) bool valid; used_outputs.get (*t, out, &valid); if (!valid) { - bufs.get (*t, out).silence (nframes, 0); + bufs.get_available (*t, out).silence (nframes, 0); } } } @@ -1163,7 +1163,7 @@ PluginInsert::bypass (BufferSet& bufs, pframes_t nframes) uint32_t idx = in_map.get (*t, i, &valid); if (valid) { assert (idx == 0); - bufs.get (*t, i).read_from (bufs.get (*t, first_idx), nframes, 0, 0); + bufs.get_available (*t, i).read_from (bufs.get_available (*t, first_idx), nframes, 0, 0); } } } @@ -1175,16 +1175,16 @@ PluginInsert::bypass (BufferSet& bufs, pframes_t nframes) bool valid; uint32_t src_idx = out_map.get_src (*t, out, &valid); if (!valid) { - bufs.get (*t, out).silence (nframes, 0); + bufs.get_available (*t, out).silence (nframes, 0); continue; } uint32_t in_idx = in_map.get (*t, src_idx, &valid); if (!valid) { - bufs.get (*t, out).silence (nframes, 0); + bufs.get_available (*t, out).silence (nframes, 0); continue; } if (in_idx != src_idx) { - bufs.get (*t, out).read_from (bufs.get (*t, in_idx), nframes, 0, 0); + bufs.get_available (*t, out).read_from (bufs.get_available (*t, in_idx), nframes, 0, 0); } } } diff --git a/libs/ardour/process_thread.cc b/libs/ardour/process_thread.cc index 196b884100..7f31013687 100644 --- a/libs/ardour/process_thread.cc +++ b/libs/ardour/process_thread.cc @@ -87,7 +87,7 @@ ProcessThread::get_silent_buffers (ChanCount count) for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) { for (size_t i= 0; i < count.get(*t); ++i) { - sb->get(*t, i).clear(); + sb->get_available(*t, i).clear(); } } @@ -113,7 +113,7 @@ ProcessThread::get_scratch_buffers (ChanCount count, bool silence) if (silence) { for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) { for (uint32_t i = 0; i < sb->count().get(*t); ++i) { - sb->get(*t, i).clear(); + sb->get_available (*t, i).clear(); } } } @@ -159,7 +159,7 @@ ProcessThread::get_route_buffers (ChanCount count, bool silence) if (silence) { for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) { for (uint32_t i = 0; i < sb->count().get(*t); ++i) { - sb->get(*t, i).clear(); + sb->get_available (*t, i).clear(); } } } diff --git a/libs/ardour/sidechain.cc b/libs/ardour/sidechain.cc index ee1058c78f..9fa6a6014a 100644 --- a/libs/ardour/sidechain.cc +++ b/libs/ardour/sidechain.cc @@ -72,7 +72,7 @@ SideChain::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sampl // zero buffers for (DataType::iterator t = DataType::begin (); t != DataType::end (); ++t) { for (uint32_t out = _configured_input.get (*t); out < bufs.count ().get (*t); ++out) { - bufs.get (*t, out).silence (nframes); + bufs.get_available (*t, out).silence (nframes); } } return;