Merge branch 'windows' of git.ardour.org:ardour/ardour into windows
[ardour.git] / libs / ardour / source_factory.cc
index 65f9d8da28144261ad5bbd959ae89af92acd5087..5e1a7d40d90507bf13cf57ffeaea36ea87412677 100644 (file)
@@ -35,7 +35,6 @@
 #include "ardour/source_factory.h"
 #include "ardour/sndfilesource.h"
 #include "ardour/silentfilesource.h"
-#include "ardour/rc_configuration.h"
 #include "ardour/smf_source.h"
 #include "ardour/session.h"
 
@@ -51,8 +50,8 @@ using namespace std;
 using namespace PBD;
 
 PBD::Signal1<void,boost::shared_ptr<Source> > SourceFactory::SourceCreated;
-Glib::Cond* SourceFactory::PeaksToBuild;
-Glib::StaticMutex SourceFactory::peak_building_lock = GLIBMM_STATIC_MUTEX_INIT;
+Glib::Threads::Cond SourceFactory::PeaksToBuild;
+Glib::Threads::Mutex SourceFactory::peak_building_lock;
 std::list<boost::weak_ptr<AudioSource> > SourceFactory::files_with_peaks;
 
 static void
@@ -66,7 +65,7 @@ peak_thread_work ()
 
          wait:
                if (SourceFactory::files_with_peaks.empty()) {
-                       SourceFactory::PeaksToBuild->wait (SourceFactory::peak_building_lock);
+                       SourceFactory::PeaksToBuild.wait (SourceFactory::peak_building_lock);
                }
 
                if (SourceFactory::files_with_peaks.empty()) {
@@ -88,10 +87,8 @@ peak_thread_work ()
 void
 SourceFactory::init ()
 {
-       PeaksToBuild = new Glib::Cond();
-
        for (int n = 0; n < 2; ++n) {
-               Glib::Thread::create (sigc::ptr_fun (::peak_thread_work), false);
+               Glib::Threads::Thread::create (sigc::ptr_fun (::peak_thread_work));
        }
 }
 
@@ -104,9 +101,9 @@ SourceFactory::setup_peakfile (boost::shared_ptr<Source> s, bool async)
 
                if (async) {
 
-                       Glib::Mutex::Lock lm (peak_building_lock);
+                       Glib::Threads::Mutex::Lock lm (peak_building_lock);
                        files_with_peaks.push_back (boost::weak_ptr<AudioSource> (as));
-                       PeaksToBuild->broadcast ();
+                       PeaksToBuild.broadcast ();
 
                } else {
 
@@ -221,11 +218,11 @@ SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks)
 }
 
 boost::shared_ptr<Source>
-SourceFactory::createReadable (DataType type, Session& s, const string& path,
+SourceFactory::createExternal (DataType type, Session& s, const string& path,
                               int chn, Source::Flag flags, bool announce, bool defer_peaks)
 {
        if (type == DataType::AUDIO) {
-
+               
                if (!(flags & Destructive)) {
 
                        try {
@@ -294,19 +291,19 @@ SourceFactory::createReadable (DataType type, Session& s, const string& path,
 }
 
 boost::shared_ptr<Source>
-SourceFactory::createWritable (DataType type, Session& s, const std::string& path, const std::string& origin,
+SourceFactory::createWritable (DataType type, Session& s, const std::string& path, 
                               bool destructive, framecnt_t rate, bool announce, bool defer_peaks)
 {
        /* this might throw failed_constructor(), which is OK */
 
        if (type == DataType::AUDIO) {
-               Source* src = new SndFileSource (s, path, origin,
-                               s.config.get_native_file_data_format(),
-                               s.config.get_native_file_header_format(),
-                               rate,
-                               (destructive
-                                       ? Source::Flag (SndFileSource::default_writable_flags | Source::Destructive)
-                                : SndFileSource::default_writable_flags));
+               Source* src = new SndFileSource (s, path, string(),
+                                                s.config.get_native_file_data_format(),
+                                                s.config.get_native_file_header_format(),
+                                                rate,
+                                                (destructive
+                                                 ? Source::Flag (SndFileSource::default_writable_flags | Source::Destructive)
+                                                 : SndFileSource::default_writable_flags));
 #ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
                // boost_debug_shared_ptr_mark_interesting (src, "Source");
 #endif