fixes from 2.X for latency/capture alignment stuff: don't reverse route list, update latency and capture offsets at transport stop; remove some debugging output
git-svn-id: svn://localhost/ardour2/branches/3.0@10110 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
3314322c7e
commit
4da9b2caac
@ -205,6 +205,8 @@ public:
|
||||
|
||||
int reset_timebase ();
|
||||
|
||||
void update_latencies ();
|
||||
|
||||
/* start/stop freewheeling */
|
||||
|
||||
int freewheel (bool onoff);
|
||||
|
@ -904,6 +904,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
|
||||
bool _writable;
|
||||
bool _was_seamless;
|
||||
|
||||
void initialize_latencies ();
|
||||
void set_worst_io_latencies ();
|
||||
void set_worst_playback_latency ();
|
||||
void set_worst_capture_latency ();
|
||||
|
@ -491,21 +491,9 @@ AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool ca
|
||||
assert(ap);
|
||||
assert(rec_nframes <= (framecnt_t) ap->get_audio_buffer(nframes).capacity());
|
||||
|
||||
Sample *bbuf = ap->get_audio_buffer (nframes).data(rec_offset);
|
||||
|
||||
|
||||
for (jack_nframes_t _xx = 0; _xx != rec_nframes; ++_xx) {
|
||||
if (bbuf[_xx] != 0.0) {
|
||||
cerr << name() << " @ " << transport_frame << " + " << _xx << " = " << bbuf[_xx]
|
||||
<< endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Sample *bbuf = ap->get_audio_buffer (nframes).data (rec_offset);
|
||||
memcpy (chaninfo->current_capture_buffer, bbuf, sizeof (Sample) * rec_nframes);
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
framecnt_t total = chaninfo->capture_vector.len[0] + chaninfo->capture_vector.len[1];
|
||||
|
@ -1522,3 +1522,12 @@ AudioEngine::ensure_monitor_input (const std::string& portname, bool yn) const
|
||||
|
||||
jack_port_request_monitor (port, yn);
|
||||
}
|
||||
|
||||
void
|
||||
AudioEngine::update_latencies ()
|
||||
{
|
||||
if (jack_recompute_total_latencies) {
|
||||
GET_PRIVATE_JACK_POINTER (_jack);
|
||||
jack_recompute_total_latencies (_priv_jack);
|
||||
}
|
||||
}
|
||||
|
@ -346,7 +346,7 @@ Session::when_engine_running ()
|
||||
|
||||
/* every time we reconnect, recompute worst case output latencies */
|
||||
|
||||
_engine.Running.connect_same_thread (*this, boost::bind (&Session::set_worst_io_latencies, this));
|
||||
_engine.Running.connect_same_thread (*this, boost::bind (&Session::initialize_latencies, this));
|
||||
|
||||
if (synced_to_jack()) {
|
||||
_engine.transport_stop ();
|
||||
@ -640,12 +640,14 @@ Session::when_engine_running ()
|
||||
|
||||
_state_of_the_state = StateOfTheState (_state_of_the_state & ~(CannotSave|Dirty));
|
||||
|
||||
/* update latencies */
|
||||
|
||||
initialize_latencies ();
|
||||
|
||||
/* hook us up to the engine */
|
||||
|
||||
BootMessage (_("Connect to engine"));
|
||||
_engine.set_session (this);
|
||||
|
||||
update_latency_compensation (true);
|
||||
}
|
||||
|
||||
void
|
||||
@ -685,8 +687,6 @@ Session::hookup_io ()
|
||||
|
||||
/* Tell all IO objects to connect themselves together */
|
||||
|
||||
cerr << "Enable IO connections, state = " << _state_of_the_state << endl;
|
||||
|
||||
IO::enable_connecting ();
|
||||
MIDI::Port::MakeConnections ();
|
||||
|
||||
@ -4337,8 +4337,9 @@ Session::update_latency (bool playback)
|
||||
|
||||
if (playback) {
|
||||
/* reverse the list so that we work backwards from the last route to run to the first */
|
||||
RouteList* rl = routes.reader().get();
|
||||
r.reset (new RouteList (*rl));
|
||||
reverse (r->begin(), r->end());
|
||||
cerr << "\n!!! I JUST REVERSED THE ROUTE LIST (" << r->size() << ")!!!\n\n";
|
||||
}
|
||||
|
||||
/* compute actual latency values for the given direction and store them all in per-port
|
||||
@ -4410,6 +4411,18 @@ Session::post_capture_latency ()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Session::initialize_latencies ()
|
||||
{
|
||||
{
|
||||
Glib::Mutex::Lock lm (_engine.process_lock());
|
||||
update_latency (false);
|
||||
update_latency (true);
|
||||
}
|
||||
|
||||
set_worst_io_latencies ();
|
||||
}
|
||||
|
||||
void
|
||||
Session::set_worst_io_latencies ()
|
||||
{
|
||||
@ -4489,6 +4502,19 @@ Session::update_latency_compensation (bool force_whole_graph)
|
||||
DEBUG_TRACE (DEBUG::Latency, string_compose ("worst signal processing latency: %1 (changed ? %2)\n", _worst_track_latency,
|
||||
(some_track_latency_changed ? "yes" : "no")));
|
||||
|
||||
DEBUG_TRACE(DEBUG::Latency, "---------------------------- DONE update latency compensation\n\n")
|
||||
DEBUG_TRACE(DEBUG::Latency, "---------------------------- DONE update latency compensation\n\n");
|
||||
|
||||
if (some_track_latency_changed || force_whole_graph) {
|
||||
_engine.update_latencies ();
|
||||
}
|
||||
|
||||
|
||||
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
|
||||
boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
|
||||
if (!tr) {
|
||||
continue;
|
||||
}
|
||||
tr->set_capture_offset ();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user