summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2006-11-02 16:03:58 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2006-11-02 16:03:58 +0000
commitf8f7323f6fa11323810f1c640edbe0014c832306 (patch)
tree7e4a905fc5dd12386fe140ef3bacd62836c46b7b /libs
parent39aec8e0ca34feb78be8cc526fa57687b5cbe642 (diff)
fix unset timeline position for destructive sources; fix duplicate, unmanaged waveviews being created by a thread race
git-svn-id: svn://localhost/ardour2/trunk@1060 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/audiosource.cc2
-rw-r--r--libs/ardour/destructive_filesource.cc7
-rw-r--r--libs/ardour/io.cc1
-rw-r--r--libs/ardour/session_state.cc66
4 files changed, 39 insertions, 37 deletions
diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc
index 0ad9cc68b7..cd8c192d13 100644
--- a/libs/ardour/audiosource.cc
+++ b/libs/ardour/audiosource.cc
@@ -704,7 +704,7 @@ AudioSource::read_peaks (PeakData *peaks, nframes_t npeaks, nframes_t start, nfr
return ret;
}
-#define DEBUG_PEAK_BUILD
+#undef DEBUG_PEAK_BUILD
int
AudioSource::build_peaks ()
diff --git a/libs/ardour/destructive_filesource.cc b/libs/ardour/destructive_filesource.cc
index cc607bc368..2f2e85ed5a 100644
--- a/libs/ardour/destructive_filesource.cc
+++ b/libs/ardour/destructive_filesource.cc
@@ -55,6 +55,7 @@ typedef off_t off64_t;
#include <fcntl.h>
#include <pbd/error.h>
+#include <pbd/stacktrace.h>
#include <ardour/destructive_filesource.h>
#include <ardour/utils.h>
#include <ardour/session.h>
@@ -290,7 +291,7 @@ DestructiveFileSource::write_unlocked (Sample* data, nframes_t cnt)
_capture_end = false;
/* move to the correct location place */
- file_pos = capture_start_frame;
+ file_pos = capture_start_frame - timeline_position;
// split cnt in half
nframes_t subcnt = cnt / 2;
@@ -344,13 +345,12 @@ DestructiveFileSource::write_unlocked (Sample* data, nframes_t cnt)
} else {
/* in the middle of recording */
-
if (write_float (data, file_pos, cnt) != cnt) {
return 0;
}
}
-
+
old_file_pos = file_pos;
update_length (file_pos, cnt);
file_pos += cnt;
@@ -418,6 +418,7 @@ DestructiveFileSource::set_timeline_position (nframes_t pos)
int
DestructiveFileSource::read_peaks (PeakData *peaks, nframes_t npeaks, nframes_t start, nframes_t cnt, double samples_per_unit) const
{
+ // cerr << _name << " read peaks at " << start << " for " << cnt << " tpos = " << timeline_position << endl;
return AudioFileSource::read_peaks (peaks, npeaks, start, cnt, samples_per_unit);
}
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index 0804369b94..897589fc77 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -170,7 +170,6 @@ IO::IO (Session& s, const XMLNode& node, DataType dt)
_session.add_controllable (&_gain_control);
}
-
IO::~IO ()
{
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index c69908285c..d9c82f546b 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -1039,11 +1039,11 @@ Session::set_state (const XMLNode& node)
Path
extra
Options/Config
+ Locations
Sources
AudioRegions
AudioDiskstreams
Connections
- Locations
Routes
EditGroups
MixGroups
@@ -1066,6 +1066,39 @@ Session::set_state (const XMLNode& node)
error << _("Session: XML state has no options section") << endmsg;
}
+ if ((child = find_named_node (node, "Locations")) == 0) {
+ error << _("Session: XML state has no locations section") << endmsg;
+ goto out;
+ } else if (_locations.set_state (*child)) {
+ goto out;
+ }
+
+ Location* location;
+
+ if ((location = _locations.auto_loop_location()) != 0) {
+ set_auto_loop_location (location);
+ }
+
+ if ((location = _locations.auto_punch_location()) != 0) {
+ set_auto_punch_location (location);
+ }
+
+ if ((location = _locations.end_location()) == 0) {
+ _locations.add (end_location);
+ } else {
+ delete end_location;
+ end_location = location;
+ }
+
+ if ((location = _locations.start_location()) == 0) {
+ _locations.add (start_location);
+ } else {
+ delete start_location;
+ start_location = location;
+ }
+
+ AudioFileSource::set_header_position_offset (start_location->start());
+
if ((child = find_named_node (node, "Sources")) == 0) {
error << _("Session: XML state has no sources section") << endmsg;
goto out;
@@ -1113,37 +1146,6 @@ Session::set_state (const XMLNode& node)
goto out;
}
- if ((child = find_named_node (node, "Locations")) == 0) {
- error << _("Session: XML state has no locations section") << endmsg;
- goto out;
- } else if (_locations.set_state (*child)) {
- goto out;
- }
-
- Location* location;
-
- if ((location = _locations.auto_loop_location()) != 0) {
- set_auto_loop_location (location);
- }
-
- if ((location = _locations.auto_punch_location()) != 0) {
- set_auto_punch_location (location);
- }
-
- if ((location = _locations.end_location()) == 0) {
- _locations.add (end_location);
- } else {
- delete end_location;
- end_location = location;
- }
-
- if ((location = _locations.start_location()) == 0) {
- _locations.add (start_location);
- } else {
- delete start_location;
- start_location = location;
- }
-
if ((child = find_named_node (node, "EditGroups")) == 0) {
error << _("Session: XML state has no edit groups section") << endmsg;
goto out;