X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fanalyser.cc;h=bf98ecc20ab406a30c5e675c0c9ecb6337914202;hb=f6d29abfc75c460b9e35717f2907e4e61bf38058;hp=2e14c74b86e267016340b9d7764e5f41c33b3694;hpb=859e9106e72a7908fa093d946111d148223225a0;p=ardour.git diff --git a/libs/ardour/analyser.cc b/libs/ardour/analyser.cc index 2e14c74b86..bf98ecc20a 100644 --- a/libs/ardour/analyser.cc +++ b/libs/ardour/analyser.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 Paul Davis + Copyright (C) 2008 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,26 +17,23 @@ */ -#include -#include -#include - -#include -#include +#include "ardour/analyser.h" +#include "ardour/audiofilesource.h" +#include "ardour/session_event.h" +#include "ardour/transient_detector.h" using namespace std; -using namespace sigc; using namespace ARDOUR; using namespace PBD; Analyser* Analyser::the_analyser = 0; -Glib::StaticMutex Analyser::analysis_queue_lock = GLIBMM_STATIC_MUTEX_INIT; -Glib::Cond* Analyser::SourcesToAnalyse = 0; +Glib::Threads::Mutex Analyser::analysis_queue_lock; +Glib::Threads::Cond Analyser::SourcesToAnalyse; list > Analyser::analysis_queue; Analyser::Analyser () { - + } Analyser::~Analyser () @@ -52,8 +49,7 @@ analyser_work () void Analyser::init () { - SourcesToAnalyse = new Glib::Cond(); - Glib::Thread::create (sigc::ptr_fun (analyser_work), false); + Glib::Threads::Thread::create (sigc::ptr_fun (analyser_work)); } void @@ -67,22 +63,22 @@ Analyser::queue_source_for_analysis (boost::shared_ptr src, bool force) return; } - Glib::Mutex::Lock lm (analysis_queue_lock); + Glib::Threads::Mutex::Lock lm (analysis_queue_lock); analysis_queue.push_back (boost::weak_ptr(src)); - SourcesToAnalyse->broadcast (); + SourcesToAnalyse.broadcast (); } void Analyser::work () { - PBD::ThreadCreated (pthread_self(), string ("analyser-") + to_string (pthread_self(), std::dec)); + SessionEvent::create_per_thread_pool ("Analyser", 64); while (true) { analysis_queue_lock.lock (); wait: if (analysis_queue.empty()) { - SourcesToAnalyse->wait (analysis_queue_lock); + SourcesToAnalyse.wait (analysis_queue_lock); } if (analysis_queue.empty()) { @@ -95,7 +91,7 @@ Analyser::work () boost::shared_ptr afs = boost::dynamic_pointer_cast (src); - if (afs && afs->length()) { + if (afs && afs->length(afs->timeline_position())) { analyse_audio_file_source (afs); } } @@ -116,4 +112,3 @@ Analyser::analyse_audio_file_source (boost::shared_ptr src) } -