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

Don't pass whole TimeTrack to Ruler or Mixer...

... they need only the information in a (Bounded)Envelope.
This commit is contained in:
Paul Licameli
2019-06-06 09:21:01 -04:00
parent 5ae606cf53
commit 46bf5a82fc
17 changed files with 142 additions and 123 deletions

View File

@@ -58,11 +58,12 @@ TimeTrack::TimeTrack(const std::shared_ptr<DirManager> &projDirManager, const Zo
{
mHeight = 100;
mEnvelope = std::make_unique<BoundedEnvelope>(true, TIMETRACK_MIN, TIMETRACK_MAX, 1.0);
SetRangeLower( 0.9 );
SetRangeUpper( 1.1 );
mDisplayLog = false;
mEnvelope = std::make_unique<BoundedEnvelope>(true, TIMETRACK_MIN, TIMETRACK_MAX, 1.0);
mEnvelope->SetTrackLen(DBL_MAX);
mEnvelope->SetOffset(0);
@@ -88,6 +89,10 @@ TimeTrack::TimeTrack(const TimeTrack &orig, double *pT0, double *pT1)
}
else
mEnvelope = std::make_unique<BoundedEnvelope>( *orig.mEnvelope );
SetRangeLower(orig.GetRangeLower());
SetRangeUpper(orig.GetRangeUpper());
mEnvelope->SetTrackLen( len );
mEnvelope->SetOffset(0);
@@ -104,8 +109,6 @@ void TimeTrack::Init(const TimeTrack &orig)
Track::Init(orig);
SetDefaultName(orig.GetDefaultName());
SetName(orig.GetName());
SetRangeLower(orig.GetRangeLower());
SetRangeUpper(orig.GetRangeUpper());
SetDisplayLog(orig.GetDisplayLog());
}
@@ -188,22 +191,6 @@ void TimeTrack::SetInterpolateLog(bool interpolateLog) {
mEnvelope->SetExponential(interpolateLog);
}
//Compute the (average) warp factor between two non-warped time points
double TimeTrack::ComputeWarpFactor(double t0, double t1) const
{
return GetEnvelope()->AverageOfInverse(t0, t1);
}
double TimeTrack::ComputeWarpedLength(double t0, double t1) const
{
return GetEnvelope()->IntegralOfInverse(t0, t1);
}
double TimeTrack::SolveWarpedLength(double t0, double length) const
{
return GetEnvelope()->SolveIntegralOfInverse(t0, length);
}
bool TimeTrack::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
{
if (!wxStrcmp(tag, wxT("timetrack"))) {
@@ -335,7 +322,7 @@ void TimeTrack::Draw
// than the current value.
mRuler->SetFlip(GetHeight() > 75 ? true : true); // MB: so why don't we just call Invalidate()? :)
mRuler->SetTickColour( theTheme.Colour( clrTrackPanelText ));
mRuler->Draw(dc, this);
mRuler->Draw(dc, GetEnvelope());
Doubles envValues{ size_t(mid.width) };
EnvelopeEditor::GetValues( *GetEnvelope(),