mirror of
https://github.com/cookiengineer/audacity
synced 2026-01-04 23:27:36 +01: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:
@@ -437,9 +437,9 @@ void SelectionBar::ValuesToControls()
|
||||
{ // mRightTime is the length.
|
||||
// Be sure to take into account the sub-sample offset.
|
||||
// See TimeToLongSamples and LongSamplesToTime but here at the project rate.
|
||||
double t = (sampleCount)floor(mEnd * mRate + 0.5);
|
||||
t -= (sampleCount)floor(mStart * mRate + 0.5);
|
||||
t /= mRate;
|
||||
auto samples = (sampleCount)floor(mEnd * mRate + 0.5);
|
||||
samples -= (sampleCount)floor(mStart * mRate + 0.5);
|
||||
auto t = samples.as_double() / mRate;
|
||||
mRightTime->SetValue(t);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user