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
This commit is contained in:
Paul Davis 2006-11-02 16:03:58 +00:00
parent 39aec8e0ca
commit f8f7323f6f
6 changed files with 45 additions and 40 deletions

View file

@ -847,6 +847,9 @@ AudioRegionView::create_one_wave (uint32_t which, bool direct)
waves = tmp_waves; waves = tmp_waves;
tmp_waves.clear (); tmp_waves.clear ();
/* all waves created, don't hook into peaks ready anymore */
data_ready_connection.disconnect ();
if (!zero_line) { if (!zero_line) {
zero_line = new ArdourCanvas::SimpleLine (*group); zero_line = new ArdourCanvas::SimpleLine (*group);
zero_line->property_x1() = (gdouble) 1.0; zero_line->property_x1() = (gdouble) 1.0;
@ -861,7 +864,6 @@ void
AudioRegionView::peaks_ready_handler (uint32_t which) AudioRegionView::peaks_ready_handler (uint32_t which)
{ {
Gtkmm2ext::UI::instance()->call_slot (bind (mem_fun(*this, &AudioRegionView::create_one_wave), which, false)); Gtkmm2ext::UI::instance()->call_slot (bind (mem_fun(*this, &AudioRegionView::create_one_wave), which, false));
if (!waves.empty()) { if (!waves.empty()) {
/* all waves created, don't hook into peaks ready anymore */ /* all waves created, don't hook into peaks ready anymore */
data_ready_connection.disconnect (); data_ready_connection.disconnect ();

View file

@ -977,7 +977,7 @@ gnome_canvas_waveview_render (GnomeCanvasItem *item,
#if 0 #if 0
printf ("0x%x r (%d..%d)(%d..%d) bbox (%d..%d)(%d..%d)" 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, waveview,
buf->rect.x0, buf->rect.x0,
buf->rect.x1, buf->rect.x1,
@ -987,7 +987,8 @@ gnome_canvas_waveview_render (GnomeCanvasItem *item,
waveview->bbox_lrx, waveview->bbox_lrx,
waveview->bbox_uly, waveview->bbox_uly,
waveview->bbox_lry, waveview->bbox_lry,
begin, end, s1, s2); begin, end, s1, s2,
waveview->samples_per_unit);
#endif #endif
/* now ensure that the cache is full and properly /* now ensure that the cache is full and properly

View file

@ -704,7 +704,7 @@ AudioSource::read_peaks (PeakData *peaks, nframes_t npeaks, nframes_t start, nfr
return ret; return ret;
} }
#define DEBUG_PEAK_BUILD #undef DEBUG_PEAK_BUILD
int int
AudioSource::build_peaks () AudioSource::build_peaks ()

View file

@ -55,6 +55,7 @@ typedef off_t off64_t;
#include <fcntl.h> #include <fcntl.h>
#include <pbd/error.h> #include <pbd/error.h>
#include <pbd/stacktrace.h>
#include <ardour/destructive_filesource.h> #include <ardour/destructive_filesource.h>
#include <ardour/utils.h> #include <ardour/utils.h>
#include <ardour/session.h> #include <ardour/session.h>
@ -290,7 +291,7 @@ DestructiveFileSource::write_unlocked (Sample* data, nframes_t cnt)
_capture_end = false; _capture_end = false;
/* move to the correct location place */ /* move to the correct location place */
file_pos = capture_start_frame; file_pos = capture_start_frame - timeline_position;
// split cnt in half // split cnt in half
nframes_t subcnt = cnt / 2; nframes_t subcnt = cnt / 2;
@ -345,7 +346,6 @@ DestructiveFileSource::write_unlocked (Sample* data, nframes_t cnt)
/* in the middle of recording */ /* in the middle of recording */
if (write_float (data, file_pos, cnt) != cnt) { if (write_float (data, file_pos, cnt) != cnt) {
return 0; return 0;
} }
@ -418,6 +418,7 @@ DestructiveFileSource::set_timeline_position (nframes_t pos)
int int
DestructiveFileSource::read_peaks (PeakData *peaks, nframes_t npeaks, nframes_t start, nframes_t cnt, double samples_per_unit) const 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); return AudioFileSource::read_peaks (peaks, npeaks, start, cnt, samples_per_unit);
} }

View file

@ -171,7 +171,6 @@ IO::IO (Session& s, const XMLNode& node, DataType dt)
_session.add_controllable (&_gain_control); _session.add_controllable (&_gain_control);
} }
IO::~IO () IO::~IO ()
{ {
Glib::Mutex::Lock guard (m_meter_signal_lock); Glib::Mutex::Lock guard (m_meter_signal_lock);

View file

@ -1039,11 +1039,11 @@ Session::set_state (const XMLNode& node)
Path Path
extra extra
Options/Config Options/Config
Locations
Sources Sources
AudioRegions AudioRegions
AudioDiskstreams AudioDiskstreams
Connections Connections
Locations
Routes Routes
EditGroups EditGroups
MixGroups MixGroups
@ -1066,6 +1066,39 @@ Session::set_state (const XMLNode& node)
error << _("Session: XML state has no options section") << endmsg; 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) { if ((child = find_named_node (node, "Sources")) == 0) {
error << _("Session: XML state has no sources section") << endmsg; error << _("Session: XML state has no sources section") << endmsg;
goto out; goto out;
@ -1113,37 +1146,6 @@ Session::set_state (const XMLNode& node)
goto out; 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) { if ((child = find_named_node (node, "EditGroups")) == 0) {
error << _("Session: XML state has no edit groups section") << endmsg; error << _("Session: XML state has no edit groups section") << endmsg;
goto out; goto out;