diff options
author | GZharun <grygoriiz@wavesglobal.com> | 2015-02-15 13:02:16 +0200 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2015-06-29 14:18:12 -0400 |
commit | 317bacfa3a5cb0a9228eb741c8759ec11a42f488 (patch) | |
tree | 7d10004a08e4af0e3ec107c5e84a8e79a7e4c2b4 /libs | |
parent | b8f29872a7284ccefde1d14806247e4ee0fe3e20 (diff) |
[Summary] Eliminated redundant marker update notification which lead to creation of huge amount of redundant session events
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/location.h | 10 | ||||
-rw-r--r-- | libs/ardour/location.cc | 26 | ||||
-rw-r--r-- | libs/ardour/session.cc | 16 |
3 files changed, 41 insertions, 11 deletions
diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h index f809dbf280..7d51f6a7f3 100644 --- a/libs/ardour/ardour/location.h +++ b/libs/ardour/ardour/location.h @@ -123,11 +123,13 @@ class LIBARDOUR_API Location : public SessionHandleRef, public PBD::StatefulDest changes to this object */ + PBD::Signal0<void> Changed; + void set_block_change_notifications (bool yn) {_block_change_notifications = yn;} + PBD::Signal0<void> NameChanged; PBD::Signal0<void> EndChanged; PBD::Signal0<void> StartChanged; - PBD::Signal0<void> Changed; - PBD::Signal0<void> FlagsChanged; + PBD::Signal0<void> FlagsChanged; PBD::Signal0<void> LockChanged; PBD::Signal0<void> PositionLockStyleChanged; @@ -155,6 +157,8 @@ class LIBARDOUR_API Location : public SessionHandleRef, public PBD::StatefulDest bool _locked; PositionLockStyle _position_lock_style; boost::shared_ptr<SceneChange> _scene_change; + + bool _block_change_notifications; // required for group operations void set_mark (bool yn); bool set_flag_internal (bool yn, Flags flag); @@ -199,7 +203,7 @@ class LIBARDOUR_API Locations : public SessionHandleRef, public PBD::StatefulDes void marks_either_side (framepos_t const, framepos_t &, framepos_t &) const; void find_all_between (framepos_t start, framepos_t, LocationList&, Location::Flags); - + PBD::Signal1<void,Location*> current_changed; /* Objects that care about individual addition and removal of Locations should connect to added/removed. diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc index 2c19ebd1e0..31a3f6c3ae 100644 --- a/libs/ardour/location.cc +++ b/libs/ardour/location.cc @@ -58,6 +58,7 @@ Location::Location (Session& s) , _flags (Flags (0)) , _locked (false) , _position_lock_style (AudioTime) + , _block_change_notifications (false) { assert (_start >= 0); assert (_end >= 0); @@ -72,6 +73,8 @@ Location::Location (Session& s, framepos_t sample_start, framepos_t sample_end, , _flags (bits) , _locked (false) , _position_lock_style (s.config.get_glue_new_markers_to_bars_and_beats() ? MusicTime : AudioTime) + , _block_change_notifications (false) + { recompute_bbt_from_frames (); @@ -89,6 +92,8 @@ Location::Location (const Location& other) , _bbt_end (other._bbt_end) , _flags (other._flags) , _position_lock_style (other._position_lock_style) + , _block_change_notifications (false) + { /* copy is not locked even if original was */ @@ -405,7 +410,10 @@ Location::set (framepos_t s, framepos_t e, bool allow_bbt_recompute) if (start_change && end_change) { changed (this); + + if (!_block_change_notifications) { Changed (); + } } return 0; @@ -427,8 +435,11 @@ Location::move_to (framepos_t pos) _end = _start + length(); recompute_bbt_from_frames (); - changed (this); /* EMIT SIGNAL */ - Changed (); /* EMIT SIGNAL */ + changed (this); /* EMIT SIGNAL */ + + if (!_block_change_notifications) { + Changed (); /* EMIT SIGNAL */ + } } assert (_start >= 0); @@ -687,8 +698,11 @@ Location::set_state (const XMLNode& node, int version) recompute_bbt_from_frames (); - changed (this); /* EMIT SIGNAL */ - Changed (); /* EMIT SIGNAL */ + changed (this); /* EMIT SIGNAL */ + + if (!_block_change_notifications) { + Changed (); /* EMIT SIGNAL */ + } assert (_start >= 0); assert (_end >= 0); @@ -1069,7 +1083,11 @@ Locations::set_state (const XMLNode& node, int version) if (i != locations.end()) { /* we can re-use an old Location object */ loc = *i; + + // changed locations will be updated by Locations::changed signal + loc->set_block_change_notifications (true); loc->set_state (**niter, version); + loc->set_block_change_notifications (false); } else { loc = new Location (_session, **niter); } diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 7706aeb37a..c3fbd44f0f 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -1740,10 +1740,18 @@ Session::_locations_changed (const Locations::LocationList& locations) We might be re-adding a location here but it doesn't actually matter for all the locations that the Session takes an interest in. */ - - for (Locations::LocationList::const_iterator i = locations.begin(); i != locations.end(); ++i) { - location_added (*i); - } + loop_update_connections.drop_connections (); + mark_update_connections.drop_connections (); + skip_update_connections.drop_connections (); + + { + PBD::Unwinder<bool> protect_ignore_skip_updates (_ignore_skips_updates, true); + for (Locations::LocationList::const_iterator i = locations.begin(); i != locations.end(); ++i) { + location_added (*i); + } + } + + update_skips (NULL, false); } void |