From 90ad837c906cecebb4050de24be75c713a3d4675 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 14 Sep 2010 23:15:43 +0000 Subject: Tidy up PeaksReady locking slightly and emit it during done_with_peakfile_writes. Fixes some non-appearing peaks after record. git-svn-id: svn://localhost/ardour2/branches/3.0@7776 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/audiosource.cc | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'libs/ardour/audiosource.cc') diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc index 9af388c1cd..360e4cd48a 100644 --- a/libs/ardour/audiosource.cc +++ b/libs/ardour/audiosource.cc @@ -165,10 +165,6 @@ AudioSource::peaks_ready (boost::function doThisWhenReady, ScopedConnect bool ret; Glib::Mutex::Lock lm (_peaks_ready_lock); - /* check to see if the peak data is ready. if not - connect the slot while still holding the lock. - */ - if (!(ret = _peaks_built)) { *connect_here_if_not = new ScopedConnection; PeaksReady.connect (**connect_here_if_not, MISSING_INVALIDATOR, doThisWhenReady, event_loop); @@ -683,13 +679,7 @@ AudioSource::build_peaks_from_scratch () } done_with_peakfile_writes ((cnt == 0)); - } - - { - Glib::Mutex::Lock lm (_peaks_ready_lock); - - if (_peaks_built) { - PeaksReady (); /* EMIT SIGNAL */ + if (cnt == 0) { ret = 0; } } @@ -723,7 +713,9 @@ AudioSource::done_with_peakfile_writes (bool done) } if (done) { + Glib::Mutex::Lock lm (_peaks_ready_lock); _peaks_built = true; + PeaksReady (); /* EMIT SIGNAL */ } delete _peakfile_descriptor; @@ -955,3 +947,13 @@ AudioSource::dec_read_data_count (nframes_t cnt) _read_data_count = 0; } } + +void +AudioSource::mark_streaming_write_completed () +{ + Glib::Mutex::Lock lm (_peaks_ready_lock); + + if (_peaks_built) { + PeaksReady (); /* EMIT SIGNAL */ + } +} -- cgit v1.2.3