#include "evoral/Curve.hpp"
#include "ardour/audioregion.h"
-#include "ardour/debug.h"
#include "ardour/session.h"
#include "ardour/dB.h"
#include "ardour/playlist.h"
PBD::PropertyDescriptor<bool> fade_in_active;
PBD::PropertyDescriptor<bool> fade_out_active;
PBD::PropertyDescriptor<float> scale_amplitude;
+ PBD::PropertyDescriptor<bool> fade_out_is_xfade;
+ PBD::PropertyDescriptor<bool> fade_out_is_short;
+ PBD::PropertyDescriptor<bool> fade_in_is_xfade;
+ PBD::PropertyDescriptor<bool> fade_in_is_short;
}
}
size_t len = src->back()->when;
for (Evoral::ControlList::const_iterator it = src->begin(); it!=src->end(); it++) {
- dst->add ( len - (*it)->when, (*it)->value );
+ dst->add (len - (*it)->when, (*it)->value);
}
}
static void
generate_inverse_power_curve (boost::shared_ptr<Evoral::ControlList> dst, boost::shared_ptr<const Evoral::ControlList> src)
{
- //calc inverse curve using sum of squares
+ // calc inverse curve using sum of squares
for (Evoral::ControlList::const_iterator it = src->begin(); it!=src->end(); ++it ) {
float value = (*it)->value;
value = 1 - powf(value,2);
}
}
-/*
-static void
-generate_inverse_coefficient_curve (boost::shared_ptr<Evoral::ControlList> dst, boost::shared_ptr<const Evoral::ControlList> src)
-{
- //calc inverse gain coefficient curve
- for (Evoral::ControlList::const_iterator it = src->begin(); it!=src->end(); ++it ) {
- float value = 1.0 - (*it)->value;
- dst->fast_simple_add ( (*it)->when, value );
- }
-}
-*/
-
static void
generate_db_fade (boost::shared_ptr<Evoral::ControlList> dst, double len, int num_steps, float dB_drop)
{
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for fade-out-active = %1\n", Properties::fade_out_active.property_id));
Properties::scale_amplitude.property_id = g_quark_from_static_string (X_("scale-amplitude"));
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for scale-amplitude = %1\n", Properties::scale_amplitude.property_id));
+ Properties::fade_out_is_xfade.property_id = g_quark_from_static_string (X_("fade-out-is-xfade"));
+ DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for fade-out-is-xfade = %1\n", Properties::fade_out_is_xfade.property_id));
+ Properties::fade_out_is_short.property_id = g_quark_from_static_string (X_("fade-out-is-short"));
+ DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for fade-out-is-short = %1\n", Properties::fade_out_is_short.property_id));
+ Properties::fade_in_is_xfade.property_id = g_quark_from_static_string (X_("fade-in-is-xfade"));
+ DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for fade-in-is-xfade = %1\n", Properties::fade_in_is_xfade.property_id));
+ Properties::fade_in_is_short.property_id = g_quark_from_static_string (X_("fade-in-is-short"));
+ DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for fade-in-is-short = %1\n", Properties::fade_in_is_short.property_id));
}
void
add_property (_fade_in_active);
add_property (_fade_out_active);
add_property (_scale_amplitude);
+ add_property (_fade_out_is_xfade);
+ add_property (_fade_out_is_short);
+ add_property (_fade_in_is_xfade);
+ add_property (_fade_in_is_short);
}
#define AUDIOREGION_STATE_DEFAULT \
, _default_fade_out (Properties::default_fade_out, true) \
, _fade_in_active (Properties::fade_in_active, true) \
, _fade_out_active (Properties::fade_out_active, true) \
- , _scale_amplitude (Properties::scale_amplitude, 1.0)
+ , _scale_amplitude (Properties::scale_amplitude, 1.0) \
+ , _fade_in_is_xfade (Properties::fade_in_is_xfade, false) \
+ , _fade_out_is_xfade (Properties::fade_out_is_xfade, false) \
+ , _fade_in_is_short (Properties::fade_in_is_short, false) \
+ , _fade_out_is_short (Properties::fade_out_is_short, false)
#define AUDIOREGION_COPY_STATE(other) \
_envelope_active (Properties::envelope_active, other->_envelope_active) \
, _default_fade_out (Properties::default_fade_out, other->_default_fade_out) \
, _fade_in_active (Properties::fade_in_active, other->_fade_in_active) \
, _fade_out_active (Properties::fade_out_active, other->_fade_out_active) \
- , _scale_amplitude (Properties::scale_amplitude, other->_scale_amplitude)
+ , _scale_amplitude (Properties::scale_amplitude, other->_scale_amplitude) \
+ , _fade_in_is_xfade (Properties::fade_in_is_xfade, other->_fade_in_is_xfade) \
+ , _fade_out_is_xfade (Properties::fade_out_is_xfade, other->_fade_out_is_xfade) \
+ , _fade_in_is_short (Properties::fade_in_is_short, other->_fade_in_is_short) \
+ , _fade_out_is_short (Properties::fade_out_is_short, other->_fade_out_is_short)
/* a Session will reset these to its chosen defaults by calling AudioRegion::set_default_fade() */
void
, _envelope (new AutomationList(Evoral::Parameter(EnvelopeAutomation)))
, _fade_in_suspended (0)
, _fade_out_suspended (0)
- , _fade_in_is_xfade (false)
- , _fade_out_is_xfade (false)
{
init ();
assert (_sources.size() == _master_sources.size());
, _envelope (new AutomationList(Evoral::Parameter(EnvelopeAutomation)))
, _fade_in_suspended (0)
, _fade_out_suspended (0)
- , _fade_in_is_xfade (false)
- , _fade_out_is_xfade (false)
{
init ();
assert (_sources.size() == _master_sources.size());
, _envelope (new AutomationList (*other->_envelope, 0, other->_length))
, _fade_in_suspended (0)
, _fade_out_suspended (0)
- , _fade_in_is_xfade (false)
- , _fade_out_is_xfade (false)
{
/* don't use init here, because we got fade in/out from the other region
*/
, _envelope (new AutomationList (*other->_envelope, offset, other->_length))
, _fade_in_suspended (0)
, _fade_out_suspended (0)
- , _fade_in_is_xfade (false)
- , _fade_out_is_xfade (false)
{
/* don't use init here, because we got fade in/out from the other region
*/
, _envelope (new AutomationList (*other->_envelope))
, _fade_in_suspended (0)
, _fade_out_suspended (0)
- , _fade_in_is_xfade (false)
- , _fade_out_is_xfade (false)
{
/* make-a-sort-of-copy-with-different-sources constructor (used by audio filter) */
, _envelope (new AutomationList(Evoral::Parameter(EnvelopeAutomation)))
, _fade_in_suspended (0)
, _fade_out_suspended (0)
- , _fade_in_is_xfade (false)
- , _fade_out_is_xfade (false)
{
init ();
}
- /* MIX THE REGION BODY FROM mixdown_buffer INTO buf */
+ /* MIX OR COPY THE REGION BODY FROM mixdown_buffer INTO buf */
framecnt_t const N = to_read - fade_in_limit - fade_out_limit;
if (N > 0) {
}
child = node.add_child (X_("FadeIn"));
- child->add_property ("is-xfade", (_fade_in_is_xfade ? "yes" : "no"));
if (_default_fade_in) {
child->add_property ("default", "yes");
}
child = node.add_child (X_("FadeOut"));
- child->add_property ("is-xfade", (_fade_out_is_xfade ? "yes" : "no"));
if (_default_fade_out) {
child->add_property ("default", "yes");
}
}
- if ((prop = child->property ("is-xfade")) != 0) {
- _fade_in_is_xfade = string_is_affirmative (prop->value());
- } else {
- _fade_in_is_xfade = false;
- }
-
if ((prop = child->property ("active")) != 0) {
if (string_is_affirmative (prop->value())) {
set_fade_in_active (true);
}
}
+ /* legacy a3 */
+
+ if ((prop = child->property ("is-xfade")) != 0) {
+ _fade_in_is_xfade = string_is_affirmative (prop->value());
+ }
+
} else if (child->name() == "FadeOut") {
_fade_out->clear ();
_fade_out->set_state (*grandchild, version);
}
}
-
- if ((prop = child->property ("is-xfade")) != 0) {
- _fade_out_is_xfade = string_is_affirmative (prop->value());
- } else {
- _fade_out_is_xfade = false;
- }
-
- if ((prop = child->property ("active")) != 0) {
+
+ if ((prop = child->property ("active")) != 0) {
if (string_is_affirmative (prop->value())) {
set_fade_out_active (true);
} else {
}
}
+ /* legacy a3 */
+
+ if ((prop = child->property ("is-xfade")) != 0) {
+ _fade_out_is_xfade = string_is_affirmative (prop->value());
+ }
+
} else if (child->name() == "InvFadeIn") {
XMLNode* grandchild = child->child ("AutomationList");
if (grandchild) {
if (_session.config.get_xfade_model() == FullCrossfade &&
_session.config.get_auto_xfade() &&
- _fade_in_is_xfade) {
+ _fade_in_is_xfade && !_fade_in_is_short) {
/* trim a single other region below us to the new start
of the fade.
if (_session.config.get_xfade_model() == FullCrossfade &&
_session.config.get_auto_xfade() &&
- _fade_out_is_xfade) {
+ _fade_out_is_xfade && !_fade_out_is_short) {
/* trim a single other region below us to the new start
of the fade.
{
_fade_in_suspended = 0;
_fade_in_is_xfade = false;
+ _fade_in_is_short = true;
set_fade_in (FadeLinear, 64);
}
{
_fade_out_suspended = 0;
_fade_out_is_xfade = false;
+ _fade_out_is_short = true;
set_fade_out (FadeLinear, 64);
}
void
AudioRegion::set_fade_in_is_xfade (bool yn)
{
+ if (yn == _fade_in_is_xfade) {
+ return;
+ }
+
_fade_in_is_xfade = yn;
+ send_change (PropertyChange (Properties::fade_in_is_xfade));
}
void
AudioRegion::set_fade_out_is_xfade (bool yn)
{
+ if (yn == _fade_out_is_xfade) {
+ return;
+ }
+
_fade_out_is_xfade = yn;
+ send_change (PropertyChange (Properties::fade_out_is_xfade));
+}
+
+void
+AudioRegion::set_fade_in_is_short (bool yn)
+{
+ if (yn == _fade_in_is_short) {
+ return;
+ }
+
+ _fade_in_is_short = yn;
+ send_change (PropertyChange (Properties::fade_in_is_short));
+
+}
+
+void
+AudioRegion::set_fade_out_is_short (bool yn)
+{
+ if (yn == _fade_out_is_short) {
+ return;
+ }
+
+ _fade_out_is_short = yn;
+ send_change (PropertyChange (Properties::fade_out_is_short));
}
boost::shared_ptr<Region>