Fix merge regression: use TempoLines class instead of same built in to editor.
[ardour.git] / libs / ardour / session_process.cc
index 40a70c686202546b3d2c6368e636d6c29bb6acbc..abe802548ad6e55846b2085f02f18c18a5a2ba87 100644 (file)
@@ -335,7 +335,9 @@ Session::process_with_events (nframes_t nframes)
                        return;
                }
        
-               send_midi_time_code_for_cycle(nframes);
+               if (!_exporting) {
+                       send_midi_time_code_for_cycle (nframes);
+               }
 
                if (actively_recording()) {
                        stop_limit = max_frames;
@@ -754,8 +756,6 @@ Session::process_without_events (nframes_t nframes)
                if (!follow_slave (nframes, 0)) {
                        return;
                }
-       
-               send_midi_time_code_for_cycle(nframes);
        } 
 
        if (_transport_speed == 0) {
@@ -763,6 +763,10 @@ Session::process_without_events (nframes_t nframes)
                return;
        }
                
+       if (!_exporting) {
+               send_midi_time_code_for_cycle (nframes);
+       }
+
        if (actively_recording()) {
                stop_limit = max_frames;
        } else {
@@ -863,18 +867,38 @@ Session::maybe_sync_start (nframes_t& nframes, nframes_t& offset)
 
        if (_engine.get_sync_offset (sync_offset) && sync_offset < nframes) {
 
+               /* generate silence up to the sync point, then
+                  adjust nframes + offset to reflect whatever
+                  is left to do.
+               */
+
                no_roll (sync_offset, 0);
                nframes -= sync_offset;
                offset += sync_offset;
                waiting_for_sync_offset = false;
                
                if (nframes == 0) {
-                       return true; // done
+                       return true; // done, nothing left to process
                }
                
        } else {
+
+               /* sync offset point is not within this process()
+                  cycle, so just generate silence. and don't bother 
+                  with any fancy stuff here, just the minimal silence.
+               */
+
+               g_atomic_int_inc (&processing_prohibited);
                no_roll (nframes, 0);
-               return true; // done
+               g_atomic_int_dec_and_test (&processing_prohibited);
+
+               if (Config->get_locate_while_waiting_for_sync()) {
+                       if (micro_locate (nframes)) {
+                               /* XXX ERROR !!! XXX */
+                       }
+               }
+
+               return true; // done, nothing left to process
        }
 
        return false;