directly apply waveform clip-level changes
authorRobin Gareus <robin@gareus.org>
Mon, 26 May 2014 22:33:15 +0000 (00:33 +0200)
committerRobin Gareus <robin@gareus.org>
Tue, 27 May 2014 14:37:01 +0000 (16:37 +0200)
libs/canvas/canvas/wave_view.h
libs/canvas/wave_view.cc

index 791d0d17dabfda4ccced3548a71fe8843e28131f..307528c685507e03d8cb2e3d2fff2e1f109c7497 100644 (file)
@@ -159,7 +159,7 @@ private:
         mutable ARDOUR::framepos_t _sample_end; 
         mutable Cairo::RefPtr<Cairo::ImageSurface> _image;
 
-        PBD::ScopedConnection invalidation_connection;
+        PBD::ScopedConnectionList invalidation_connection;
 
         static double _global_gradient_depth;
         static bool   _global_logscaled;
@@ -170,6 +170,7 @@ private:
         static PBD::Signal0<void> VisualPropertiesChanged;
 
         void handle_visual_property_change ();
+        void handle_clip_level_change ();
 
         void ensure_cache (ARDOUR::framepos_t sample_start, ARDOUR::framepos_t sample_end) const;
         ArdourCanvas::Coord position (double) const;
index 664dea351f0d8f6ff20a93e1f5f89b47fabdda6e..9e0ddc7ee38d4ab6f2f6b826b7ee4457f5232c9e 100644 (file)
@@ -73,6 +73,7 @@ WaveView::WaveView (Group* parent, boost::shared_ptr<ARDOUR::AudioRegion> region
        , _sample_end (-1)
 {
        VisualPropertiesChanged.connect_same_thread (invalidation_connection, boost::bind (&WaveView::handle_visual_property_change, this));
+       ClipLevelChanged.connect_same_thread (invalidation_connection, boost::bind (&WaveView::handle_clip_level_change, this));
 }
 
 WaveView::~WaveView ()
@@ -104,6 +105,12 @@ WaveView::handle_visual_property_change ()
        }
 }
 
+void
+WaveView::handle_clip_level_change ()
+{
+       invalidate_image ();
+}
+
 void
 WaveView::set_fill_color (Color c)
 {
@@ -165,8 +172,11 @@ alt_log_meter (float power)
 void
 WaveView::set_clip_level (double dB)
 {
-       _clip_level = dB_to_coefficient (dB);
-       ClipLevelChanged ();
+       const double clip_level = dB_to_coefficient (dB);
+       if (clip_level != _clip_level) {
+               _clip_level = clip_level;
+               ClipLevelChanged ();
+       }
 }
 
 struct LineTips {