From 0b055ad66eb9c703d976e2be1bc7e6969b1bfdb0 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 29 Jan 2022 20:48:23 +0100 Subject: [PATCH] Add option to copy bounced regions/range to clip library --- gtk2_ardour/editor_export_audio.cc | 13 ++++++++++++- gtk2_ardour/editor_ops.cc | 20 +++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/editor_export_audio.cc b/gtk2_ardour/editor_export_audio.cc index 220849da0e..089a6fcd62 100644 --- a/gtk2_ardour/editor_export_audio.cc +++ b/gtk2_ardour/editor_export_audio.cc @@ -40,6 +40,7 @@ #include "ardour/audioplaylist.h" #include "ardour/audioregion.h" #include "ardour/chan_count.h" +#include "ardour/clip_library.h" #include "ardour/midi_region.h" #include "ardour/session.h" #include "ardour/session_directory.h" @@ -280,6 +281,7 @@ Editor::bounce_region_selection (bool with_processing) /*prompt the user for a new name*/ string bounce_name; + bool copy_to_clip_library = false; { ArdourWidgets::Prompter dialog (true); @@ -289,9 +291,13 @@ Editor::bounce_region_selection (bool with_processing) dialog.set_size_request (400, -1); dialog.set_position (Gtk::WIN_POS_MOUSE); - dialog.add_button (_("Rename"), RESPONSE_ACCEPT); + dialog.add_button (_("Bounce"), RESPONSE_ACCEPT); dialog.set_initial_text (bounce_name); + Gtk::CheckButton cliplib (_("Copy to Clip Libary")); + dialog.get_vbox()->pack_start (cliplib); + cliplib.show (); + Label label; label.set_text (_("Bounced Region will appear in the Source list.")); dialog.get_vbox()->set_spacing (8); @@ -307,6 +313,7 @@ Editor::bounce_region_selection (bool with_processing) return; } dialog.get_result(bounce_name); + copy_to_clip_library = cliplib.get_active (); } for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) { @@ -324,6 +331,10 @@ Editor::bounce_region_selection (bool with_processing) } else { r = track->bounce_range (region->position_sample(), region->position_sample() + region->length_samples(), itt, boost::shared_ptr(), false, bounce_name); } + + if (copy_to_clip_library) { + export_to_clip_library (r); + } } } diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 129f1171e4..f0433bbda1 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -61,6 +61,7 @@ #include "ardour/audio_track.h" #include "ardour/audioregion.h" #include "ardour/boost_debug.h" +#include "ardour/clip_library.h" #include "ardour/dB.h" #include "ardour/location.h" #include "ardour/midi_region.h" @@ -4115,7 +4116,9 @@ Editor::bounce_range_selection (BounceTarget target, bool enable_processing) assert (!(enable_processing && (target == NewTrigger))); - uint32_t trigger_slot = 0; + bool copy_to_clip_library = false; + uint32_t trigger_slot = 0; + string bounce_name; switch (target) { case NewSource: @@ -4154,6 +4157,7 @@ Editor::bounce_range_selection (BounceTarget target, bool enable_processing) { Prompter dialog (true); ArdourDropdown* tslot = 0; + Gtk::CheckButton* cliplib = 0; switch (target) { case NewSource: @@ -4176,6 +4180,12 @@ Editor::bounce_range_selection (BounceTarget target, bool enable_processing) dialog.set_initial_text (bounce_name); + if (target != ReplaceRange) { + cliplib = manage (new Gtk::CheckButton (_("Copy to Clip Libary"))); + dialog.get_vbox()->pack_start (*cliplib); + cliplib->show (); + } + if (target == NewSource) { Label* label = manage (new Label (_("Bounced Range will appear in the Source list."))); dialog.get_vbox()->set_spacing (8); @@ -4211,6 +4221,10 @@ Editor::bounce_range_selection (BounceTarget target, bool enable_processing) } dialog.get_result (bounce_name); + + if (cliplib && cliplib->get_active ()) { + copy_to_clip_library = true; + } } timepos_t start = selection->time[clicked_selection].start(); @@ -4256,6 +4270,10 @@ Editor::bounce_range_selection (BounceTarget target, bool enable_processing) in_command = true; } + if (copy_to_clip_library) { + export_to_clip_library (r); + } + if (target == ReplaceRange) { /*remove the edxisting regions under the edit range*/ list ranges;