summaryrefslogtreecommitdiff
path: root/libs/ardour/source_factory.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2007-09-10 18:45:12 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2007-09-10 18:45:12 +0000
commitafcbba17f01347b7bc59f9cff6e081be7645d60a (patch)
tree2ded17e16b35bdd32476f4d4212e0d1c05d02ae8 /libs/ardour/source_factory.cc
parentadfa5978d30f823e9cff0ae7bd555d734be55d18 (diff)
WARNING WARNING WARNING >>>> DEEP CHANGES >>> EXPERIMENTAL CODE .... fixes to make region(views) pick up peakfile data asynchronously, like they used to in 0.99
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2444 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/source_factory.cc')
-rw-r--r--libs/ardour/source_factory.cc17
1 files changed, 16 insertions, 1 deletions
diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc
index cd20060cfa..b2774591e4 100644
--- a/libs/ardour/source_factory.cc
+++ b/libs/ardour/source_factory.cc
@@ -21,6 +21,8 @@
#include <glibmm/thread.h>
#include <pbd/error.h>
+#include <pbd/convert.h>
+#include <pbd/pthread_utils.h>
#include <ardour/source_factory.h>
#include <ardour/sndfilesource.h>
@@ -40,13 +42,26 @@ using namespace sigc;
sigc::signal<void,boost::shared_ptr<Source> > SourceFactory::SourceCreated;
+static void setup_peakfile (boost::weak_ptr<AudioSource> was)
+{
+ boost::shared_ptr<AudioSource> as (was.lock());
+
+ if (!as) {
+ return;
+ }
+
+ PBD::ThreadCreatedWithRequestSize (pthread_self(), string ("peakbuilder-") + to_string (pthread_self(), std::dec), 1024);
+ as->setup_peakfile ();
+ // PBD::ThreadLeaving (pthread_self());
+}
+
int
SourceFactory::setup_peakfile (boost::shared_ptr<Source> s, bool async)
{
boost::shared_ptr<AudioSource> as (boost::dynamic_pointer_cast<AudioSource> (s));
if (as) {
if (async) {
- Glib::Thread::create (hide_return (mem_fun (*as, &AudioSource::setup_peakfile)), false);
+ Glib::Thread::create (bind (sigc::ptr_fun (::setup_peakfile), boost::weak_ptr<AudioSource>(as)), false);
} else {
if (as->setup_peakfile ()) {
error << string_compose("SourceFactory: could not set up peakfile for %1", as->name()) << endmsg;