1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-24 23:33:50 +02:00

Sequence::InsertSilence gives strong guarantee

This commit is contained in:
Paul Licameli
2016-11-27 10:39:46 -05:00
parent 160d846643
commit 3c65731f38
3 changed files with 8 additions and 11 deletions

View File

@@ -657,14 +657,16 @@ bool Sequence::SetSilence(sampleCount s0, sampleCount len)
return Set(NULL, mSampleFormat, s0, len);
}
bool Sequence::InsertSilence(sampleCount s0, sampleCount len)
void Sequence::InsertSilence(sampleCount s0, sampleCount len)
// STRONG-GUARANTEE
{
// Quick check to make sure that it doesn't overflow
if (Overflows((mNumSamples.as_double()) + (len.as_double())))
return false;
//THROW_INCONSISTENCY_EXCEPTION
;
if (len <= 0)
return true;
return;
// Create a NEW track containing as much silence as we
// need to insert, and then call Paste to do the insertion.
@@ -700,9 +702,8 @@ bool Sequence::InsertSilence(sampleCount s0, sampleCount len)
sTrack.mNumSamples = pos;
// use STRONG-GUARANTEE
Paste(s0, &sTrack);
return true;
}
bool Sequence::AppendAlias(const wxString &fullPath,