summaryrefslogtreecommitdiff
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
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
-rw-r--r--gtk2_ardour/audio_region_view.cc4
-rw-r--r--gtk2_ardour/canvas-waveview.c5
-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
6 files changed, 45 insertions, 40 deletions
diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc
index c7bb048945..6de409b7ec 100644
--- a/gtk2_ardour/audio_region_view.cc
+++ b/gtk2_ardour/audio_region_view.cc
@@ -847,6 +847,9 @@ AudioRegionView::create_one_wave (uint32_t which, bool direct)
waves = tmp_waves;
tmp_waves.clear ();
+ /* all waves created, don't hook into peaks ready anymore */
+ data_ready_connection.disconnect ();
+
if (!zero_line) {
zero_line = new ArdourCanvas::SimpleLine (*group);
zero_line->property_x1() = (gdouble) 1.0;
@@ -861,7 +864,6 @@ void
AudioRegionView::peaks_ready_handler (uint32_t which)
{
Gtkmm2ext::UI::instance()->call_slot (bind (mem_fun(*this, &AudioRegionView::create_one_wave), which, false));
-
if (!waves.empty()) {
/* all waves created, don't hook into peaks ready anymore */
data_ready_connection.disconnect ();
diff --git a/gtk2_ardour/canvas-waveview.c b/gtk2_ardour/canvas-waveview.c
index 48834f37da..080f6871fa 100644
--- a/gtk2_ardour/canvas-waveview.c
+++ b/gtk2_ardour/canvas-waveview.c
@@ -977,7 +977,7 @@ gnome_canvas_waveview_render (GnomeCanvasItem *item,
#if 0
printf ("0x%x r (%d..%d)(%d..%d) bbox (%d..%d)(%d..%d)"
- " b/e %d..%d s= %lu..%lu\n",
+ " b/e %d..%d s= %lu..%lu @ %f\n",
waveview,
buf->rect.x0,
buf->rect.x1,
@@ -987,7 +987,8 @@ gnome_canvas_waveview_render (GnomeCanvasItem *item,
waveview->bbox_lrx,
waveview->bbox_uly,
waveview->bbox_lry,
- begin, end, s1, s2);
+ begin, end, s1, s2,
+ waveview->samples_per_unit);
#endif
/* now ensure that the cache is full and properly
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;