diff options
-rw-r--r-- | libs/ardour/ardour/plugin_insert.h | 2 | ||||
-rw-r--r-- | libs/ardour/plugin_insert.cc | 11 |
2 files changed, 13 insertions, 0 deletions
diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h index a0dd8618f4..70297f11b2 100644 --- a/libs/ardour/ardour/plugin_insert.h +++ b/libs/ardour/ardour/plugin_insert.h @@ -197,6 +197,7 @@ public: bool load_preset (Plugin::PresetRecord); bool get_stats (uint64_t& min, uint64_t& max, double& avg, double& dev) const; + void clear_stats (); /** A control that manipulates a plugin parameter (control port). */ struct PluginControl : public AutomationControl @@ -399,6 +400,7 @@ private: void preset_load_set_value (uint32_t, float); PBD::TimingStats _timing_stats; + volatile gint _stat_reset; }; } // namespace ARDOUR diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc index 0ad1de02a9..205262ab4c 100644 --- a/libs/ardour/plugin_insert.cc +++ b/libs/ardour/plugin_insert.cc @@ -83,6 +83,7 @@ PluginInsert::PluginInsert (Session& s, boost::shared_ptr<Plugin> plug) , _maps_from_state (false) , _latency_changed (false) , _bypass_port (UINT32_MAX) + , _stat_reset (0) { /* the first is the master */ @@ -1210,6 +1211,10 @@ PluginInsert::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sa _sidechain->run (bufs, start_sample, end_sample, speed, nframes, true); } + if (g_atomic_int_compare_and_exchange (&_stat_reset, 1, 0)) { + _timing_stats.reset (); + } + if (_pending_active) { _timing_stats.start (); /* run as normal if we are active or moving from inactive to active */ @@ -3146,6 +3151,12 @@ PluginInsert::get_stats (uint64_t& min, uint64_t& max, double& avg, double& dev) return _timing_stats.get_stats (min, max, avg, dev); } +void +PluginInsert::clear_stats () +{ + g_atomic_int_set (&_stat_reset, 1); +} + std::ostream& operator<<(std::ostream& o, const ARDOUR::PluginInsert::Match& m) { switch (m.method) { |