From c7192b4cc0ace2aacee0e6c25121387b50413959 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 24 Oct 2024 11:44:36 -0600 Subject: [PATCH] add the concept of a length that is data-independent to MIDI files (GUI) --- gtk2_ardour/editing_context.cc | 3 +++ gtk2_ardour/midi_cue_editor.cc | 7 +++---- gtk2_ardour/midi_cue_editor.h | 5 +++-- gtk2_ardour/midi_view.cc | 4 ++-- gtk2_ardour/midi_view.h | 2 +- gtk2_ardour/trigger_ui.cc | 1 - 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/gtk2_ardour/editing_context.cc b/gtk2_ardour/editing_context.cc index 8b0846d09e..95abbd1539 100644 --- a/gtk2_ardour/editing_context.cc +++ b/gtk2_ardour/editing_context.cc @@ -2451,6 +2451,9 @@ EditingContext::reset_zoom (samplecnt_t spp) pending_visual_change.add (VisualChange::ZoomLevel); pending_visual_change.samples_per_pixel = spp; + if (spp == 0.0) { + PBD::stacktrace (std::cerr, 12); + } ensure_visual_change_idle_handler (); } diff --git a/gtk2_ardour/midi_cue_editor.cc b/gtk2_ardour/midi_cue_editor.cc index 158472fc1f..849fc962f8 100644 --- a/gtk2_ardour/midi_cue_editor.cc +++ b/gtk2_ardour/midi_cue_editor.cc @@ -466,7 +466,7 @@ MidiCueEditor::toolbox () } void -MidiCueEditor::data_captured (timecnt_t total_duration) +MidiCueEditor::data_captured (samplecnt_t total_duration) { data_capture_duration = total_duration; @@ -474,14 +474,13 @@ MidiCueEditor::data_captured (timecnt_t total_duration) Glib::signal_idle().connect (sigc::mem_fun (*this, &MidiCueEditor::idle_data_captured)); } - samplepos_t pos = data_capture_duration.end().samples(); - _playhead_cursor->set_position (pos); + _playhead_cursor->set_position (data_capture_duration); } bool MidiCueEditor::idle_data_captured () { - double where = duration_to_pixels (data_capture_duration); + double where = sample_to_pixel_unrounded (data_capture_duration); if (where > _visible_canvas_width * 0.80) { set_samples_per_pixel (samples_per_pixel * 1.5); diff --git a/gtk2_ardour/midi_cue_editor.h b/gtk2_ardour/midi_cue_editor.h index b77e4da53e..51ce9740de 100644 --- a/gtk2_ardour/midi_cue_editor.h +++ b/gtk2_ardour/midi_cue_editor.h @@ -217,10 +217,11 @@ class MidiCueEditor : public CueEditor void visual_changer (const VisualChange&); void bindings_changed (); - void data_captured (Temporal::timecnt_t); + void data_captured (samplecnt_t); bool idle_data_captured (); std::atomic idle_update_queued; - Temporal::timecnt_t data_capture_duration; + PBD::ScopedConnectionList capture_connections; + samplecnt_t data_capture_duration; }; diff --git a/gtk2_ardour/midi_view.cc b/gtk2_ardour/midi_view.cc index 5e0329a57d..940ceb7794 100644 --- a/gtk2_ardour/midi_view.cc +++ b/gtk2_ardour/midi_view.cc @@ -4498,7 +4498,7 @@ MidiView::set_step_edit_cursor_width (Temporal::Beats beats) } void -MidiView::clip_data_recorded (timecnt_t const & total_duration) +MidiView::clip_data_recorded (samplecnt_t total_duration) { if (!_midi_track) { return; @@ -4573,7 +4573,7 @@ MidiView::clip_data_recorded (timecnt_t const & total_duration) } } - active_note_end = total_duration; + active_note_end = timecnt_t (total_duration); } /** Called when a diskstream on our track has received some data. Update the view, if applicable. diff --git a/gtk2_ardour/midi_view.h b/gtk2_ardour/midi_view.h index 843510f199..0e0a90fa59 100644 --- a/gtk2_ardour/midi_view.h +++ b/gtk2_ardour/midi_view.h @@ -341,7 +341,7 @@ class MidiView : public virtual sigc::trackable, public LineMerger EditingContext& editing_context() const { return _editing_context; } MidiViewBackground& midi_context() const { return _midi_context; } - void clip_data_recorded (Temporal::timecnt_t const &); + void clip_data_recorded (samplecnt_t); virtual void select_self (bool add) {} virtual void unselect_self () {} diff --git a/gtk2_ardour/trigger_ui.cc b/gtk2_ardour/trigger_ui.cc index a58a4a9ee3..4726b8a44b 100644 --- a/gtk2_ardour/trigger_ui.cc +++ b/gtk2_ardour/trigger_ui.cc @@ -797,7 +797,6 @@ TriggerUI::trigger_changed (PropertyChange const& what) on_trigger_changed(what); } - void TriggerUI::set_trigger (ARDOUR::TriggerReference tr) {