extensive changes to PresentationInfo API
[ardour.git] / libs / ardour / source.cc
index b3476ec8f4427fd3040015b1f8da8010410c1b1a..ee32e508e2c46b4853f242c14527ce8bb51c5e5b 100644 (file)
@@ -26,7 +26,7 @@
 #include <iomanip>
 #include <algorithm>
 
-#include <pbd/gstdio_compat.h>
+#include "pbd/gstdio_compat.h"
 #include <glibmm/threads.h>
 #include <glibmm/miscutils.h>
 #include <glibmm/fileutils.h>
@@ -113,7 +113,7 @@ Source::get_state ()
 int
 Source::set_state (const XMLNode& node, int version)
 {
-       const XMLProperty* prop;
+       XMLProperty const * prop;
 
        if ((prop = node.property ("name")) != 0) {
                _name = prop->value();
@@ -173,20 +173,22 @@ Source::has_been_analysed() const
 void
 Source::set_been_analysed (bool yn)
 {
-       {
+       if (yn) {
+               if (0 == load_transients (get_transients_path())) {
+                       yn = false;
+               }
+       }
+       if (yn != _analysed) {
                Glib::Threads::Mutex::Lock lm (_analysis_lock);
                _analysed = yn;
        }
-
-       if (yn) {
-               load_transients (get_transients_path());
-               AnalysisChanged(); // EMIT SIGNAL
-       }
+       AnalysisChanged(); // EMIT SIGNAL
 }
 
 int
 Source::load_transients (const string& path)
 {
+       int rv = 0;
        FILE *tf;
        if (! (tf = g_fopen (path.c_str (), "rb"))) {
                return -1;
@@ -196,6 +198,7 @@ Source::load_transients (const string& path)
        while (!feof (tf) && !ferror(tf)) {
                double val;
                if (1 != fscanf (tf, "%lf", &val)) {
+                       rv = -1;
                        break;
                }
 
@@ -204,6 +207,7 @@ Source::load_transients (const string& path)
        }
 
        ::fclose (tf);
+       return rv;
 }
 
 string