mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-02 08:59:28 +02:00
Bug2214: Mix and Render should insert new tracks after old tracks...
... or where the old tracks were, if replacing them This puts the new track in the sync-lock group of the old tracks.
This commit is contained in:
parent
dbdfb26e4a
commit
28e19e3e03
@ -66,6 +66,11 @@ void DoMixAndRender
|
|||||||
// Remove originals, get stats on what tracks were mixed
|
// Remove originals, get stats on what tracks were mixed
|
||||||
|
|
||||||
auto trackRange = tracks.Selected< WaveTrack >();
|
auto trackRange = tracks.Selected< WaveTrack >();
|
||||||
|
|
||||||
|
// But before removing, determine the first track after the removal
|
||||||
|
auto last = *trackRange.rbegin();
|
||||||
|
auto insertionPoint = * ++ tracks.Find( last );
|
||||||
|
|
||||||
auto selectedCount = (trackRange + &Track::IsLeader).size();
|
auto selectedCount = (trackRange + &Track::IsLeader).size();
|
||||||
wxString firstName;
|
wxString firstName;
|
||||||
if (selectedCount > 0)
|
if (selectedCount > 0)
|
||||||
@ -93,6 +98,29 @@ void DoMixAndRender
|
|||||||
pNewRight->SetName(firstName);
|
pNewRight->SetName(firstName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Permute the tracks as needed
|
||||||
|
// The new track appears after the old tracks (or where the old tracks
|
||||||
|
// had been) so that they are in the same sync-lock group
|
||||||
|
if (insertionPoint)
|
||||||
|
{
|
||||||
|
std::vector<TrackNodePointer> arr;
|
||||||
|
arr.reserve( tracks.size() );
|
||||||
|
size_t begin = 0, ii = 0;
|
||||||
|
for (auto iter = tracks.ListOfTracks::begin(),
|
||||||
|
end = tracks.ListOfTracks::end(); iter != end; ++iter) {
|
||||||
|
arr.push_back( {iter, &tracks} );
|
||||||
|
if ( iter->get() == insertionPoint )
|
||||||
|
begin = ii;
|
||||||
|
++ii;
|
||||||
|
}
|
||||||
|
auto mid = arr.end();
|
||||||
|
--mid;
|
||||||
|
if (pNewRight)
|
||||||
|
--mid;
|
||||||
|
std::rotate( arr.begin() + begin, mid, arr.end() );
|
||||||
|
tracks.Permute( arr );
|
||||||
|
}
|
||||||
|
|
||||||
// Smart history/undo message
|
// Smart history/undo message
|
||||||
if (selectedCount==1) {
|
if (selectedCount==1) {
|
||||||
auto msg = XO("Rendered all audio in track '%s'").Format( firstName );
|
auto msg = XO("Rendered all audio in track '%s'").Format( firstName );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user