new files from sakari, missed last time
[ardour.git] / libs / ardour / session_process.cc
index 09d85097d09ea981bfda17c6e529190546074810..abe802548ad6e55846b2085f02f18c18a5a2ba87 100644 (file)
@@ -336,7 +336,7 @@ Session::process_with_events (nframes_t nframes)
                }
        
                if (!_exporting) {
-                       send_midi_time_code_for_cycle(nframes);
+                       send_midi_time_code_for_cycle (nframes);
                }
 
                if (actively_recording()) {
@@ -764,7 +764,7 @@ Session::process_without_events (nframes_t nframes)
        }
                
        if (!_exporting) {
-               send_midi_time_code_for_cycle(nframes);
+               send_midi_time_code_for_cycle (nframes);
        }
 
        if (actively_recording()) {
@@ -867,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;