rethink how to load legacy crossfades as new-style xfades
git-svn-id: svn://localhost/ardour2/branches/3.0@12496 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
71dd60c736
commit
bfefff3588
|
@ -669,46 +669,46 @@ AudioPlaylist::set_state (const XMLNode& node, int version)
|
|||
|
||||
XMLProperty* p = (*i)->property (X_("active"));
|
||||
assert (p);
|
||||
|
||||
if (!string_is_affirmative (p->value())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((p = (*i)->property (X_("in"))) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
p = (*i)->property (X_("in"));
|
||||
assert (p);
|
||||
boost::shared_ptr<Region> in = region_by_id (PBD::ID (p->value ()));
|
||||
|
||||
if (!in) {
|
||||
warning << string_compose (_("Legacy crossfade involved an incoming region not present in playlist \"%1\" - crossfade discarded"),
|
||||
name())
|
||||
<< endmsg;
|
||||
continue;
|
||||
}
|
||||
|
||||
boost::shared_ptr<AudioRegion> in_a = boost::dynamic_pointer_cast<AudioRegion> (in);
|
||||
assert (in_a);
|
||||
|
||||
const XMLNodeList c = (*i)->children ();
|
||||
|
||||
p = (*i)->property (X_("out"));
|
||||
assert (p);
|
||||
boost::shared_ptr<Region> out = region_by_id (PBD::ID (p->value ()));
|
||||
if (!in) {
|
||||
warning << string_compose (_("Legacy crossfade involved an outgoing region not present in playlist \"%1\" - crossfade discarded"),
|
||||
name())
|
||||
<< endmsg;
|
||||
continue;
|
||||
}
|
||||
boost::shared_ptr<AudioRegion> out_a = boost::dynamic_pointer_cast<AudioRegion> (out);
|
||||
assert (out_a);
|
||||
|
||||
XMLNodeList c = (*i)->children ();
|
||||
for (XMLNodeConstIterator j = c.begin(); j != c.end(); ++j) {
|
||||
if ((*j)->name() == X_("FadeIn")) {
|
||||
in_a->fade_in()->set_state (**j, version);
|
||||
in_a->set_fade_in_active (true);
|
||||
in_a->set_fade_in_is_xfade (true);
|
||||
} else if ((*j)->name() == X_("FadeOut")) {
|
||||
out_a->fade_out()->set_state (**j, version);
|
||||
out_a->set_fade_out_active (true);
|
||||
out_a->set_fade_out_is_xfade (true);
|
||||
in_a->inverse_fade_in()->set_state (**j, version);
|
||||
}
|
||||
}
|
||||
|
||||
if ((p = (*i)->property ("follow-overlap")) != 0) {
|
||||
in_a->set_fade_in_is_short (!string_is_affirmative (p->value()));
|
||||
} else {
|
||||
in_a->set_fade_in_is_short (false);
|
||||
}
|
||||
|
||||
in_a->set_fade_in_is_xfade (true);
|
||||
in_a->set_fade_in_active (true);
|
||||
cerr << in_a->name() << " from playlist fade in = xfade false\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -78,14 +78,14 @@ reverse_curve (boost::shared_ptr<Evoral::ControlList> dst, boost::shared_ptr<con
|
|||
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);
|
||||
|
@ -94,18 +94,6 @@ generate_inverse_power_curve (boost::shared_ptr<Evoral::ControlList> dst, boost:
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
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)
|
||||
{
|
||||
|
@ -921,8 +909,6 @@ AudioRegion::_set_state (const XMLNode& node, int version, PropertyChange& what_
|
|||
|
||||
if ((prop = child->property ("is-xfade")) != 0) {
|
||||
_fade_in_is_xfade = string_is_affirmative (prop->value());
|
||||
} else {
|
||||
_fade_in_is_xfade = false;
|
||||
}
|
||||
|
||||
} else if (child->name() == "FadeOut") {
|
||||
|
@ -950,8 +936,6 @@ AudioRegion::_set_state (const XMLNode& node, int version, PropertyChange& what_
|
|||
|
||||
if ((prop = child->property ("is-xfade")) != 0) {
|
||||
_fade_out_is_xfade = string_is_affirmative (prop->value());
|
||||
} else {
|
||||
_fade_out_is_xfade = false;
|
||||
}
|
||||
|
||||
} else if (child->name() == "InvFadeIn") {
|
||||
|
|
|
@ -284,9 +284,7 @@ RegionFactory::create (SourceList& srcs, const XMLNode& node)
|
|||
if (ret) {
|
||||
if (ret->set_state (node, Stateful::loading_state_version)) {
|
||||
ret.reset ();
|
||||
cerr << "set state on region failed\n";
|
||||
} else {
|
||||
cerr << "add region " << ret->id() << " to region map\n";
|
||||
map_add (ret);
|
||||
|
||||
/* Don't fiddle with position_lock_style here as the region
|
||||
|
|
Loading…
Reference in New Issue
Block a user