X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fsession_process.cc;h=834280de917c34bfea38918bb76cfff4ea30a8c6;hb=48dd5afaa57b5485297b9583a4124e9f444acd84;hp=882694cccf5ead23a5181b93bbb76a8e3923236f;hpb=c38e02285fda1fd7966c9e4ad85994445247e6a6;p=ardour.git diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc index 882694cccf..834280de91 100644 --- a/libs/ardour/session_process.cc +++ b/libs/ardour/session_process.cc @@ -81,15 +81,6 @@ Session::process (nframes_t nframes) MIDI::Manager::instance()->cycle_end(); } -void -Session::prepare_diskstreams () -{ - boost::shared_ptr dsl = diskstreams.reader(); - for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) { - (*i)->prepare (); - } -} - int Session::fail_roll (nframes_t nframes) { @@ -128,7 +119,7 @@ Session::no_roll (nframes_t nframes) } int -Session::process_routes (nframes_t nframes) +Session::process_routes (nframes_t nframes, bool& need_butler) { bool record_active; int declick = get_transport_declick_required(); @@ -155,18 +146,7 @@ Session::process_routes (nframes_t nframes) (*i)->set_pending_declick (declick); - if ((ret = (*i)->roll (nframes, start_frame, end_frame, declick, record_active, rec_monitors)) < 0) { - - /* we have to do this here. Route::roll() for an AudioTrack will have called AudioDiskstream::process(), - and the DS will expect AudioDiskstream::commit() to be called. but we're aborting from that - call path, so make sure we release any outstanding locks here before we return failure. - */ - - boost::shared_ptr dsl = diskstreams.reader(); - for (DiskstreamList::iterator ids = dsl->begin(); ids != dsl->end(); ++ids) { - (*ids)->recover (); - } - + if ((ret = (*i)->roll (nframes, start_frame, end_frame, declick, record_active, rec_monitors, need_butler)) < 0) { stop_transport (); return -1; } @@ -176,7 +156,7 @@ Session::process_routes (nframes_t nframes) } int -Session::silent_process_routes (nframes_t nframes) +Session::silent_process_routes (nframes_t nframes, bool& need_butler) { bool record_active = actively_recording(); int declick = get_transport_declick_required(); @@ -199,18 +179,7 @@ Session::silent_process_routes (nframes_t nframes) continue; } - if ((ret = (*i)->silent_roll (nframes, start_frame, end_frame, record_active, rec_monitors)) < 0) { - - /* we have to do this here. Route::roll() for an AudioTrack will have called AudioDiskstream::process(), - and the DS will expect AudioDiskstream::commit() to be called. but we're aborting from that - call path, so make sure we release any outstanding locks here before we return failure. - */ - - boost::shared_ptr dsl = diskstreams.reader(); - for (DiskstreamList::iterator ids = dsl->begin(); ids != dsl->end(); ++ids) { - (*ids)->recover (); - } - + if ((ret = (*i)->silent_roll (nframes, start_frame, end_frame, record_active, rec_monitors, need_butler)) < 0) { stop_transport (); return -1; } @@ -220,9 +189,8 @@ Session::silent_process_routes (nframes_t nframes) } void -Session::commit_diskstreams (nframes_t nframes, bool &needs_butler) +Session::get_diskstream_statistics () { - int dret; float pworst = 1.0f; float cworst = 1.0f; @@ -233,21 +201,6 @@ Session::commit_diskstreams (nframes_t nframes, bool &needs_butler) continue; } - /* force all diskstreams not handled by a Route to call do their stuff. - Note: the diskstreams that were handled by a route will just return zero - from this call, because they know they were processed. So in fact, this - also runs commit() for every diskstream. - */ - - if ((dret = (*i)->process (_transport_frame, nframes, actively_recording(), get_rec_monitors_input())) == 0) { - if ((*i)->commit (nframes)) { - needs_butler = true; - } - - } else if (dret < 0) { - (*i)->recover(); - } - pworst = min (pworst, (*i)->playback_buffer_load()); cworst = min (cworst, (*i)->capture_buffer_load()); } @@ -394,16 +347,11 @@ Session::process_with_events (nframes_t nframes) click (_transport_frame, this_nframes); - /* now process frames between now and the first event in this block */ - prepare_diskstreams (); - - if (process_routes (this_nframes)) { + if (process_routes (this_nframes, session_needs_butler)) { fail_roll (nframes); return; } - commit_diskstreams (this_nframes, session_needs_butler); - nframes -= this_nframes; if (frames_moved < 0) { @@ -568,6 +516,7 @@ Session::follow_slave (nframes_t nframes) if (_slave->give_slave_full_control_over_transport_speed()) { set_transport_speed (slave_speed, false, false); + //std::cout << "set speed = " << slave_speed << "\n"; } else { float adjusted_speed = slave_speed + (1.5 * (delta / float(_current_frame_rate))); request_transport_speed (adjusted_speed); @@ -576,10 +525,12 @@ Session::follow_slave (nframes_t nframes) slave_speed)); } - if (abs(average_slave_delta) > _slave->resolution()) { +#if 1 + if ((nframes_t) abs(average_slave_delta) > _slave->resolution()) { cerr << "average slave delta greater than slave resolution (" << _slave->resolution() << "), going to silent motion\n"; goto silent_motion; } +#endif } } @@ -743,9 +694,7 @@ Session::follow_slave_silently (nframes_t nframes, float slave_speed) bool need_butler; - prepare_diskstreams (); - silent_process_routes (nframes); - commit_diskstreams (nframes, need_butler); + silent_process_routes (nframes, need_butler); if (need_butler) { _butler->summon (); @@ -823,8 +772,6 @@ Session::process_without_events (nframes_t nframes) click (_transport_frame, nframes); - prepare_diskstreams (); - if (_transport_speed == 1.0) { frames_moved = (long) nframes; } else { @@ -833,13 +780,11 @@ Session::process_without_events (nframes_t nframes) frames_moved = (long) interpolation.interpolate (0, nframes, 0, 0); } - if (process_routes (nframes)) { + if (process_routes (nframes, session_needs_butler)) { fail_roll (nframes); return; } - commit_diskstreams (nframes, session_needs_butler); - if (frames_moved < 0) { decrement_transport_position (-frames_moved); } else { @@ -875,6 +820,12 @@ Session::process_audition (nframes_t nframes) _butler->summon (); } + /* if using a monitor section, run it because otherwise we don't hear anything */ + + if (auditioner->needs_monitor()) { + _monitor_out->passthru (_transport_frame, _transport_frame + nframes, nframes, false); + } + /* handle pending events */ while (pending_events.read (&ev, 1) == 1) { @@ -892,7 +843,7 @@ Session::process_audition (nframes_t nframes) process_event (ev); } - if (!auditioner->active()) { + if (!auditioner->auditioning()) { /* auditioner no longer active, so go back to the normal process callback */ process_function = &Session::process_with_events; } @@ -1138,9 +1089,3 @@ Session::process_event (SessionEvent* ev) } } -void -Session::process_rtop (SessionEvent* ev) -{ - ev->rt_slot (); - ev->rt_return (ev); -}