summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-09-21 17:28:13 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-09-21 17:28:13 +0000
commit4da9b2caac6855e2abcb46e992c823dbb8ec8a19 (patch)
tree04723c30a38792ea008c5d73d8324ba48e5799b9 /libs
parent3314322c7e40a089268c3d86a08660ae9cbd30c2 (diff)
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
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/audioengine.h2
-rw-r--r--libs/ardour/ardour/session.h1
-rw-r--r--libs/ardour/audio_diskstream.cc14
-rw-r--r--libs/ardour/audioengine.cc9
-rw-r--r--libs/ardour/session.cc40
5 files changed, 46 insertions, 20 deletions
diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h
index 05ca38e43b..ee2276a3bf 100644
--- a/libs/ardour/ardour/audioengine.h
+++ b/libs/ardour/ardour/audioengine.h
@@ -205,6 +205,8 @@ public:
int reset_timebase ();
+ void update_latencies ();
+
/* start/stop freewheeling */
int freewheel (bool onoff);
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 2dbb2f08ac..e41ea5a625 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -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 ();
diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc
index f64a325138..9ffadfd16b 100644
--- a/libs/ardour/audio_diskstream.cc
+++ b/libs/ardour/audio_diskstream.cc
@@ -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];
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc
index ae71817679..6420b9247d 100644
--- a/libs/ardour/audioengine.cc
+++ b/libs/ardour/audioengine.cc
@@ -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);
+ }
+}
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index d5eb687497..67daaae2f4 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -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
@@ -4411,6 +4412,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 ()
{
set_worst_playback_latency ();
@@ -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 ();
+ }
}