projects
/
ardour.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Oh boy!
[ardour.git]
/
libs
/
ardour
/
source.cc
diff --git
a/libs/ardour/source.cc
b/libs/ardour/source.cc
index 03039fea5baf5f9abc8205132e821f51fb4645ec..f9772ec9eddbd4c2210c486e2b1581ac91ba7bad 100644
(file)
--- a/
libs/ardour/source.cc
+++ b/
libs/ardour/source.cc
@@
-25,8
+25,8
@@
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <algorithm>
-#include <fstream>
+#include "pbd/gstdio_compat.h"
#include <glibmm/threads.h>
#include <glibmm/miscutils.h>
#include <glibmm/fileutils.h>
#include <glibmm/threads.h>
#include <glibmm/miscutils.h>
#include <glibmm/fileutils.h>
@@
-35,11
+35,12
@@
#include "pbd/enumwriter.h"
#include "ardour/debug.h"
#include "pbd/enumwriter.h"
#include "ardour/debug.h"
+#include "ardour/profile.h"
#include "ardour/session.h"
#include "ardour/source.h"
#include "ardour/transient_detector.h"
#include "ardour/session.h"
#include "ardour/source.h"
#include "ardour/transient_detector.h"
-#include "i18n.h"
+#include "
pbd/
i18n.h"
using namespace std;
using namespace ARDOUR;
using namespace std;
using namespace ARDOUR;
@@
-112,7
+113,7
@@
Source::get_state ()
int
Source::set_state (const XMLNode& node, int version)
{
int
Source::set_state (const XMLNode& node, int version)
{
-
const XMLProperty
* prop;
+
XMLProperty const
* prop;
if ((prop = node.property ("name")) != 0) {
_name = prop->value();
if ((prop = node.property ("name")) != 0) {
_name = prop->value();
@@
-144,6
+145,11
@@
Source::set_state (const XMLNode& node, int version)
_flags = Flag (_flags | Destructive);
}
_flags = Flag (_flags | Destructive);
}
+ if (Profile->get_trx() && (_flags & Destructive)) {
+ error << string_compose (_("%1: this session uses destructive tracks, which are not supported"), PROGRAM_NAME) << endmsg;
+ return -1;
+ }
+
if (version < 3000) {
/* a source with an XML node must necessarily already exist,
and therefore cannot be removable/writable etc. etc.; 2.X
if (version < 3000) {
/* a source with an XML node must necessarily already exist,
and therefore cannot be removable/writable etc. etc.; 2.X
@@
-167,41
+173,41
@@
Source::has_been_analysed() const
void
Source::set_been_analysed (bool yn)
{
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;
}
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
Source::load_transients (const string& path)
{
- i
fstream file (path.c_str())
;
-
- if (!
file
) {
+ i
nt rv = 0
;
+ FILE *tf;
+ if (!
(tf = g_fopen (path.c_str (), "rb"))
) {
return -1;
}
transients.clear ();
return -1;
}
transients.clear ();
-
- stringstream strstr;
- double val;
-
- while (file.good()) {
- file >> val;
-
- if (!file.fail()) {
- framepos_t frame = (framepos_t) floor (val * _session.frame_rate());
- transients.push_back (frame);
+ while (!feof (tf) && !ferror(tf)) {
+ double val;
+ if (1 != fscanf (tf, "%lf", &val)) {
+ rv = -1;
+ break;
}
}
+
+ framepos_t frame = (framepos_t) floor (val * _session.frame_rate());
+ transients.push_back (frame);
}
}
- return 0;
+ ::fclose (tf);
+ return rv;
}
string
}
string