View Issue Details

IDProjectCategoryView StatusLast Update
0008903ardourfeaturespublic2022-07-11 21:41
Reportercolinf Assigned To 
PrioritynormalSeverityminorReproducibilityN/A
Status newResolutionopen 
Summary0008903: Allow creation of source markers in regions currently being recorded
DescriptionI quite often want to place markers whilst recording to note something or other - it'd be nice if those markers could be source markers for the regions currently being recorded.

Unfortunately, the regions currently being recorded don't actually exist as regions until recording is stopped, so implementing this requires special-casing source marker creation while recording to add the marker location & name to a list that can be applied to the newly-created regions after recording ends.
TagsNo tags attached.

Activities

colinf

2022-07-11 21:41

updater   ~0026501

Patches attached.
0002-gtk2_ardour-set-region-marks-into-currently-recordin.patch (1,670 bytes)   
From f44c37869b946868e77b62f953e75db13dc7a3ee Mon Sep 17 00:00:00 2001
From: Colin Fletcher <colin.m.fletcher@googlemail.com>
Date: Mon, 18 Apr 2022 16:56:36 +0100
Subject: [PATCH 2/2] gtk2_ardour: set region marks into currently recording
 regions

Region actions are generally set insensitive whilst recording, so
special-case the "add-region-cue-marker" action by explicitly enabling it
when starting to roll in record. Additionally, the action becomes disabled
again after it's been executed, so re-enable it after queuing the cue when
recording.
---
 gtk2_ardour/ardour_ui.cc  | 1 +
 gtk2_ardour/editor_ops.cc | 7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index 908b2dfa61..3235b0ac6d 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -1801,6 +1801,7 @@ ARDOUR_UI::transport_record (bool roll)
 			}
 			_session->maybe_enable_record ();
 			if (roll) {
+				ActionManager::get_action (X_("Region"), X_("add-region-cue-marker"))->set_sensitive(true);
 				transport_roll ();
 			}
 			break;
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index 6b7ea0197c..7f564e3297 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -9042,6 +9042,13 @@ Editor::add_region_marker ()
 		return;
 	}
 
+	if (_session->actively_recording ()) {
+		CueMarker mark (str, position);
+		std::cerr << "queuing cue " << str << " at " << position << "\n";
+		_session->pending_source_markers.insert (mark);
+		ActionManager::get_action (X_("Region"), X_("add-region-cue-marker"))->set_sensitive(true);
+		return;
+	}
 
 	bool in_command = false;
 
-- 
2.30.2

0001-libs-ardour-allow-creating-region-source-markers-whi.patch (3,301 bytes)   
From 674961bfe5b6625b158eda669c64165277458ff6 Mon Sep 17 00:00:00 2001
From: Colin Fletcher <colin.m.fletcher@googlemail.com>
Date: Mon, 18 Apr 2022 16:55:54 +0100
Subject: [PATCH 1/2] libs/ardour: allow creating region source markers while
 recording

Add a list of marker locations to the session, for the the UI to add the
current location to when "add-region-cue-marker" happens whilst recording.
On record-stop, create source markers at the locations in that list in all
newly-recorded audio regions.
---
 libs/ardour/ardour/session.h     | 1 +
 libs/ardour/ardour/source.h      | 1 +
 libs/ardour/disk_writer.cc       | 2 +-
 libs/ardour/session_transport.cc | 2 ++
 libs/ardour/source.cc            | 9 +++++++++
 5 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index e62440ca17..8d0faca10f 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -1994,6 +1994,7 @@ public:
 	}
 
 	bool playlist_is_active( boost::shared_ptr<Playlist>);
+	ARDOUR::CueMarkers pending_source_markers; // source markers created while recording
 
 private:
 	void reset_write_sources (bool mark_write_complete, bool force = false);
diff --git a/libs/ardour/ardour/source.h b/libs/ardour/ardour/source.h
index f7dac6932d..c559e2d134 100644
--- a/libs/ardour/ardour/source.h
+++ b/libs/ardour/ardour/source.h
@@ -114,6 +114,7 @@ public:
 	size_t n_captured_xruns () const { return _xruns.size (); }
 	XrunPositions const& captured_xruns () const { return _xruns; }
 	void set_captured_xruns (XrunPositions const& xruns) { _xruns = xruns; }
+	void set_captured_marks (CueMarkers const& marks);
 
 	CueMarkers const & cue_markers() const { return _cue_markers; }
 	bool add_cue_marker (CueMarker const &);
diff --git a/libs/ardour/disk_writer.cc b/libs/ardour/disk_writer.cc
index 03d00d122a..46e42d6109 100644
--- a/libs/ardour/disk_writer.cc
+++ b/libs/ardour/disk_writer.cc
@@ -1244,9 +1244,9 @@ DiskWriter::transport_stopped_wallclock (struct tm& when, time_t twhen, bool abo
 
 		(*chan)->write_source->stamp (twhen);
 		(*chan)->write_source->set_captured_xruns (capture_info.front()->xruns);
+		(*chan)->write_source->set_captured_marks (_session.pending_source_markers);
 	}
 
-
 	/* MIDI */
 
 	if (_midi_write_source) {
diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc
index 15b4ec1462..3119483141 100644
--- a/libs/ardour/session_transport.cc
+++ b/libs/ardour/session_transport.cc
@@ -1384,6 +1384,8 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished, bool will_
 		}
 	}
 
+	pending_source_markers.clear();
+
 	if (abort && did_record) {
 		_state_of_the_state = StateOfTheState (_state_of_the_state & ~InCleanup);
 	}
diff --git a/libs/ardour/source.cc b/libs/ardour/source.cc
index 7bb822363c..3f0e6991df 100644
--- a/libs/ardour/source.cc
+++ b/libs/ardour/source.cc
@@ -468,6 +468,15 @@ Source::writable () const
         return (_flags & Writable) && _session.writable();
 }
 
+void
+Source::set_captured_marks (CueMarkers const &marks)
+{
+	for (auto mark : marks) {
+		std::cerr << "adding " << mark.text() << " at " << mark.position() << "\n";
+		add_cue_marker(mark);
+	}
+}
+
 bool
 Source::add_cue_marker (CueMarker const & cm)
 {
-- 
2.30.2

Issue History

Date Modified Username Field Change
2022-04-22 15:40 colinf New Issue
2022-07-11 21:41 colinf Note Added: 0026501
2022-07-11 21:41 colinf File Added: 0002-gtk2_ardour-set-region-marks-into-currently-recordin.patch
2022-07-11 21:41 colinf File Added: 0001-libs-ardour-allow-creating-region-source-markers-whi.patch