X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fstrip_silence.cc;h=3141f422a80e28ccec22e2b25e571c0b3af788ed;hb=3fef6a3b8d14305e76728b4c21aeaf04b8b4dbe3;hp=a5b115205a750fc55d7ae2606e164aa740e8706a;hpb=83b7463b40291448ab6f6d4a301705c653d7a819;p=ardour.git diff --git a/libs/ardour/strip_silence.cc b/libs/ardour/strip_silence.cc index a5b115205a..3141f422a8 100644 --- a/libs/ardour/strip_silence.cc +++ b/libs/ardour/strip_silence.cc @@ -22,8 +22,6 @@ #include "ardour/strip_silence.h" #include "ardour/audioregion.h" #include "ardour/region_factory.h" -#include "ardour/session.h" -#include "ardour/dB.h" #include "ardour/progress.h" using namespace ARDOUR; @@ -102,14 +100,14 @@ StripSilence::run (boost::shared_ptr r, Progress* progress) frameoffset_t const end_of_region = r->start() + r->length(); - if (last_silence->second != end_of_region - 1) { + if (last_silence->second < end_of_region - 1) { audible.push_back (std::make_pair (last_silence->second, end_of_region - 1)); } int n = 0; int const N = audible.size (); - for (AudioIntervalResult::const_iterator i = audible.begin(); i != audible.end(); ++i) { + for (AudioIntervalResult::const_iterator i = audible.begin(); i != audible.end(); ++i, ++n) { PBD::PropertyList plist; boost::shared_ptr copy; @@ -123,11 +121,17 @@ StripSilence::run (boost::shared_ptr r, Progress* progress) copy->set_name (RegionFactory::new_region_name (region->name ())); - framecnt_t const f = std::min (_fade_length, (i->second - i->first)); + framecnt_t const f = std::min (_fade_length, (i->second - i->first) / 2); - copy->set_fade_in_active (true); - copy->set_fade_in (FadeLinear, f); - copy->set_fade_out (FadeLinear, f); + if (f > 0) { + copy->set_fade_in_active (true); + copy->set_fade_out_active (true); + copy->set_fade_in (FadeLinear, f); + copy->set_fade_out (FadeLinear, f); + } else { + copy->set_fade_in_active (false); + copy->set_fade_out_active (false); + } results.push_back (copy); if (progress && (n <= N)) {