Fix VST build.
[ardour.git] / libs / ardour / strip_silence.cc
index 21faeded6840e16e3b79efc7f2eaaadd8934f00f..cf03c2df8ba95b8e54bd473d851209f7f4419845 100644 (file)
@@ -24,6 +24,7 @@
 #include "ardour/region_factory.h"
 #include "ardour/session.h"
 #include "ardour/dB.h"
+#include "ardour/progress.h"
 
 using namespace ARDOUR;
 
@@ -34,14 +35,14 @@ using namespace ARDOUR;
  *  @param fade_length Length of fade in/out to apply to trimmed regions, in samples.
  */
 
-StripSilence::StripSilence (Session & s, double threshold, nframes_t minimum_length, nframes_t fade_length)
+StripSilence::StripSilence (Session & s, double threshold, framecnt_t minimum_length, framecnt_t fade_length)
        : Filter (s), _threshold (threshold), _minimum_length (minimum_length), _fade_length (fade_length)
 {
 
 }
 
 int
-StripSilence::run (boost::shared_ptr<Region> r)
+StripSilence::run (boost::shared_ptr<Region> r, Progress* progress)
 {
        results.clear ();
 
@@ -88,6 +89,9 @@ StripSilence::run (boost::shared_ptr<Region> r)
                 in_silence = false;
         }
 
+       int n = 0;
+       int const N = silence.size ();
+
         while (s != silence.end()) {
 
                 framecnt_t interval_duration;
@@ -111,7 +115,7 @@ StripSilence::run (boost::shared_ptr<Region> r)
                                 copy->position() << std::endl;
 
                         copy->set_fade_in_active (true);
-                        copy->set_fade_in (AudioRegion::Linear, _fade_length);
+                        copy->set_fade_in (FadeLinear, _fade_length);
                         results.push_back (copy);
                 }
 
@@ -119,6 +123,11 @@ StripSilence::run (boost::shared_ptr<Region> r)
                 ++s;
                 end = s->first;
                 in_silence = !in_silence;
+
+               if (progress) {
+                       progress->set_progress (float (n) / N);
+               }
+               ++n;
         }
 
        return 0;