mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-22 15:38:02 +02:00
Fix the new Truncate Silence
This commit is contained in:
parent
513d1c548f
commit
cdc8142940
@ -28,6 +28,7 @@
|
||||
#include <wx/valgen.h>
|
||||
|
||||
#include "../Prefs.h"
|
||||
#include "../Project.h"
|
||||
#include "../ShuttleGui.h"
|
||||
#include "../WaveTrack.h"
|
||||
#include "../widgets/valnum.h"
|
||||
@ -272,12 +273,15 @@ bool EffectTruncSilence::ProcessIndependently()
|
||||
{
|
||||
unsigned nGroups = 0;
|
||||
|
||||
const bool syncLock = ::GetActiveProject()->IsSyncLocked();
|
||||
|
||||
// Check if it's permissible
|
||||
{
|
||||
SelectedTrackListOfKindIterator iter(Track::Wave, mTracks);
|
||||
for (Track *track = iter.First(); track;
|
||||
track = iter.Next(true) // skip linked tracks
|
||||
) {
|
||||
if (syncLock) {
|
||||
Track *const link = track->GetLink();
|
||||
SyncLockedTracksIterator syncIter(mTracks);
|
||||
for (Track *track2 = syncIter.First(track); track2; track2 = syncIter.Next()) {
|
||||
@ -288,6 +292,7 @@ bool EffectTruncSilence::ProcessIndependently()
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
++nGroups;
|
||||
}
|
||||
@ -318,10 +323,18 @@ bool EffectTruncSilence::ProcessIndependently()
|
||||
if (!FindSilences(silences, track, last))
|
||||
return false;
|
||||
// Treat tracks in the sync lock group only
|
||||
Track *groupFirst, *groupLast;
|
||||
if (syncLock) {
|
||||
SyncLockedTracksIterator syncIter(mOutputTracks);
|
||||
Track *const syncFirst = syncIter.First(track);
|
||||
groupFirst = syncIter.First(track);
|
||||
groupLast = syncIter.Last(track);
|
||||
}
|
||||
else {
|
||||
groupFirst = track;
|
||||
groupLast = last;
|
||||
}
|
||||
double totalCutLen = 0.0;
|
||||
if (!DoRemoval(silences, iGroup, nGroups, syncFirst, syncIter.Last(), totalCutLen))
|
||||
if (!DoRemoval(silences, iGroup, nGroups, groupFirst, groupLast, totalCutLen))
|
||||
return false;
|
||||
newT1 = std::max(newT1, mT1 - totalCutLen);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user