add "fade range" operation, bound to alt-f at present by default
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 10 Jul 2014 12:17:22 +0000 (08:17 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 10 Jul 2014 12:17:22 +0000 (08:17 -0400)
gtk2_ardour/editor.h
gtk2_ardour/editor_actions.cc
gtk2_ardour/editor_ops.cc
gtk2_ardour/mnemonic-us.bindings.in
gtk2_ardour/route_time_axis.cc
gtk2_ardour/route_time_axis.h
gtk2_ardour/time_axis_view.h

index 3c9d4f38ac047b6dcc8fadfec21b0cd9067e95bf..d96ac0c8f633eecbe227b1c95de2f6a03efe2daf 100644 (file)
@@ -1385,6 +1385,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void set_fade_in_active (bool);
        void set_fade_out_active (bool);
 
+       void fade_range ();
+
        std::set<boost::shared_ptr<ARDOUR::Playlist> > motion_frozen_playlists;
 
        bool _dragging_playhead;
index 31f368684bf052781b40a3e0533ddbbf875ec1fd..7e37b02a080ba5ae8ea1a829d3fd1b6ee1986b5c 100644 (file)
@@ -336,6 +336,8 @@ Editor::register_actions ()
        reg_sens (editor_actions, "editor-copy", _("Copy"), sigc::mem_fun(*this, &Editor::copy));
        reg_sens (editor_actions, "editor-paste", _("Paste"), sigc::mem_fun(*this, &Editor::keyboard_paste));
 
+       reg_sens (editor_actions, "editor-fade-range", _("Fade Range Selection"), sigc::mem_fun(*this, &Editor::fade_range));
+
        reg_sens (editor_actions, "set-tempo-from-edit-range", _("Set Tempo from Edit Range = Bar"), sigc::mem_fun(*this, &Editor::use_range_as_bar));
 
        toggle_reg_sens (editor_actions, "toggle-log-window", _("Log"),
index a2f8048fec8931a09b8efd994326aa1d3c27981d..eb5b22ee62d7168fccb3764793bcfb55742614ce 100644 (file)
@@ -5260,6 +5260,22 @@ Editor::toggle_solo_isolate ()
 {
 }
 
+
+void
+Editor::fade_range ()
+{
+       TrackViewList ts = selection->tracks.filter_to_unique_playlists ();
+
+       begin_reversible_command (_("fade range"));
+
+       for (TrackViewList::iterator i = ts.begin(); i != ts.end(); ++i) {
+               (*i)->fade_range (selection->time);
+       }
+
+       commit_reversible_command ();
+}
+
+
 void
 Editor::set_fade_length (bool in)
 {
index 035912810de32c96f8652e3232e32673e298f8d8..b5948bede470b07b127b63f7fd4b73cbfe4b2a4c 100644 (file)
@@ -190,6 +190,7 @@ This mode provides many different operations on both regions and control points,
 @select|Editor/select-all-in-punch-range|<@PRIMARY@>d|select all in punch range
 @vis|Editor/fit-tracks|f|fit tracks vertically
 @trans|Editor/toggle-follow-playhead|<@PRIMARY@>f|toggle playhead tracking
+@trans|Editor/editor-fade-range|<@SECONDARY@>f|fade range selection
 @trans|Transport/ToggleFollowEdits|<@TERTIARY@>f|toggle playhead follows edits
 @wvis|Common/ToggleMaximalEditor|<@PRIMARY@><@SECONDARY@>f|maximise editor space
 @wvis|Common/ToggleMaximalMixer|F12|maximise mixer space
index 77fb0815bcd537a5115fb33d1f7c135a7a979914..36b2cdb2e97eaacf38642b90f5a795fa734399b5 100644 (file)
@@ -1384,6 +1384,41 @@ RouteTimeAxisView::find_next_region_boundary (framepos_t pos, int32_t dir)
        return -1;
 }
 
+void
+RouteTimeAxisView::fade_range (TimeSelection& selection)
+{
+       boost::shared_ptr<Playlist> what_we_got;
+       boost::shared_ptr<Track> tr = track ();
+       boost::shared_ptr<Playlist> playlist;
+
+       if (tr == 0) {
+               /* route is a bus, not a track */
+               return;
+       }
+
+       playlist = tr->playlist();
+
+       TimeSelection time (selection);
+       float const speed = tr->speed();
+       if (speed != 1.0f) {
+               for (TimeSelection::iterator i = time.begin(); i != time.end(); ++i) {
+                       (*i).start = session_frame_to_track_frame((*i).start, speed);
+                       (*i).end   = session_frame_to_track_frame((*i).end,   speed);
+               }
+       }
+
+        playlist->clear_changes ();
+        playlist->clear_owned_changes ();
+
+       playlist->fade_range (time);
+
+       vector<Command*> cmds;
+       playlist->rdiff (cmds);
+       _session->add_commands (cmds);
+       _session->add_command (new StatefulDiffCommand (playlist));
+
+}
+
 void
 RouteTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op)
 {
index f56b747a8f9943dbb35a05e7f5455f7090eb33c2..cfc71d89fac49bd2f7d0179f908532e61cb5e7aa 100644 (file)
@@ -104,6 +104,7 @@ public:
        void uncombine_regions ();
        void uncombine_region (RegionView*);
        void toggle_automation_track (const Evoral::Parameter& param);
+       void fade_range (TimeSelection&);
 
        /* The editor calls these when mapping an operation across multiple tracks */
        void use_new_playlist (bool prompt, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
index 4c183ddc6a6f0a84d842cb49650799c445f883ec..c2c7f7db53cd00ea4ddd8a11ceb8fd299ca0e46d 100644 (file)
@@ -167,6 +167,8 @@ class TimeAxisView : public virtual AxisView
        virtual void set_selected_regionviews (RegionSelection&) {}
        virtual void set_selected_points (PointSelection&) {}
 
+       virtual void fade_range (TimeSelection&) {}
+
        virtual boost::shared_ptr<ARDOUR::Region> find_next_region (framepos_t /*pos*/, ARDOUR::RegionPoint, int32_t /*dir*/) {
                return boost::shared_ptr<ARDOUR::Region> ();
        }