X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fcrossfade.cc;h=67ccea937182d4953fc6017454f554a9a1fc6cd0;hb=e528e5038fa791b07bc9f00f64a39227d66f49b3;hp=601ea86f6b4cb24183fbd7cc5fccac4ba84a1cbf;hpb=afcbdcf850fc8e279a56e6efd6c7cb32a728c3ae;p=ardour.git diff --git a/libs/ardour/crossfade.cc b/libs/ardour/crossfade.cc index 601ea86f6b..67ccea9371 100644 --- a/libs/ardour/crossfade.cc +++ b/libs/ardour/crossfade.cc @@ -29,6 +29,7 @@ #include "ardour/utils.h" #include "ardour/session.h" #include "ardour/source.h" +#include "ardour/region_factory.h" #include "i18n.h" #include @@ -124,7 +125,7 @@ Crossfade::Crossfade (boost::shared_ptr a, boost::shared_ptr -inf..+6dB @@ -132,7 +133,7 @@ Crossfade::Crossfade (const Playlist& playlist, XMLNode& node) { boost::shared_ptr r; - XMLProperty* prop; + XMLProperty const * prop; LocaleGuard lg (X_("POSIX")); /* we have to find the in/out regions before we can do anything else */ @@ -144,8 +145,17 @@ Crossfade::Crossfade (const Playlist& playlist, XMLNode& node) PBD::ID id (prop->value()); - if ((r = playlist.find_region (id)) == 0) { - error << string_compose (_("Crossfade: no \"in\" region %1 found in playlist %2"), id, playlist.name()) + r = playlist.find_region (id); + + if (!r) { + /* the `in' region is not in a playlist, which probably means that this crossfade + is in the undo record, so we have to find the region in the global region map. + */ + r = RegionFactory::region_by_id (id); + } + + if (!r) { + error << string_compose (_("Crossfade: no \"in\" region %1 found in playlist %2 nor in region map"), id, playlist.name()) << endmsg; throw failed_constructor(); } @@ -161,8 +171,14 @@ Crossfade::Crossfade (const Playlist& playlist, XMLNode& node) PBD::ID id2 (prop->value()); - if ((r = playlist.find_region (id2)) == 0) { - error << string_compose (_("Crossfade: no \"out\" region %1 found in playlist %2"), id2, playlist.name()) + r = playlist.find_region (id2); + + if (!r) { + r = RegionFactory::region_by_id (id2); + } + + if (!r) { + error << string_compose (_("Crossfade: no \"out\" region %1 found in playlist %2 nor in region map"), id2, playlist.name()) << endmsg; throw failed_constructor(); }