remove debugging for peaks ready signal, plus add new connection arg to Source::peaks...
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 2 Mar 2006 03:45:26 +0000 (03:45 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 2 Mar 2006 03:45:26 +0000 (03:45 +0000)
git-svn-id: svn://localhost/trunk/ardour2@343 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/crossfade_edit.cc
gtk2_ardour/crossfade_edit.h
gtk2_ardour/regionview.cc
gtk2_ardour/regionview.h
libs/ardour/ardour/source.h
libs/ardour/source.cc

index 5ac5a57aa5ca40714a2241135d90bbecd4a16437..1a4304b2e8c9180e745b3f10da801b7f665e08eb 100644 (file)
@@ -1036,7 +1036,7 @@ CrossfadeEditor::make_waves (AudioRegion& region, WhichFade which)
                
                gdouble yoff = n * ht;
                
-               if (region.source(n).peaks_ready (bind (mem_fun(*this, &CrossfadeEditor::peaks_ready), &region, which))) {
+               if (region.source(n).peaks_ready (bind (mem_fun(*this, &CrossfadeEditor::peaks_ready), &region, which), peaks_ready_connection)) {
                        
                        WaveView* waveview = new WaveView (*(canvas->root()));
 
@@ -1071,7 +1071,7 @@ CrossfadeEditor::peaks_ready (AudioRegion* r, WhichFade which)
           will be ready by the time we want them. but our API forces us
           to provide this, so ..
        */
-
+       peaks_ready_connection.disconnect ();
        make_waves (*r, which);
 }
 
index cfb9ed35a0b4f001080a75e3d511c518c7b02287..04d58369090490003e53059ceb335f9430ac294a 100644 (file)
@@ -160,6 +160,8 @@ class CrossfadeEditor : public ArdourDialog
     
     void set (const ARDOUR::Curve& alist, WhichFade);
 
+    sigc::connection peaks_ready_connection;
+
     void make_waves (ARDOUR::AudioRegion&, WhichFade);
     void peaks_ready (ARDOUR::AudioRegion* r, WhichFade);
     
index d7c87ae1c4cb2c9ad53b048e6f4165c309e077a4..c47694233fe57e9490f816d8c2e894fea95f31ca 100644 (file)
@@ -1003,7 +1003,7 @@ AudioRegionView::create_waves ()
                wave_caches.push_back (WaveView::create_cache ());
 
                if (wait_for_waves) {
-                       if (region.source(n).peaks_ready (bind (mem_fun(*this, &AudioRegionView::peaks_ready_handler), n))) {
+                       if (region.source(n).peaks_ready (bind (mem_fun(*this, &AudioRegionView::peaks_ready_handler), n), peaks_ready_connection)) {
                                create_one_wave (n, true);
                        } else {
                                create_zero_line = false;
@@ -1080,32 +1080,13 @@ AudioRegionView::create_one_wave (uint32_t which, bool direct)
                }
        }
        
-       cerr << "wave ready, n = " << n << " nwaves = " << nwaves << " new wave = " << wave 
-            << " tmp[" << which << "] = " << tmp_waves[which] << endl;
-       
        if (n == nwaves && waves.empty()) {
                /* all waves are ready */
                tmp_waves.resize(nwaves);
 
-
-               for (uint32_t x = 0; x < tmp_waves.size(); ++x) {
-                       cerr << "tmp_waves[" << x << "] = " << tmp_waves[x] << endl;
-               }
-
                waves = tmp_waves;
                tmp_waves.clear ();
 
-               cerr << "all waves ready, copied over ...\n";
-
-               for (uint32_t x = 0; x < waves.size(); ++x) {
-                       cerr << "waves[" << x << "] = " << waves[x] << endl;
-               }
-               
-               for (vector<WaveView*>::iterator i = waves.begin(); i != waves.end(); ++i) {
-                       cerr << "iterator[" << distance (i, waves.begin()) << "] = " << (*i) << endl;
-               }
-               cerr << "--------\n";
-               
                if (!zero_line) {
                        zero_line = new ArdourCanvas::SimpleLine (*group);
                        zero_line->property_x1() = (gdouble) 1.0;
@@ -1114,12 +1095,12 @@ AudioRegionView::create_one_wave (uint32_t which, bool direct)
                        manage_zero_line ();
                }
        }
-       cerr << "done that time\n";
 }
 
 void
 AudioRegionView::peaks_ready_handler (uint32_t which)
 {
+       peaks_ready_connection.disconnect ();
        Gtkmm2ext::UI::instance()->call_slot (bind (mem_fun(*this, &AudioRegionView::create_one_wave), which, false));
 }
 
index 4bfcd079cc32e419cb48d2d5deb47bde7f6c1b68..70c944f2da836803e45212ed6a5bf0ade40d7def 100644 (file)
@@ -161,6 +161,7 @@ class AudioRegionView : public TimeAxisViewItem
     double _height;
     bool    in_destructor;
     bool    wait_for_waves;
+    sigc::connection peaks_ready_connection;
 
     void reset_fade_shapes ();
     void reset_fade_in_shape ();
index 977296828832c75c3295653dff3af2ef2b67874a..9a9bccfc58487c1b6a7e1b17a8207443d31f8b64 100644 (file)
@@ -90,7 +90,7 @@ class Source : public Stateful, public sigc::trackable
 
        int  read_peaks (PeakData *peaks, jack_nframes_t npeaks, jack_nframes_t start, jack_nframes_t cnt, double samples_per_unit) const;
        int  build_peaks ();
-       bool peaks_ready (sigc::slot<void>) const;
+       bool peaks_ready (sigc::slot<void>, sigc::connection&) const;
 
        static sigc::signal<void,Source*> SourceCreated;
               
index f707dc44e51dd58a8e2ce0f70ea1aa283e0a48d2..25e9b438994ddbd719c7710830119cb131062a11 100644 (file)
@@ -305,7 +305,7 @@ void Source::clear_queue_for_peaks ()
 
 
 bool
-Source::peaks_ready (sigc::slot<void> the_slot) const
+Source::peaks_ready (sigc::slot<void> the_slot, sigc::connection& conn) const
 {
        bool ret;
        LockMonitor lm (_lock, __LINE__, __FILE__);
@@ -315,7 +315,7 @@ Source::peaks_ready (sigc::slot<void> the_slot) const
        */
 
        if (!(ret = _peaks_built)) {
-               PeaksReady.connect (the_slot);
+               conn = PeaksReady.connect (the_slot);
        }
 
        return ret;