more loop/transport fixups; make visible PH track transport frame as an experiment...
authorPaul Davis <paul@linuxaudiosystems.com>
Fri, 30 Oct 2009 14:38:55 +0000 (14:38 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Fri, 30 Oct 2009 14:38:55 +0000 (14:38 +0000)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@5977 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/ardour_ui.cc
gtk2_ardour/editor_mixer.cc
libs/ardour/session.cc
libs/ardour/session_transport.cc

index 41f4fbcec232184f96c1f3f5839fd31a804ae312..b4b54fa70d0e1b06b62a327076788a6cc61d3702 100644 (file)
@@ -1470,21 +1470,14 @@ ARDOUR_UI::transport_roll ()
        }
 
        bool rolling = session->transport_rolling();
-       bool relocate = true;
 
        if (session->get_play_loop()) {
                session->request_play_loop (false, true);
-               relocate = false;
        } else if (session->get_play_range ()) {
                session->request_play_range (false, true);
-               relocate = false;
        } 
 
-       if (rolling) {
-               if (relocate) {
-                       session->request_locate (session->last_transport_start(), true);
-               }
-       } else {
+       if (!rolling) {
                session->request_transport_speed (1.0f);
        }
 
@@ -1529,10 +1522,6 @@ ARDOUR_UI::toggle_roll (bool with_abort)
 
        if (affect_transport) {
 
-               if (rolling) {
-                       session->request_locate (session->last_transport_start(), true);
-               }
-               
                if (rolling) {
                        session->request_stop (with_abort);
                } else {
index a7d9a701a65ab53edd0f4df056117f342d38888c..6d2a882091909a0e32986b2cfc9e71995589cfd6 100644 (file)
@@ -216,7 +216,8 @@ Editor::update_current_screen ()
 
                nframes64_t frame;
 
-               frame = session->audible_frame();
+               //frame = session->audible_frame();
+               frame = session->transport_frame ();
 
                if (_dragging_playhead) {
                        goto almost_done;
index 6b5256e1a51e1fa1dae781bb2e34f6d9adb3fec3..c2141e62e630f39a64a39c4ba18220c4a069aa39 100644 (file)
@@ -1108,9 +1108,9 @@ Session::auto_loop_changed (Location* location)
 
        if (transport_rolling() && play_loop) {
 
-               //if (_transport_frame < location->start() || _transport_frame > location->end()) {
+               // if (_transport_frame > location->end()) {
 
-               if (_transport_frame > location->end()) {
+               if (_transport_frame < location->start() || _transport_frame > location->end()) {
                        // relocate to beginning of loop
                        clear_events (Event::LocateRoll);
                        
index 640184ae790d6a2405dc87894f205fd14957f3a0..f1464014ad019c5fa2bbd6fbfeefcc7b01569235 100644 (file)
@@ -389,63 +389,77 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
                        bool do_locate = false;
 
                        if (_requested_return_frame >= 0) {
+
+                               /* explicit return request pre-queued in event list. overrides everything else */
+                               
+                               cerr << "explicit auto-return to " << _requested_return_frame << endl;
+
                                _transport_frame = _requested_return_frame;
-                               _requested_return_frame = -1;
                                do_locate = true;
+
                        } else {
-                               if (play_loop && !synced_to_jack()) {
-                                       Location *location = _locations.auto_loop_location();
-                                       
-                                       if (location != 0) {
-                                               _transport_frame = location->start();
-                                               do_locate = true;
+                               if (Config->get_auto_return()) {
+
+                                       if (play_loop) {
+
+                                               /* don't try to handle loop play when synced to JACK */
+
+                                               if (!synced_to_jack()) {
+
+                                                       Location *location = _locations.auto_loop_location();
+                                                       
+                                                       if (location != 0) {
+                                                               _transport_frame = location->start();
+                                                       } else {
+                                                               _transport_frame = _last_roll_location;
+                                                       }
+                                                       do_locate = true;
+                                               }
+
+                                       } else if (_play_range) {
+
+                                               /* return to start of range */
+
+                                               if (!current_audio_range.empty()) {
+                                                       _transport_frame = current_audio_range.front().start;
+                                                       do_locate = true;
+                                               }
+
                                        } else {
-                                               _transport_frame = last_stop_frame;
+                                               
+                                               /* regular auto-return */
+                                               
+                                               _transport_frame = _last_roll_location;
+                                               do_locate = true;
                                        }
-                               } else {
-                                       _transport_frame = last_stop_frame;
-                               }
-                               _requested_return_frame = -1;
+                               } 
                        }
 
-                       if (synced_to_jack() && !play_loop) {
-                               do_locate = true;
-                       }
-                       
+                       _requested_return_frame = -1;                   
+
                        if (do_locate) {
-                               // cerr << "non-realtimestop: transport locate to " << _transport_frame << endl;
                                _engine.transport_locate (_transport_frame);
                        }
                } 
 
-#ifndef LEAVE_TRANSPORT_UNADJUSTED
        }
-#endif
 
-               for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-                       if (!(*i)->hidden()) {
-                               if ((*i)->speed() != 1.0f || (*i)->speed() != -1.0f) {
-                                       (*i)->seek ((nframes_t) (_transport_frame * (double) (*i)->speed()));
-                               }
-                               else {
-                                       (*i)->seek (_transport_frame);
-                               }
+       /* this for() block can be put inside the previous if() and has the effect of ... ??? what */
+
+       for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
+               if (!(*i)->hidden()) {
+                       if ((*i)->speed() != 1.0f || (*i)->speed() != -1.0f) {
+                               (*i)->seek ((nframes_t) (_transport_frame * (double) (*i)->speed()));
                        }
-                       if (on_entry != g_atomic_int_get (&butler_should_do_transport_work)) {
-                               finished = false;
-                               /* we will be back */
-                               return;
+                       else {
+                               (*i)->seek (_transport_frame);
                        }
                }
-#ifdef LEAVE_TRANSPORT_UNADJUSTED
-       }
-#endif
-
-        if (_requested_return_frame < 0) {
-               last_stop_frame = _transport_frame;
-       } else {
-               last_stop_frame = _requested_return_frame;
-               _requested_return_frame = -1;
+               if (on_entry != g_atomic_int_get (&butler_should_do_transport_work)) {
+                       finished = false;
+                       /* we will be back */
+                       return;
+               }
        }
 
         have_looped = false;