1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-17 14:11:13 +01:00

WaveTrack::Get, WaveClip::GetSamples take a mayThrow=true argument...

... and pass non-default in all needed places.

Don't throw, don't put up error dialogs, in drawing or hit-test code.
This commit is contained in:
Paul Licameli
2017-03-20 10:54:03 -04:00
parent 98d1468a01
commit 39b8d99a56
10 changed files with 88 additions and 60 deletions

View File

@@ -1980,12 +1980,14 @@ float WaveTrack::GetRMS(double t0, double t1, bool mayThrow) const
}
bool WaveTrack::Get(samplePtr buffer, sampleFormat format,
sampleCount start, size_t len, fillFormat fill ) const
sampleCount start, size_t len, fillFormat fill,
bool mayThrow) const
{
// Simple optimization: When this buffer is completely contained within one clip,
// don't clear anything (because we won't have to). Otherwise, just clear
// everything to be on the safe side.
bool doClear = true;
bool result = true;
for (const auto &clip: mClips)
{
if (start >= clip->GetStartSample() && start+len <= clip->GetEndSample())
@@ -2046,15 +2048,12 @@ bool WaveTrack::Get(samplePtr buffer, sampleFormat format,
(samplePtr)(((char*)buffer) +
startDelta.as_size_t() *
SAMPLE_SIZE(format)),
format, inclipDelta, samplesToCopy.as_size_t() ))
{
wxASSERT(false); // should always work
return false;
}
format, inclipDelta, samplesToCopy.as_size_t(), mayThrow ))
result = false;
}
}
return true;
return result;
}
bool WaveTrack::Set(samplePtr buffer, sampleFormat format,