mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-16 08:34:10 +02:00
Remove friends from Envelope
This commit is contained in:
parent
7ed99c6e8f
commit
d28ae00d88
@ -173,6 +173,8 @@ public:
|
|||||||
|
|
||||||
bool IsDirty() const;
|
bool IsDirty() const;
|
||||||
|
|
||||||
|
void Clear() { mEnv.clear(); }
|
||||||
|
|
||||||
/** \brief Add a point at a particular absolute time coordinate */
|
/** \brief Add a point at a particular absolute time coordinate */
|
||||||
int InsertOrReplace(double when, double value)
|
int InsertOrReplace(double when, double value)
|
||||||
{ return InsertOrReplaceRelative( when - mOffset, value ); }
|
{ return InsertOrReplaceRelative( when - mOffset, value ); }
|
||||||
@ -191,16 +193,15 @@ public:
|
|||||||
/** \brief Return number of points */
|
/** \brief Return number of points */
|
||||||
size_t GetNumberOfPoints() const;
|
size_t GetNumberOfPoints() const;
|
||||||
|
|
||||||
private:
|
|
||||||
int InsertOrReplaceRelative(double when, double value);
|
|
||||||
|
|
||||||
friend class EnvelopeEditor;
|
|
||||||
/** \brief Accessor for points */
|
/** \brief Accessor for points */
|
||||||
const EnvPoint &operator[] (int index) const
|
const EnvPoint &operator[] (int index) const
|
||||||
{
|
{
|
||||||
return mEnv[index];
|
return mEnv[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
int InsertOrReplaceRelative(double when, double value);
|
||||||
|
|
||||||
std::pair<int, int> EqualRange( double when, double sampleDur ) const;
|
std::pair<int, int> EqualRange( double when, double sampleDur ) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -219,11 +220,11 @@ public:
|
|||||||
bool GetDragPointValid() const { return mDragPointValid; }
|
bool GetDragPointValid() const { return mDragPointValid; }
|
||||||
// Modify the dragged point and change its value.
|
// Modify the dragged point and change its value.
|
||||||
// But consistency constraints may move it less then you ask for.
|
// But consistency constraints may move it less then you ask for.
|
||||||
|
|
||||||
private:
|
|
||||||
void MoveDragPoint(double newWhen, double value);
|
void MoveDragPoint(double newWhen, double value);
|
||||||
// May delete the drag point. Restores envelope consistency.
|
// May delete the drag point. Restores envelope consistency.
|
||||||
void ClearDragPoint();
|
void ClearDragPoint();
|
||||||
|
|
||||||
|
private:
|
||||||
void AddPointAtEnd( double t, double val );
|
void AddPointAtEnd( double t, double val );
|
||||||
void CopyRange(const Envelope &orig, size_t begin, size_t end);
|
void CopyRange(const Envelope &orig, size_t begin, size_t end);
|
||||||
// relative time
|
// relative time
|
||||||
@ -254,8 +255,6 @@ private:
|
|||||||
int mDragPoint { -1 };
|
int mDragPoint { -1 };
|
||||||
|
|
||||||
mutable int mSearchGuess { -2 };
|
mutable int mSearchGuess { -2 };
|
||||||
friend class GetInfoCommand;
|
|
||||||
friend class SetEnvelopeCommand;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void EnvPoint::SetVal( Envelope *pEnvelope, double val )
|
inline void EnvPoint::SetVal( Envelope *pEnvelope, double val )
|
||||||
|
@ -567,12 +567,12 @@ bool GetInfoCommand::SendEnvelopes(const CommandContext &context)
|
|||||||
Envelope * pEnv = pClip->GetEnvelope();
|
Envelope * pEnv = pClip->GetEnvelope();
|
||||||
context.StartField( "points" );
|
context.StartField( "points" );
|
||||||
context.StartArray();
|
context.StartArray();
|
||||||
double offset = pEnv->mOffset;
|
double offset = pEnv->GetOffset();
|
||||||
for( size_t k=0;k<pEnv->mEnv.size(); k++)
|
for( size_t k = 0; k < pEnv->GetNumberOfPoints(); k++)
|
||||||
{
|
{
|
||||||
context.StartStruct( );
|
context.StartStruct( );
|
||||||
context.AddItem( pEnv->mEnv[k].GetT()+offset, "t" );
|
context.AddItem( (*pEnv)[k].GetT()+offset, "t" );
|
||||||
context.AddItem( pEnv->mEnv[k].GetVal(), "y" );
|
context.AddItem( (*pEnv)[k].GetVal(), "y" );
|
||||||
context.EndStruct();
|
context.EndStruct();
|
||||||
}
|
}
|
||||||
context.EndArray();
|
context.EndArray();
|
||||||
|
@ -69,7 +69,7 @@ bool SetEnvelopeCommand::ApplyInner( const CommandContext &, Track * t )
|
|||||||
// Inside this IF is where we actually apply the command
|
// Inside this IF is where we actually apply the command
|
||||||
Envelope* pEnv = pClip->GetEnvelope();
|
Envelope* pEnv = pClip->GetEnvelope();
|
||||||
if( bHasDelete && mbDelete )
|
if( bHasDelete && mbDelete )
|
||||||
pEnv->mEnv.clear();
|
pEnv->Clear();
|
||||||
if( bHasT && bHasV )
|
if( bHasT && bHasV )
|
||||||
pEnv->InsertOrReplace( mT, pEnv->ClampValue( mV ) );
|
pEnv->InsertOrReplace( mT, pEnv->ClampValue( mV ) );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user