Remove the source files which got transferred to libpbd
[ardour.git] / libs / ardour / audioregion.cc
index 2eb09ae192c1aa4c933083500101e8e51f874b49..506596430f2d9fd01cd806a6936e3883c1efa18b 100644 (file)
 #include "ardour/session.h"
 #include "ardour/dB.h"
 #include "ardour/debug.h"
+#include "ardour/event_type_map.h"
 #include "ardour/playlist.h"
 #include "ardour/audiofilesource.h"
 #include "ardour/region_factory.h"
 #include "ardour/runtime_functions.h"
 #include "ardour/transient_detector.h"
+#include "ardour/parameter_descriptor.h"
 #include "ardour/progress.h"
 
 #include "i18n.h"
@@ -957,6 +959,34 @@ AudioRegion::set_state (const XMLNode& node, int version)
        return _set_state (node, version, what_changed, true);
 }
 
+void
+AudioRegion::fade_range (framepos_t start, framepos_t end)
+{
+       framepos_t s, e;
+
+       switch (coverage (start, end)) {
+       case Evoral::OverlapStart:
+               s = _position;
+               e = end;
+               set_fade_in (FadeConstantPower, e - s);
+               break;
+       case Evoral::OverlapEnd:
+               s = start;
+               e = _position + _length;
+               set_fade_out (FadeConstantPower, e - s);
+               break;
+       case Evoral::OverlapInternal:
+               /* needs addressing, perhaps. Difficult to do if we can't
+                * control one edge of the fade relative to the relevant edge
+                * of the region, which we cannot - fades are currently assumed
+                * to start/end at the start/end of the region
+                */
+               break;
+       default:
+               return;
+       }
+}
+
 void
 AudioRegion::set_fade_in_shape (FadeShape shape)
 {
@@ -983,9 +1013,10 @@ AudioRegion::set_fade_in (boost::shared_ptr<AutomationList> f)
 void
 AudioRegion::set_fade_in (FadeShape shape, framecnt_t len)
 {
-       boost::shared_ptr<Evoral::ControlList> c1 (new Evoral::ControlList (FadeInAutomation));
-       boost::shared_ptr<Evoral::ControlList> c2 (new Evoral::ControlList (FadeInAutomation));
-       boost::shared_ptr<Evoral::ControlList> c3 (new Evoral::ControlList (FadeInAutomation));
+       const ARDOUR::ParameterDescriptor desc(FadeInAutomation);
+       boost::shared_ptr<Evoral::ControlList> c1 (new Evoral::ControlList (FadeInAutomation, desc));
+       boost::shared_ptr<Evoral::ControlList> c2 (new Evoral::ControlList (FadeInAutomation, desc));
+       boost::shared_ptr<Evoral::ControlList> c3 (new Evoral::ControlList (FadeInAutomation, desc));
 
        _fade_in->freeze ();
        _fade_in->clear ();
@@ -1065,8 +1096,9 @@ AudioRegion::set_fade_out (boost::shared_ptr<AutomationList> f)
 void
 AudioRegion::set_fade_out (FadeShape shape, framecnt_t len)
 {
-       boost::shared_ptr<Evoral::ControlList> c1 (new Evoral::ControlList (FadeOutAutomation));
-       boost::shared_ptr<Evoral::ControlList> c2 (new Evoral::ControlList (FadeOutAutomation));
+       const ARDOUR::ParameterDescriptor desc(FadeOutAutomation);
+       boost::shared_ptr<Evoral::ControlList> c1 (new Evoral::ControlList (FadeOutAutomation, desc));
+       boost::shared_ptr<Evoral::ControlList> c2 (new Evoral::ControlList (FadeOutAutomation, desc));
 
        _fade_out->freeze ();
        _fade_out->clear ();
@@ -1650,16 +1682,16 @@ AudioRegion::get_transients (AnalysisFeatureList& results, bool force_new)
 
        if (!Config->get_auto_analyse_audio()) {
                if (!analyse_dialog_shown) {
-                       pl->session().Dialog (_("\
+                       pl->session().Dialog (string_compose (_("\
 You have requested an operation that requires audio analysis.\n\n\
 You currently have \"auto-analyse-audio\" disabled, which means \
 that transient data must be generated every time it is required.\n\n\
 If you are doing work that will require transient data on a \
 regular basis, you should probably enable \"auto-analyse-audio\" \
-then quit ardour and restart.\n\n\
+then quit %1 and restart.\n\n\
 This dialog will not display again.  But you may notice a slight delay \
 in this and future transient-detection operations.\n\
-"));
+"), PROGRAM_NAME));
                        analyse_dialog_shown = true;
                }
        }