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

Convert sampleCount <-> floating or -> long long explicitly ...

... A non-narrowing conversion out to long long is a necessity, but the
conversions to float and double are simply conveniences.

Conversion from floating is explicit, to avoid unintended consequences with
arithmetic operators, when later sampleCount ceases to be an alias for an
integral type.

Some conversions are not made explicit, where I expect to change the type of
the variable later to have mere size_t width.
This commit is contained in:
Paul Licameli
2016-08-25 08:53:59 -04:00
parent 99dca62cff
commit 78be459fa1
53 changed files with 329 additions and 207 deletions

View File

@@ -479,7 +479,7 @@ bool EffectChangeSpeed::ProcessOne(WaveTrack * track,
//Get the length of the selection (as double). len is
//used simple to calculate a progress meter, so it is easier
//to make it a double now than it is to do it later
double len = (double)(end - start);
auto len = (end - start).as_double();
// Initiate processing buffers, most likely shorter than
// the length of the selection being processed.
@@ -524,7 +524,7 @@ bool EffectChangeSpeed::ProcessOne(WaveTrack * track,
samplePos += results.first;
// Update the Progress meter
if (TrackProgress(mCurTrackNum, (samplePos - start) / len)) {
if (TrackProgress(mCurTrackNum, (samplePos - start).as_double() / len)) {
bResult = false;
break;
}