From 96ef4d20f21abf593cb82c1476168ba83c2f82bf Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 9 Nov 2024 09:20:25 -0700 Subject: [PATCH] when recording MIDI, create active_notes on demand Since the signal handler for "data recorded" is in the GUI thread, we can do whatever we want there, including memory allocation --- gtk2_ardour/midi_cue_editor.cc | 4 +--- gtk2_ardour/midi_view.cc | 9 +-------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/gtk2_ardour/midi_cue_editor.cc b/gtk2_ardour/midi_cue_editor.cc index af09b972f2..73bfdc354e 100644 --- a/gtk2_ardour/midi_cue_editor.cc +++ b/gtk2_ardour/midi_cue_editor.cc @@ -501,9 +501,7 @@ MidiCueEditor::box_rec_enable_change (ARDOUR::TriggerBox const & b) void MidiCueEditor::trigger_rec_enable_change (ARDOUR::Trigger const & t) { - if (t.armed()) { - view->begin_write(); - } else { + if (!t.armed()) { view->end_write (); } } diff --git a/gtk2_ardour/midi_view.cc b/gtk2_ardour/midi_view.cc index 71eb64ceac..e4d70be077 100644 --- a/gtk2_ardour/midi_view.cc +++ b/gtk2_ardour/midi_view.cc @@ -193,12 +193,6 @@ MidiView::set_track (std::shared_ptr mt) if (_midi_track) { _midi_track->DropReferences.connect (track_going_away_connection, invalidator (*this), std::bind (&MidiView::track_going_away, this), gui_context()); - - if (_needs_active_notes_for_rec_enabled_track && _midi_track->triggerbox()->record_enabled()) { - begin_write (); - } else { - end_write (); - } } } @@ -4497,8 +4491,7 @@ MidiView::clip_data_recorded (samplecnt_t total_duration) } if (!_active_notes) { - /* we aren't actively being recorded to */ - return; + begin_write (); } if (_active_notes) {