allow ARDOUR::Filter to be used with MIDI regions/sources

This commit is contained in:
Paul Davis 2022-04-20 17:09:14 -06:00
parent 76a0b3c70e
commit ae32daa148
2 changed files with 39 additions and 43 deletions

View file

@ -6155,15 +6155,14 @@ Editor::apply_filter (Filter& filter, string command, ProgressReporter* progress
RegionSelection::iterator tmp = r;
++tmp;
AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*r);
if (arv) {
boost::shared_ptr<Playlist> playlist = arv->region()->playlist();
RegionView* const rv = *r;
boost::shared_ptr<Playlist> playlist = rv->region()->playlist();
if (progress) {
progress->descend (1.0 / N);
}
if (arv->audio_region()->apply (filter, progress) == 0) {
if (rv->region()->apply (filter, progress) == 0) {
playlist->clear_changes ();
playlist->clear_owned_changes ();
@ -6176,7 +6175,7 @@ Editor::apply_filter (Filter& filter, string command, ProgressReporter* progress
if (filter.results.empty ()) {
/* no regions returned; remove the old one */
playlist->remove_region (arv->region ());
// playlist->remove_region (rv->region ());
} else {
@ -6184,7 +6183,7 @@ Editor::apply_filter (Filter& filter, string command, ProgressReporter* progress
std::vector<boost::shared_ptr<Region> >::iterator res = filter.results.begin ();
/* first region replaces the old one */
playlist->replace_region (arv->region(), *res, (*res)->position());
playlist->replace_region (rv->region(), *res, (*res)->position());
++res;
/* add the rest */
@ -6209,7 +6208,6 @@ Editor::apply_filter (Filter& filter, string command, ProgressReporter* progress
if (progress) {
progress->ascend ();
}
}
r = tmp;
++n;

View file

@ -80,8 +80,6 @@ Filter::make_new_sources (boost::shared_ptr<Region> region, SourceList& nsrcs, s
if (aregion) {
sample_rate = aregion->audio_source()->sample_rate();
} else {
return -1;
}
}