Audacity  2.2.2
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Effect::ModifiedAnalysisTrack Class Reference

#include <Effect.h>

Public Member Functions

 ModifiedAnalysisTrack ()
 
 ModifiedAnalysisTrack (ModifiedAnalysisTrack &&that)
 
LabelTrackget () const
 
void Commit ()
 
 ~ModifiedAnalysisTrack ()
 

Private Member Functions

 ModifiedAnalysisTrack (Effect *pEffect, const LabelTrack *pOrigTrack, const wxString &name)
 
 ModifiedAnalysisTrack (const ModifiedAnalysisTrack &) PROHIBITED
 

Private Attributes

friend Effect
 
EffectmpEffect {}
 
LabelTrackmpTrack {}
 
std::shared_ptr< TrackmpOrigTrack {}
 

Detailed Description

Definition at line 405 of file Effect.h.

Constructor & Destructor Documentation

Effect::ModifiedAnalysisTrack::ModifiedAnalysisTrack ( Effect pEffect,
const LabelTrack pOrigTrack,
const wxString &  name 
)
private

Definition at line 2111 of file Effect.cpp.

References LabelTrack::Copy(), LabelTrack::GetEndTime(), LabelTrack::GetStartTime(), Effect::mTracks, TrackList::Replace(), and LabelTrack::SetOffset().

2112  : mpEffect(pEffect)
2113 {
2114  // copy LabelTrack here, so it can be undone on cancel
2115  auto newTrack = pOrigTrack->Copy(pOrigTrack->GetStartTime(), pOrigTrack->GetEndTime());
2116 
2117  mpTrack = static_cast<LabelTrack*>(newTrack.get());
2118 
2119  // Why doesn't LabelTrack::Copy complete the job? :
2120  mpTrack->SetOffset(pOrigTrack->GetStartTime());
2121  if (!name.empty())
2122  mpTrack->SetName(name);
2123 
2124  // mpOrigTrack came from mTracks which we own but expose as const to subclasses
2125  // So it's okay that we cast it back to const
2126  mpOrigTrack =
2127  pEffect->mTracks->Replace(const_cast<LabelTrack*>(pOrigTrack),
2128  std::move(newTrack) );
2129 }
std::shared_ptr< Track > mpOrigTrack
Definition: Effect.h:429
void SetOffset(double dOffset) override
Definition: LabelTrack.cpp:145
TrackList * mTracks
Definition: Effect.h:505
double GetStartTime() const override
double GetEndTime() const override
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:113
ListOfTracks::value_type Replace(Track *t, ListOfTracks::value_type &&with)
Definition: Track.cpp:963
Track::Holder Copy(double t0, double t1, bool forClipboard=true) const override
void SetName(const wxString &n)
Definition: Track.h:272
const wxChar * name
Definition: Distortion.cpp:94
Effect::ModifiedAnalysisTrack::ModifiedAnalysisTrack ( const ModifiedAnalysisTrack )
private
Effect::ModifiedAnalysisTrack::ModifiedAnalysisTrack ( )
Effect::ModifiedAnalysisTrack::ModifiedAnalysisTrack ( ModifiedAnalysisTrack &&  that)

Definition at line 2131 of file Effect.cpp.

2132 {
2133  mpEffect = that.mpEffect;
2134  mpTrack = that.mpTrack;
2135  mpOrigTrack = std::move(that.mpOrigTrack);
2136  that.Commit();
2137 }
std::shared_ptr< Track > mpOrigTrack
Definition: Effect.h:429
Effect::ModifiedAnalysisTrack::~ModifiedAnalysisTrack ( )

Definition at line 2144 of file Effect.cpp.

2145 {
2146  if (mpEffect) {
2147  // not committed -- DELETE the label track
2148  // mpOrigTrack came from mTracks which we own but expose as const to subclasses
2149  // So it's okay that we cast it back to const
2150  mpEffect->mTracks->Replace(mpTrack, std::move(mpOrigTrack));
2151  }
2152 }
std::shared_ptr< Track > mpOrigTrack
Definition: Effect.h:429
TrackList * mTracks
Definition: Effect.h:505
ListOfTracks::value_type Replace(Track *t, ListOfTracks::value_type &&with)
Definition: Track.cpp:963

Member Function Documentation

void Effect::ModifiedAnalysisTrack::Commit ( )

Definition at line 2139 of file Effect.cpp.

Referenced by EffectFindClipping::Process().

2140 {
2141  mpEffect = nullptr;
2142 }
LabelTrack* Effect::ModifiedAnalysisTrack::get ( ) const
inline

Definition at line 418 of file Effect.h.

Referenced by EffectFindClipping::Process().

418 { return mpTrack; }

Member Data Documentation

friend Effect::ModifiedAnalysisTrack::Effect
private

Definition at line 406 of file Effect.h.

Effect* Effect::ModifiedAnalysisTrack::mpEffect {}
private

Definition at line 427 of file Effect.h.

std::shared_ptr<Track> Effect::ModifiedAnalysisTrack::mpOrigTrack {}
private

Definition at line 429 of file Effect.h.

LabelTrack* Effect::ModifiedAnalysisTrack::mpTrack {}
private

Definition at line 428 of file Effect.h.


The documentation for this class was generated from the following files: