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