Fix duplicate undo/redo when stretching multiple regions
Previously, when running timefx on multiple regions on the same track, undo commands accumulated for each region in the playlist. Resulting in duplicate actions on undo/redo. ``` <UndoTransaction tv-sec="1649607270" tv-usec="646684" name="pitch shift"> <StatefulDiffCommand obj-id="1690" type-name="ARDOUR::AudioPlaylist"> <Changes> <Regions> <Add id="4046"/> <Remove id="2284"/> </Regions> </Changes> </StatefulDiffCommand> <StatefulDiffCommand obj-id="1690" type-name="ARDOUR::AudioPlaylist"> <Changes> <Regions> <Add id="4046"/> <Add id="4057"/> <Remove id="2284"/> <Remove id="2388"/> </Regions> </Changes> </StatefulDiffCommand> ... ```
This commit is contained in:
parent
91e1083cb1
commit
0e8c7272eb
|
@ -358,13 +358,6 @@ Editor::do_timefx ()
|
|||
|
||||
uint32_t const N = current_timefx->regions.size ();
|
||||
|
||||
for (RegionList::const_iterator i = current_timefx->regions.begin(); i != current_timefx->regions.end(); ++i) {
|
||||
boost::shared_ptr<Playlist> playlist = (*i)->playlist();
|
||||
if (playlist) {
|
||||
playlist->clear_changes ();
|
||||
}
|
||||
}
|
||||
|
||||
for (RegionList::const_iterator i = current_timefx->regions.begin(); i != current_timefx->regions.end(); ++i) {
|
||||
|
||||
boost::shared_ptr<AudioRegion> region = boost::dynamic_pointer_cast<AudioRegion> (*i);
|
||||
|
@ -427,8 +420,9 @@ Editor::do_timefx ()
|
|||
boost::shared_ptr<Region> region = i->first;
|
||||
boost::shared_ptr<Region> new_region = i->second;
|
||||
boost::shared_ptr<Playlist> playlist = region->playlist();
|
||||
playlist->replace_region (region, new_region, region->position());
|
||||
|
||||
playlist->clear_changes ();
|
||||
playlist->replace_region (region, new_region, region->position());
|
||||
PBD::StatefulDiffCommand* cmd = new StatefulDiffCommand (playlist);
|
||||
_session->add_command (cmd);
|
||||
if (!cmd->empty ()) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user