1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-25 08:58:06 +02:00

Prefer "sampleDur" to "sampleTime" for some variable names

This commit is contained in:
Paul Licameli 2017-05-26 13:50:22 -04:00
parent c8f65d821d
commit 9c7e236442
2 changed files with 14 additions and 14 deletions

View File

@ -606,7 +606,7 @@ bool EnvelopeEditor::MouseEvent(const wxMouseEvent & event, wxRect & r,
return false;
}
void Envelope::CollapseRegion( double t0, double t1, double sampleTime )
void Envelope::CollapseRegion( double t0, double t1, double sampleDur )
// NOFAIL-GUARANTEE
{
// This gets called when somebody clears samples.
@ -615,7 +615,7 @@ void Envelope::CollapseRegion( double t0, double t1, double sampleTime )
// For the boundaries of the interval, preserve the left-side limit at the
// start and right-side limit at the end.
const auto epsilon = sampleTime / 2;
const auto epsilon = sampleDur / 2;
t0 = std::max( 0.0, std::min( mTrackLen, t0 - mOffset ) );
t1 = std::max( 0.0, std::min( mTrackLen, t1 - mOffset ) );
@ -983,9 +983,9 @@ void Envelope::GetPoints(double *bufferWhen,
}
}
void Envelope::Cap( double sampleTime )
void Envelope::Cap( double sampleDur )
{
auto range = EqualRange( mTrackLen, sampleTime );
auto range = EqualRange( mTrackLen, sampleDur );
if ( range.first == range.second )
InsertOrReplaceRelative( mTrackLen, GetValueRelative( mTrackLen ) );
}
@ -1061,13 +1061,13 @@ int Envelope::InsertOrReplaceRelative(double when, double value)
return i;
}
std::pair<int, int> Envelope::EqualRange( double when, double sampleTime ) const
std::pair<int, int> Envelope::EqualRange( double when, double sampleDur ) const
{
// Find range of envelope points matching the given time coordinate
// (within an interval of length sampleTime)
// (within an interval of length sampleDur)
// by binary search; if empty, it still indicates where to
// insert.
const auto tolerance = sampleTime / 2;
const auto tolerance = sampleDur / 2;
auto begin = mEnv.begin();
auto end = mEnv.end();
auto first = std::lower_bound(
@ -1090,11 +1090,11 @@ void Envelope::SetOffset(double newOffset)
mOffset = newOffset;
}
void Envelope::SetTrackLen( double trackLen, double sampleTime )
void Envelope::SetTrackLen( double trackLen, double sampleDur )
// NOFAIL-GUARANTEE
{
// Preserve the left-side limit at trackLen.
auto range = EqualRange( trackLen, sampleTime );
auto range = EqualRange( trackLen, sampleDur );
bool needPoint = ( range.first == range.second && trackLen < mTrackLen );
double value;
if ( needPoint )

View File

@ -118,9 +118,9 @@ public:
float zoomMin, float zoomMax, bool mirrored) const;
// Handling Cut/Copy/Paste events
// sampleTime determines when the endpoint of the collapse is near enough
// sampleDur determines when the endpoint of the collapse is near enough
// to an endpoint of the domain, that an extra control point is not needed.
void CollapseRegion(double t0, double t1, double sampleTime);
void CollapseRegion(double t0, double t1, double sampleDur);
void Paste(double t0, const Envelope *e);
void InsertSpace(double t0, double tlen);
@ -128,7 +128,7 @@ public:
// Control
void SetOffset(double newOffset);
void SetTrackLen( double trackLen, double sampleTime = 0.0 );
void SetTrackLen( double trackLen, double sampleDur = 0.0 );
void RescaleValues(double minValue, double maxValue);
void RescaleTimes( double newLength );
@ -148,7 +148,7 @@ public:
(double *buffer, int bufferLen, int leftOffset, const ZoomInfo &zoomInfo) const;
// Guarantee an envelope point at the end of the domain.
void Cap( double sampleTime );
void Cap( double sampleDur );
private:
double GetValueRelative(double t) const;
@ -198,7 +198,7 @@ private:
return mEnv[index];
}
std::pair<int, int> EqualRange( double when, double sampleTime ) const;
std::pair<int, int> EqualRange( double when, double sampleDur ) const;
public:
/** \brief Returns the sets of when and value pairs */