mirror of
https://github.com/cookiengineer/audacity
synced 2025-12-15 17:11:20 +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:
@@ -64,8 +64,8 @@ array of Ruler::Label.
|
||||
|
||||
#include "../AColor.h"
|
||||
#include "../AllThemeResources.h"
|
||||
#include "../Envelope.h"
|
||||
#include "../NumberScale.h"
|
||||
#include "../TimeTrack.h"
|
||||
#include "../ViewInfo.h"
|
||||
|
||||
using std::min;
|
||||
@@ -954,7 +954,19 @@ void Ruler::Update()
|
||||
Update(NULL);
|
||||
}
|
||||
|
||||
void Ruler::Update(const TimeTrack* timetrack)// Envelope *speedEnv, long minSpeed, long maxSpeed )
|
||||
namespace {
|
||||
double ComputeWarpedLength(const Envelope &env, double t0, double t1)
|
||||
{
|
||||
return env.IntegralOfInverse(t0, t1);
|
||||
}
|
||||
|
||||
double SolveWarpedLength(const Envelope &env, double t0, double length)
|
||||
{
|
||||
return env.SolveIntegralOfInverse(t0, length);
|
||||
}
|
||||
}
|
||||
|
||||
void Ruler::Update(const Envelope* envelope)// Envelope *speedEnv, long minSpeed, long maxSpeed )
|
||||
{
|
||||
const ZoomInfo *zoomInfo = NULL;
|
||||
if (!mLog && mOrientation == wxHORIZONTAL)
|
||||
@@ -1115,8 +1127,8 @@ void Ruler::Update(const TimeTrack* timetrack)// Envelope *speedEnv, long minSpe
|
||||
}
|
||||
else
|
||||
d = mMin - UPP / 2;
|
||||
if (timetrack)
|
||||
warpedD = timetrack->ComputeWarpedLength(0.0, d);
|
||||
if (envelope)
|
||||
warpedD = ComputeWarpedLength(*envelope, 0.0, d);
|
||||
else
|
||||
warpedD = d;
|
||||
// using ints doesn't work, as
|
||||
@@ -1133,8 +1145,8 @@ void Ruler::Update(const TimeTrack* timetrack)// Envelope *speedEnv, long minSpe
|
||||
}
|
||||
else
|
||||
nextD = d + UPP;
|
||||
if (timetrack)
|
||||
warpedD += timetrack->ComputeWarpedLength(d, nextD);
|
||||
if (envelope)
|
||||
warpedD += ComputeWarpedLength(*envelope, d, nextD);
|
||||
else
|
||||
warpedD = nextD;
|
||||
d = nextD;
|
||||
@@ -1290,14 +1302,14 @@ void Ruler::Draw(wxDC& dc)
|
||||
Draw( dc, NULL);
|
||||
}
|
||||
|
||||
void Ruler::Draw(wxDC& dc, const TimeTrack* timetrack)
|
||||
void Ruler::Draw(wxDC& dc, const Envelope* envelope)
|
||||
{
|
||||
mDC = &dc;
|
||||
if( mLength <=0 )
|
||||
return;
|
||||
|
||||
if (!mValid)
|
||||
Update(timetrack);
|
||||
Update(envelope);
|
||||
|
||||
mDC->SetTextForeground( mTickColour );
|
||||
#ifdef EXPERIMENTAL_THEMING
|
||||
|
||||
Reference in New Issue
Block a user