summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/ardour/analyser.cc10
-rw-r--r--libs/ardour/ardour/analyser.h6
-rw-r--r--libs/ardour/session.cc2
3 files changed, 16 insertions, 2 deletions
diff --git a/libs/ardour/analyser.cc b/libs/ardour/analyser.cc
index fa22bd757d..58a8f30245 100644
--- a/libs/ardour/analyser.cc
+++ b/libs/ardour/analyser.cc
@@ -31,6 +31,7 @@ using namespace ARDOUR;
using namespace PBD;
Analyser* Analyser::the_analyser = 0;
+Glib::Threads::Mutex Analyser::analysis_active_lock;
Glib::Threads::Mutex Analyser::analysis_queue_lock;
Glib::Threads::Cond Analyser::SourcesToAnalyse;
list<boost::weak_ptr<Source> > Analyser::analysis_queue;
@@ -96,6 +97,7 @@ Analyser::work ()
boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> (src);
if (afs && afs->length(afs->timeline_position())) {
+ Glib::Threads::Mutex::Lock lm (analysis_active_lock);
analyse_audio_file_source (afs);
}
}
@@ -119,3 +121,11 @@ Analyser::analyse_audio_file_source (boost::shared_ptr<AudioFileSource> src)
return;
}
}
+
+void
+Analyser::flush ()
+{
+ Glib::Threads::Mutex::Lock lq (analysis_queue_lock);
+ Glib::Threads::Mutex::Lock la (analysis_active_lock);
+ analysis_queue.clear();
+}
diff --git a/libs/ardour/ardour/analyser.h b/libs/ardour/ardour/analyser.h
index 8e757ef4e9..fec6bd21e3 100644
--- a/libs/ardour/ardour/analyser.h
+++ b/libs/ardour/ardour/analyser.h
@@ -40,11 +40,13 @@ class LIBARDOUR_API Analyser {
static void init ();
static void queue_source_for_analysis (boost::shared_ptr<Source>, bool force);
static void work ();
+ static void flush ();
private:
static Analyser* the_analyser;
- static Glib::Threads::Mutex analysis_queue_lock;
- static Glib::Threads::Cond SourcesToAnalyse;
+ static Glib::Threads::Mutex analysis_active_lock;
+ static Glib::Threads::Mutex analysis_queue_lock;
+ static Glib::Threads::Cond SourcesToAnalyse;
static std::list<boost::weak_ptr<Source> > analysis_queue;
static void analyse_audio_file_source (boost::shared_ptr<AudioFileSource>);
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index ec8b6e14cc..856e89eced 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -544,6 +544,8 @@ Session::destroy ()
remove_pending_capture_state ();
+ Analyser::flush ();
+
_state_of_the_state = StateOfTheState (CannotSave|Deletion);
/* disconnect from any and all signals that we are connected to */