void
Session::process (nframes_t nframes)
{
+ // This is no more the appriopriate place to call cycle
+ // start. cycle_start needs to be called at the Route::roll()
+ // where the signals which we want to mixdown have been calculated.
+ //
MIDI::Manager::instance()->cycle_start(nframes);
- if (synced_to_jack() && waiting_to_start) {
- if ( _engine.transport_state() == AudioEngine::TransportRolling) {
- actually_start_transport ();
- }
- }
+ _silent = false;
if (non_realtime_work_pending()) {
if (!transport_work_requested ()) {
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
- if ((*i)->hidden()) {
+ if ((*i)->is_hidden()) {
continue;
}
int ret;
- if ((*i)->hidden()) {
+ if ((*i)->is_hidden()) {
continue;
}
int ret;
- if ((*i)->hidden()) {
+ if ((*i)->is_hidden()) {
continue;
}
nframes_t this_nframes;
nframes_t end_frame;
nframes_t offset;
+ bool session_needs_butler = false;
nframes_t stop_limit;
long frames_moved;
- bool session_needs_butler = false;
-
+
/* make sure the auditioner is silent */
if (auditioner) {
}
if (!process_can_proceed()) {
- no_roll (nframes, 0);
+ _silent = true;
return;
}
Event* this_event;
Events::iterator the_next_one;
- if (post_transport_work & (PostTransportLocate|PostTransportStop)) {
- no_roll (nframes, 0);
+ if (!process_can_proceed()) {
+ _silent = true;
return;
}
return;
}
- send_midi_time_code_for_cycle(nframes);
+ if (!_exporting) {
+ send_midi_time_code_for_cycle (nframes);
+ }
if (actively_recording()) {
stop_limit = max_frames;
<< endl;
#endif
- if (Config->get_timecode_source_is_synced()) {
+ if (_slave->is_always_synced() || Config->get_timecode_source_is_synced()) {
/* if the TC source is synced, then we assume that its
speed is binary: 0.0 or 1.0
slave_state = Stopped;
}
- if (slave_state == Running && !Config->get_timecode_source_is_synced()) {
+ if (slave_state == Running && !_slave->is_always_synced() && !Config->get_timecode_source_is_synced()) {
if (_transport_speed != 0.0f) {
long frames_moved;
nframes_t offset = 0;
- {
- if (post_transport_work & (PostTransportLocate|PostTransportStop)) {
- no_roll (nframes, 0);
- return;
- }
-
- if (!_exporting && _slave) {
- if (!follow_slave (nframes, 0)) {
- return;
- }
- }
+ if (!process_can_proceed()) {
+ _silent = true;
+ return;
+ }
- if (_transport_speed == 0) {
- no_roll (nframes, 0);
+ if (!_exporting && _slave) {
+ if (!follow_slave (nframes, 0)) {
return;
}
-
- send_midi_time_code_for_cycle(nframes);
+ }
+
+ if (_transport_speed == 0) {
+ no_roll (nframes, 0);
+ return;
+ }
- if (actively_recording()) {
- stop_limit = max_frames;
+ if (!_exporting) {
+ send_midi_time_code_for_cycle (nframes);
+ }
+
+ if (actively_recording()) {
+ stop_limit = max_frames;
+ } else {
+ if (Config->get_stop_at_session_end()) {
+ stop_limit = current_end_frame();
} else {
- if (Config->get_stop_at_session_end()) {
- stop_limit = current_end_frame();
- } else {
- stop_limit = max_frames;
- }
+ stop_limit = max_frames;
}
+ }
- if (maybe_stop (stop_limit)) {
- no_roll (nframes, 0);
- return;
- }
+ if (maybe_stop (stop_limit)) {
+ no_roll (nframes, 0);
+ return;
+ }
- if (maybe_sync_start (nframes, offset)) {
- return;
- }
+ if (maybe_sync_start (nframes, offset)) {
+ return;
+ }
- click (_transport_frame, nframes, offset);
+ click (_transport_frame, nframes, offset);
- prepare_diskstreams ();
+ prepare_diskstreams ();
- frames_moved = (long) floor (_transport_speed * nframes);
+ frames_moved = (long) floor (_transport_speed * nframes);
- if (process_routes (nframes, offset)) {
- no_roll (nframes, offset);
- return;
- }
-
- commit_diskstreams (nframes, session_needs_butler);
+ if (process_routes (nframes, offset)) {
+ no_roll (nframes, offset);
+ return;
+ }
- if (frames_moved < 0) {
- decrement_transport_position (-frames_moved);
- } else {
- increment_transport_position (frames_moved);
- }
+ commit_diskstreams (nframes, session_needs_butler);
- maybe_stop (stop_limit);
- check_declick_out ();
+ if (frames_moved < 0) {
+ decrement_transport_position (-frames_moved);
+ } else {
+ increment_transport_position (frames_moved);
+ }
- } /* implicit release of route lock */
+ maybe_stop (stop_limit);
+ check_declick_out ();
if (session_needs_butler)
summon_butler ();
boost::shared_ptr<RouteList> r = routes.reader ();
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
- if (!(*i)->hidden()) {
+ if (!(*i)->is_hidden()) {
(*i)->silence (nframes, 0);
}
}
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;