13
0

RegionFx: abstract Plugin tail API

This commit is contained in:
Robin Gareus 2024-08-23 15:26:50 +02:00
parent fc07a92d36
commit b6e187193d
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 13 additions and 2 deletions

View File

@ -155,6 +155,10 @@ public:
return _required_buffers;
}
/* wrapped Plugin API */
PBD::Signal0<void> TailChanged;
samplecnt_t effective_tail () const;
private:
/* disallow copy construction */
RegionFxPlugin (RegionFxPlugin const&);

View File

@ -2483,7 +2483,7 @@ AudioRegion::_add_plugin (std::shared_ptr<RegionFxPlugin> rfx, std::shared_ptr<R
}
rfx->LatencyChanged.connect_same_thread (*this, boost::bind (&AudioRegion::fx_latency_changed, this, false));
rfx->plugin()->TailChanged.connect_same_thread (*this, boost::bind (&AudioRegion::fx_tail_changed, this, false));
rfx->TailChanged.connect_same_thread (*this, boost::bind (&AudioRegion::fx_tail_changed, this, false));
rfx->set_block_size (_session.get_block_size ());
if (from_set_state) {
@ -2570,7 +2570,7 @@ AudioRegion::fx_tail_changed (bool no_emit)
{
uint32_t t = 0;
for (auto const& rfx : _plugins) {
t = max<uint32_t> (t, rfx->plugin()->effective_tail ());
t = max<uint32_t> (t, rfx->effective_tail ());
}
if (t == _fx_tail) {
return;

View File

@ -390,6 +390,7 @@ RegionFxPlugin::add_plugin (std::shared_ptr<Plugin> plugin)
plugin->ParameterChangedExternally.connect_same_thread (*this, boost::bind (&RegionFxPlugin::parameter_changed_externally, this, _1, _2));
plugin->StartTouch.connect_same_thread (*this, boost::bind (&RegionFxPlugin::start_touch, this, _1));
plugin->EndTouch.connect_same_thread (*this, boost::bind (&RegionFxPlugin::end_touch, this, _1));
plugin->TailChanged.connect_same_thread (*this, [this](){ TailChanged (); });
}
plugin->set_insert (this, _plugins.size ());
@ -466,6 +467,12 @@ RegionFxPlugin::signal_latency () const
return _plugins.front ()->signal_latency ();
}
ARDOUR::samplecnt_t
RegionFxPlugin::effective_tail () const
{
return _plugins.front ()->effective_tail ();
}
PlugInsertBase::UIElements
RegionFxPlugin::ui_elements () const
{