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.
This commit is contained in:
parent
827c23bef3
commit
e7b8e98db2
@ -268,10 +268,6 @@ MidiRegionView::init (bool wfd)
|
|||||||
{
|
{
|
||||||
PublicEditor::DropDownKeys.connect (sigc::mem_fun (*this, &MidiRegionView::drop_down_keys));
|
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) {
|
if (wfd) {
|
||||||
Glib::Threads::Mutex::Lock lm(midi_region()->midi_source(0)->mutex());
|
Glib::Threads::Mutex::Lock lm(midi_region()->midi_source(0)->mutex());
|
||||||
midi_region()->midi_source(0)->load_model(lm);
|
midi_region()->midi_source(0)->load_model(lm);
|
||||||
@ -1384,8 +1380,6 @@ MidiRegionView::~MidiRegionView ()
|
|||||||
|
|
||||||
hide_verbose_cursor ();
|
hide_verbose_cursor ();
|
||||||
|
|
||||||
note_delete_connection.disconnect ();
|
|
||||||
|
|
||||||
delete _list_editor;
|
delete _list_editor;
|
||||||
|
|
||||||
RegionViewGoingAway (this); /* EMIT_SIGNAL */
|
RegionViewGoingAway (this); /* EMIT_SIGNAL */
|
||||||
@ -2098,7 +2092,7 @@ MidiRegionView::step_patch (PatchChange& patch, bool bank, int delta)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MidiRegionView::maybe_remove_deleted_note_from_selection (NoteBase* cne)
|
MidiRegionView::note_deleted (NoteBase* cne)
|
||||||
{
|
{
|
||||||
if (_selection.empty()) {
|
if (_selection.empty()) {
|
||||||
return;
|
return;
|
||||||
|
@ -332,6 +332,8 @@ public:
|
|||||||
|
|
||||||
ARDOUR::InstrumentInfo& instrument_info() const;
|
ARDOUR::InstrumentInfo& instrument_info() const;
|
||||||
|
|
||||||
|
void note_deleted (NoteBase*);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void region_resized (const PBD::PropertyChange&);
|
void region_resized (const PBD::PropertyChange&);
|
||||||
|
|
||||||
@ -471,9 +473,6 @@ private:
|
|||||||
MidiListEditor* _list_editor;
|
MidiListEditor* _list_editor;
|
||||||
bool _no_sound_notes;
|
bool _no_sound_notes;
|
||||||
|
|
||||||
PBD::ScopedConnection note_delete_connection;
|
|
||||||
void maybe_remove_deleted_note_from_selection (NoteBase*);
|
|
||||||
|
|
||||||
void snap_changed ();
|
void snap_changed ();
|
||||||
PBD::ScopedConnection snap_changed_connection;
|
PBD::ScopedConnection snap_changed_connection;
|
||||||
|
|
||||||
|
@ -36,8 +36,6 @@ using namespace Gtkmm2ext;
|
|||||||
using ARDOUR::MidiModel;
|
using ARDOUR::MidiModel;
|
||||||
using namespace ArdourCanvas;
|
using namespace ArdourCanvas;
|
||||||
|
|
||||||
PBD::Signal1<void,NoteBase*> NoteBase::NoteBaseDeleted;
|
|
||||||
|
|
||||||
/// dividing the hue circle in 16 parts, hand adjusted for equal look, courtesy Thorsten Wilms
|
/// dividing the hue circle in 16 parts, hand adjusted for equal look, courtesy Thorsten Wilms
|
||||||
const uint32_t NoteBase::midi_channel_colors[16] = {
|
const uint32_t NoteBase::midi_channel_colors[16] = {
|
||||||
0xd32d2dff, 0xd36b2dff, 0xd3972dff, 0xd3d12dff,
|
0xd32d2dff, 0xd36b2dff, 0xd3972dff, 0xd3d12dff,
|
||||||
@ -62,7 +60,7 @@ NoteBase::NoteBase(MidiRegionView& region, bool with_events, const boost::shared
|
|||||||
|
|
||||||
NoteBase::~NoteBase()
|
NoteBase::~NoteBase()
|
||||||
{
|
{
|
||||||
NoteBaseDeleted (this);
|
_region.note_deleted (this);
|
||||||
|
|
||||||
delete _text;
|
delete _text;
|
||||||
}
|
}
|
||||||
|
@ -61,8 +61,6 @@ class NoteBase : public sigc::trackable
|
|||||||
void set_item (ArdourCanvas::Item *);
|
void set_item (ArdourCanvas::Item *);
|
||||||
ArdourCanvas::Item* item() const { return _item; }
|
ArdourCanvas::Item* item() const { return _item; }
|
||||||
|
|
||||||
static PBD::Signal1<void, NoteBase*> NoteBaseDeleted;
|
|
||||||
|
|
||||||
virtual void show() = 0;
|
virtual void show() = 0;
|
||||||
virtual void hide() = 0;
|
virtual void hide() = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user