From e7b8e98db26bc2b9ee2587f388de2dbbf7ca5837 Mon Sep 17 00:00:00 2001 From: Tim Mayberry Date: Wed, 14 Oct 2015 20:37:07 +1000 Subject: Replace static PBD::Signal in NoteBase with direct call to MidiRegionView NoteBaseDeleted signal is static so each MidiRegionView(MRV) gets notified about the deletion of each NodeBase instance even if it is contained in another MRV The NoteBase and MRV classes are currently coupled anyway, so this change uses the reference to the MRV parent to directly call the parent when the NoteBase is deleted. This is all in the GUI thread so I'm not sure why a PBD::Signal was being used? If the MRV class is the only reference holder to the NoteBase class then I'm not sure if a callback is needed, perhaps the MRV should just remove the note from the selection before deleting it but I'm not that familiar with the code. Signal emission/calls static NoteBaseDeleted signal vs direct with 10540 NoteBase instances. static: After Load Session: 6360638 After Unload Session: 12221026(5860388) direct: After load Session: 10540 After unload Session: 21080 Session Load/Unload time in master, debug/release with ~10000 Notes(seconds) Load Debug: 32, 26 Unload Debug: 83 Load Release 32, 20, 42 Unload Release 26, 25 Session Load/Unload time with direct call debug/release(seconds) Load Debug: 21.7, 18.1 Unload Debug: 69.4, 71 Load Release: 22.6, 13.4, 17.7 Unload Release: 24, 23.5 This is not a large Session, 1500 regions, 10000 notes so there is probably some other funky stuff going on that needs fixing. --- gtk2_ardour/midi_region_view.cc | 8 +------- gtk2_ardour/midi_region_view.h | 5 ++--- gtk2_ardour/note_base.cc | 4 +--- gtk2_ardour/note_base.h | 2 -- 4 files changed, 4 insertions(+), 15 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 5300a82574..682f02365c 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -268,10 +268,6 @@ MidiRegionView::init (bool wfd) { PublicEditor::DropDownKeys.connect (sigc::mem_fun (*this, &MidiRegionView::drop_down_keys)); - NoteBase::NoteBaseDeleted.connect (note_delete_connection, MISSING_INVALIDATOR, - boost::bind (&MidiRegionView::maybe_remove_deleted_note_from_selection, this, _1), - gui_context()); - if (wfd) { Glib::Threads::Mutex::Lock lm(midi_region()->midi_source(0)->mutex()); midi_region()->midi_source(0)->load_model(lm); @@ -1384,8 +1380,6 @@ MidiRegionView::~MidiRegionView () hide_verbose_cursor (); - note_delete_connection.disconnect (); - delete _list_editor; RegionViewGoingAway (this); /* EMIT_SIGNAL */ @@ -2098,7 +2092,7 @@ MidiRegionView::step_patch (PatchChange& patch, bool bank, int delta) } void -MidiRegionView::maybe_remove_deleted_note_from_selection (NoteBase* cne) +MidiRegionView::note_deleted (NoteBase* cne) { if (_selection.empty()) { return; diff --git a/gtk2_ardour/midi_region_view.h b/gtk2_ardour/midi_region_view.h index 786a7ec7c4..05d5df98f9 100644 --- a/gtk2_ardour/midi_region_view.h +++ b/gtk2_ardour/midi_region_view.h @@ -332,6 +332,8 @@ public: ARDOUR::InstrumentInfo& instrument_info() const; + void note_deleted (NoteBase*); + protected: void region_resized (const PBD::PropertyChange&); @@ -471,9 +473,6 @@ private: MidiListEditor* _list_editor; bool _no_sound_notes; - PBD::ScopedConnection note_delete_connection; - void maybe_remove_deleted_note_from_selection (NoteBase*); - void snap_changed (); PBD::ScopedConnection snap_changed_connection; diff --git a/gtk2_ardour/note_base.cc b/gtk2_ardour/note_base.cc index 228a6dead7..feee7e7d7c 100644 --- a/gtk2_ardour/note_base.cc +++ b/gtk2_ardour/note_base.cc @@ -36,8 +36,6 @@ using namespace Gtkmm2ext; using ARDOUR::MidiModel; using namespace ArdourCanvas; -PBD::Signal1 NoteBase::NoteBaseDeleted; - /// dividing the hue circle in 16 parts, hand adjusted for equal look, courtesy Thorsten Wilms const uint32_t NoteBase::midi_channel_colors[16] = { 0xd32d2dff, 0xd36b2dff, 0xd3972dff, 0xd3d12dff, @@ -62,7 +60,7 @@ NoteBase::NoteBase(MidiRegionView& region, bool with_events, const boost::shared NoteBase::~NoteBase() { - NoteBaseDeleted (this); + _region.note_deleted (this); delete _text; } diff --git a/gtk2_ardour/note_base.h b/gtk2_ardour/note_base.h index e63e59b84b..1e94e709a3 100644 --- a/gtk2_ardour/note_base.h +++ b/gtk2_ardour/note_base.h @@ -61,8 +61,6 @@ class NoteBase : public sigc::trackable void set_item (ArdourCanvas::Item *); ArdourCanvas::Item* item() const { return _item; } - static PBD::Signal1 NoteBaseDeleted; - virtual void show() = 0; virtual void hide() = 0; -- cgit v1.2.3