From 9213e9c9094468ce21be378ea017b0da1405bf03 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 22 Apr 2010 01:40:33 +0000 Subject: Allow more than one peaks_ready callback to be pending for an AudioRegionView at any one time. Prevents problems when there is more than 1 channel for which peaks are not ready; before, the first peaks_ready callback would be forgotten when the second one was requested. Should fix #3074. git-svn-id: svn://localhost/ardour2/branches/3.0@6951 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/crossfade_edit.cc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'gtk2_ardour/crossfade_edit.cc') diff --git a/gtk2_ardour/crossfade_edit.cc b/gtk2_ardour/crossfade_edit.cc index d420e36c46..78d3c74ab6 100644 --- a/gtk2_ardour/crossfade_edit.cc +++ b/gtk2_ardour/crossfade_edit.cc @@ -93,7 +93,10 @@ CrossfadeEditor::CrossfadeEditor (Session* s, boost::shared_ptr xf, d fade_out_table (3, 3), select_in_button (_("Fade In")), - select_out_button (_("Fade Out")) + select_out_button (_("Fade Out")), + + _peaks_ready_connection (0) + { set_session (s); @@ -308,6 +311,8 @@ CrossfadeEditor::~CrossfadeEditor() for (list::iterator i = fade[Out].points.begin(); i != fade[Out].points.end(); ++i) { delete *i; } + + delete _peaks_ready_connection; } void @@ -1138,11 +1143,14 @@ CrossfadeEditor::make_waves (boost::shared_ptr region, WhichFade wh ht = canvas->get_allocation().get_height() / (double) nchans; spu = xfade->length() / (double) effective_width(); + delete _peaks_ready_connection; + _peaks_ready_connection = 0; + for (uint32_t n = 0; n < nchans; ++n) { gdouble yoff = n * ht; - if (region->audio_source(n)->peaks_ready (boost::bind (&CrossfadeEditor::peaks_ready, this, boost::weak_ptr(region), which), peaks_ready_connection, gui_context())) { + if (region->audio_source(n)->peaks_ready (boost::bind (&CrossfadeEditor::peaks_ready, this, boost::weak_ptr(region), which), &_peaks_ready_connection, gui_context())) { WaveView* waveview = new WaveView (*(canvas->root())); waveview->property_data_src() = region.get(); @@ -1188,7 +1196,9 @@ CrossfadeEditor::peaks_ready (boost::weak_ptr wr, WhichFade which) will be ready by the time we want them. but our API forces us to provide this, so .. */ - peaks_ready_connection.disconnect (); + delete _peaks_ready_connection; + _peaks_ready_connection = 0; + make_waves (r, which); } -- cgit v1.2.3