add a method to cancel a pending play_range. this is needed when we are modifying...
authorBen Loftis <ben@harrisonconsoles.com>
Wed, 2 Jul 2014 22:34:49 +0000 (17:34 -0500)
committerBen Loftis <ben@harrisonconsoles.com>
Wed, 2 Jul 2014 22:35:38 +0000 (17:35 -0500)
gtk2_ardour/editor_keys.cc
libs/ardour/ardour/session.h
libs/ardour/ardour/session_event.h
libs/ardour/enums.cc
libs/ardour/session_process.cc
libs/ardour/session_transport.cc

index 2900e28c2a48a5fc1235aebc4a1a45f0b4ed86d2..34847bbfe4c3fd8332e03e853b9490c49ac82588 100644 (file)
@@ -63,8 +63,8 @@ Editor::keyboard_selection_finish (bool add)
                selection->set (start, end);
 
                //if session is playing a range, cancel that
-//             if (_session->get_play_range())
-//                     _session->request_cancel_play_range();
+               if (_session->get_play_range())
+                       _session->request_cancel_play_range();
 
        }
 }
@@ -99,61 +99,10 @@ Editor::keyboard_selection_begin ()
 
                //if session is playing a range, cancel that
                if (_session->get_play_range())
-                       _session->request_transport_speed ( 1.0 );
-
-               //if join playhead, locate to the newly selected start
-//             if ( !_session->transport_rolling() && Config->get_join_play_range() )
-//                     _session->request_cancel_play_range();
+                       _session->request_cancel_play_range();
        }
 }
 
-/*
-void
-Editor::keyboard_selection_finish (bool add)
-{
-       if (_session && have_pending_keyboard_selection) {
-
-               framepos_t end;
-               bool ignored;
-
-               if (_session->transport_rolling()) {
-                       end = _session->audible_frame();
-               } else {
-                       if (!mouse_frame (end, ignored)) {
-                               return;
-                       }
-               }
-
-               if (add) {
-                       selection->add (pending_keyboard_selection_start, end);
-               } else {
-                       selection->set (pending_keyboard_selection_start, end);
-               }
-
-               have_pending_keyboard_selection = false;
-       }
-}
-
-void
-Editor::keyboard_selection_begin ()
-{
-       if (_session) {
-               if (_session->transport_rolling()) {
-                       pending_keyboard_selection_start = _session->audible_frame();
-                       have_pending_keyboard_selection = true;
-               } else {
-                       bool ignored;
-                       framepos_t where; // XXX fix me
-
-                       if (mouse_frame (where, ignored)) {
-                               pending_keyboard_selection_start = where;
-                               have_pending_keyboard_selection = true;
-                       }
-
-               }
-       }
-}*/
-
 void
 Editor::keyboard_paste ()
 {
index 03eccd40a32dd45ea29e3758fa94894d339090c6..de2dc6189e0907bf21a2fbde6ec83ab1eaad5190 100644 (file)
@@ -763,6 +763,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
        /* ranges */
 
        void request_play_range (std::list<AudioRange>*, bool leave_rolling = false);
+       void request_cancel_play_range ();
        bool get_play_range () const { return _play_range; }
 
        void maybe_update_session_range (framepos_t, framepos_t);
index 1283f320040eb2ba3c58929bd69e86df51c1f7f7..1772b53c3de4406d08cbfa8869bd8c1b390e9d3f 100644 (file)
@@ -54,6 +54,7 @@ public:
                Audition,
                InputConfigurationChange,
                SetPlayAudioRange,
+               CancelPlayAudioRange,
                RealTimeOperation,
                AdjustPlaybackBuffering,
                AdjustCaptureBuffering,
index 54f1e602be73a297fdb32dc8b318824aac0c4812..9d6d37b5f8d76f871a9ae9f15cb5af87cc3d6af0 100644 (file)
@@ -369,6 +369,7 @@ setup_enum_writer ()
        REGISTER_CLASS_ENUM (SessionEvent, Audition);
        REGISTER_CLASS_ENUM (SessionEvent, InputConfigurationChange);
        REGISTER_CLASS_ENUM (SessionEvent, SetPlayAudioRange);
+       REGISTER_CLASS_ENUM (SessionEvent, CancelPlayAudioRange);
        REGISTER_CLASS_ENUM (SessionEvent, StopOnce);
        REGISTER_CLASS_ENUM (SessionEvent, AutoLoop);
        REGISTER (_SessionEvent_Type);
index 680f2861de2a2bdae8e90515ea89c96ef1fdd0d8..b1e336c373b8342c560459b3ec2fd49e8dd98f7f 100644 (file)
@@ -1142,6 +1142,10 @@ Session::process_event (SessionEvent* ev)
                set_play_range (ev->audio_range, (ev->speed == 1.0f));
                break;
 
+       case SessionEvent::CancelPlayAudioRange:
+               unset_play_range();
+               break;
+
        case SessionEvent::RealTimeOperation:
                process_rtop (ev);
                del = false; // other side of RT request needs to clean up
index 85b36e5a66231a0548f7f99e83358adf9a140f4e..19f86eb2b30a1e3200df00a5a396dce4ce951da7 100644 (file)
@@ -227,6 +227,14 @@ Session::request_play_range (list<AudioRange>* range, bool leave_rolling)
        queue_event (ev);
 }
 
+void
+Session::request_cancel_play_range ()
+{
+       SessionEvent* ev = new SessionEvent (SessionEvent::CancelPlayAudioRange, SessionEvent::Add, SessionEvent::Immediate, 0, 0);
+       queue_event (ev);
+}
+
+
 void
 Session::realtime_stop (bool abort, bool clear_state)
 {