mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 07:14:56 +01:00
allow ARDOUR::Filter to be used with MIDI regions/sources
This commit is contained in:
parent
76a0b3c70e
commit
ae32daa148
2 changed files with 39 additions and 43 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue