diff options
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/ardour/plugin_insert.h | 6 | ||||
-rw-r--r-- | libs/ardour/plugin_insert.cc | 14 |
2 files changed, 20 insertions, 0 deletions
diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h index 05d0d4043c..bec49616a2 100644 --- a/libs/ardour/ardour/plugin_insert.h +++ b/libs/ardour/ardour/plugin_insert.h @@ -25,6 +25,8 @@ #include <boost/weak_ptr.hpp> +#include "pbd/timing.h" + #include "ardour/ardour.h" #include "ardour/libardour_visibility.h" #include "ardour/chan_mapping.h" @@ -190,6 +192,8 @@ public: bool load_preset (Plugin::PresetRecord); + bool get_stats (uint64_t& min, uint64_t& max, double& avg, double& dev) const; + /** A control that manipulates a plugin parameter (control port). */ struct PluginControl : public AutomationControl { @@ -389,6 +393,8 @@ private: CtrlOutMap _control_outputs; void preset_load_set_value (uint32_t, float); + + PBD::TimingStats _timing_stats; }; } // namespace ARDOUR diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc index c179f0d24b..7ce8ea547f 100644 --- a/libs/ardour/plugin_insert.cc +++ b/libs/ardour/plugin_insert.cc @@ -617,6 +617,7 @@ PluginInsert::find_next_event (double now, double end, Evoral::ControlEvent& nex void PluginInsert::activate () { + _timing_stats.reset (); for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { (*i)->activate (); } @@ -638,6 +639,7 @@ PluginInsert::activate () void PluginInsert::deactivate () { + _timing_stats.reset (); Processor::deactivate (); for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { @@ -1204,6 +1206,7 @@ PluginInsert::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sa } if (_pending_active) { + _timing_stats.start (); /* run as normal if we are active or moving from inactive to active */ if (_session.transport_rolling() || _session.bounce_processing()) { @@ -1212,8 +1215,10 @@ PluginInsert::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sa Glib::Threads::Mutex::Lock lm (control_lock(), Glib::Threads::TRY_LOCK); connect_and_run (bufs, start_sample, end_sample, speed, nframes, 0, lm.locked()); } + _timing_stats.update (); } else { + _timing_stats.reset (); // XXX should call ::silence() to run plugin(s) for consistent load. // We'll need to change this anyway when bypass can be automated bypass (bufs, nframes); @@ -3123,6 +3128,15 @@ PluginInsert::end_touch (uint32_t param_id) } } +bool +PluginInsert::get_stats (uint64_t& min, uint64_t& max, double& avg, double& dev) const +{ + /* TODO: consider taking a try/lock: Don't run concurrently with + * TimingStats::update, TimingStats::reset. + */ + return _timing_stats.get_stats (min, max, avg, dev); +} + std::ostream& operator<<(std::ostream& o, const ARDOUR::PluginInsert::Match& m) { switch (m.method) { |