From 8986768731c2374503e6472b4529dcc628a1a9f0 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 26 Oct 2024 21:03:55 -0600 Subject: [PATCH] fix invisble notes in MidiRegionView after transport stopped-recording MidiCueView needs an _active_notes array setup when it is assigned a track that is already rec-enabled, because we can start clip recording without session record-enable being active. MidiRegionView does not need this; it uses session rec-enable status to create or delete _active_notes (also transport stop, sometimes) --- gtk2_ardour/midi_cue_view.cc | 2 ++ gtk2_ardour/midi_view.cc | 9 +++++---- gtk2_ardour/midi_view.h | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/gtk2_ardour/midi_cue_view.cc b/gtk2_ardour/midi_cue_view.cc index 51300ad131..c8f24409b5 100644 --- a/gtk2_ardour/midi_cue_view.cc +++ b/gtk2_ardour/midi_cue_view.cc @@ -54,6 +54,8 @@ MidiCueView::MidiCueView (std::shared_ptr mt, { CANVAS_DEBUG_NAME (_note_group, X_("note group for MIDI cue")); + _needs_active_notes_for_rec_enabled_track = true; + /* Containers don't get canvas events, so we need an invisible rect * that will. It will be resized as needed sothat it always covers the * entire canvas/view. diff --git a/gtk2_ardour/midi_view.cc b/gtk2_ardour/midi_view.cc index 940ceb7794..4a199f3365 100644 --- a/gtk2_ardour/midi_view.cc +++ b/gtk2_ardour/midi_view.cc @@ -113,13 +113,14 @@ MidiView::MidiView (std::shared_ptr mt, uint32_t basic_color) : _editing_context (ec) , _midi_context (bg) - , _active_notes (0) + , _active_notes (nullptr) , _note_group (new ArdourCanvas::Container (&parent)) , _note_diff_command (nullptr) , _ghost_note(0) , _step_edit_cursor (0) , _step_edit_cursor_width (1, 0) , _channel_selection_scoped_note (0) + , _needs_active_notes_for_rec_enabled_track (false) , _mouse_state(None) , _pressed_button(0) , _optimization_iterator (_events.end()) @@ -139,19 +140,19 @@ MidiView::MidiView (std::shared_ptr mt, init (mt); } - MidiView::MidiView (MidiView const & other) : sigc::trackable (other) , _editing_context (other.editing_context()) , _midi_context (other.midi_context()) , _midi_region (other.midi_region()) - , _active_notes(0) + , _active_notes (nullptr) , _note_group (new ArdourCanvas::Container (other._note_group->parent())) , _note_diff_command (0) , _ghost_note(0) , _step_edit_cursor (0) , _step_edit_cursor_width (1, 0) , _channel_selection_scoped_note (0) + , _needs_active_notes_for_rec_enabled_track (false) , _mouse_state(None) , _pressed_button(0) , _optimization_iterator (_events.end()) @@ -193,7 +194,7 @@ 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 (_midi_track->triggerbox()->record_enabled()) { + if (_needs_active_notes_for_rec_enabled_track && _midi_track->triggerbox()->record_enabled()) { begin_write (); } else { end_write (); diff --git a/gtk2_ardour/midi_view.h b/gtk2_ardour/midi_view.h index 0e0a90fa59..4d22bdbfee 100644 --- a/gtk2_ardour/midi_view.h +++ b/gtk2_ardour/midi_view.h @@ -503,7 +503,7 @@ class MidiView : public virtual sigc::trackable, public LineMerger Temporal::Beats _step_edit_cursor_width; Temporal::Beats _step_edit_cursor_position; NoteBase* _channel_selection_scoped_note; - + bool _needs_active_notes_for_rec_enabled_track; MouseState _mouse_state; int _pressed_button;