Audacity 3.2.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ModifiedAnalysisTrack Class Reference

#include <AnalysisTracks.h>

Collaboration diagram for ModifiedAnalysisTrack:
[legend]

Public Member Functions

 ModifiedAnalysisTrack (Effect *pEffect, const LabelTrack &origTrack, const wxString &name)
 
 ModifiedAnalysisTrack ()
 
 ModifiedAnalysisTrack (ModifiedAnalysisTrack &&that)
 
LabelTrackget () const
 
void Commit ()
 
 ~ModifiedAnalysisTrack ()
 

Private Member Functions

 ModifiedAnalysisTrack (const ModifiedAnalysisTrack &)=delete
 

Private Attributes

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

Detailed Description

Definition at line 55 of file AnalysisTracks.h.

Constructor & Destructor Documentation

◆ ModifiedAnalysisTrack() [1/4]

ModifiedAnalysisTrack::ModifiedAnalysisTrack ( const ModifiedAnalysisTrack )
privatedelete

◆ ModifiedAnalysisTrack() [2/4]

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

Definition at line 59 of file AnalysisTracks.cpp.

61 : mpEffect(pEffect)
62{
63 // copy LabelTrack here, so it can be undone on cancel
64 const auto startTime = origTrack.GetStartTime();
65 auto newTrack = origTrack.Copy(startTime, origTrack.GetEndTime());
66
67 mpTrack = static_cast<LabelTrack*>(newTrack.get());
68
69 // Why doesn't LabelTrack::Copy complete the job? :
70 mpTrack->MoveTo(startTime);
71 if (!name.empty())
73
74 // mpOrigTrack came from mTracks which we own but expose as const to subclasses
75 // So it's okay that we cast it back to const
77 pEffect->mTracks->ReplaceOne(const_cast<LabelTrack&>(origTrack),
78 std::move(*TrackList::Temporary(nullptr, newTrack)));
79}
wxString name
Definition: TagsEditor.cpp:166
double GetEndTime() const
Get the maximum of End() values of intervals, or 0 when none.
Definition: Channel.cpp:61
double GetStartTime() const
Get the minimum of Start() values of intervals, or 0 when none.
Definition: Channel.cpp:50
std::shared_ptr< TrackList > mTracks
Definition: EffectBase.h:116
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:98
Track::Holder Copy(double t0, double t1, bool forClipboard=true) const override
Create new tracks and don't modify this track.
Definition: LabelTrack.cpp:837
void MoveTo(double dOffset) override
Change start time to given time point.
Definition: LabelTrack.cpp:197
std::shared_ptr< Track > mpOrigTrack
void SetName(const wxString &n)
Definition: Track.cpp:69
static TrackListHolder Temporary(AudacityProject *pProject, const Track::Holder &pTrack={})
Definition: Track.cpp:858

References LabelTrack::Copy(), ChannelGroup::GetEndTime(), ChannelGroup::GetStartTime(), LabelTrack::MoveTo(), mpOrigTrack, mpTrack, EffectBase::mTracks, name, Track::SetName(), and TrackList::Temporary().

Here is the call graph for this function:

◆ ModifiedAnalysisTrack() [3/4]

ModifiedAnalysisTrack::ModifiedAnalysisTrack ( )

◆ ModifiedAnalysisTrack() [4/4]

ModifiedAnalysisTrack::ModifiedAnalysisTrack ( ModifiedAnalysisTrack &&  that)

Definition at line 81 of file AnalysisTracks.cpp.

82{
83 mpEffect = that.mpEffect;
84 mpTrack = that.mpTrack;
85 mpOrigTrack = std::move(that.mpOrigTrack);
86 that.Commit();
87}

References mpEffect, mpOrigTrack, and mpTrack.

◆ ~ModifiedAnalysisTrack()

ModifiedAnalysisTrack::~ModifiedAnalysisTrack ( )

Definition at line 94 of file AnalysisTracks.cpp.

95{
96 if (mpEffect && mpTrack) {
97 // not committed -- DELETE the label track
98 // mpOrigTrack came from mTracks which we own but expose as const to subclasses
99 // So it's okay that we cast it back to const
100 mpEffect->mTracks->ReplaceOne(*mpTrack,
101 std::move(*TrackList::Temporary(nullptr, mpOrigTrack)));
102 }
103}

References mpEffect, mpOrigTrack, mpTrack, EffectBase::mTracks, and TrackList::Temporary().

Here is the call graph for this function:

Member Function Documentation

◆ Commit()

void ModifiedAnalysisTrack::Commit ( )

Definition at line 89 of file AnalysisTracks.cpp.

90{
91 mpEffect = nullptr;
92}

References mpEffect.

◆ get()

LabelTrack * ModifiedAnalysisTrack::get ( ) const
inline

Definition at line 66 of file AnalysisTracks.h.

66{ return mpTrack; }

Member Data Documentation

◆ mpEffect

Effect* ModifiedAnalysisTrack::mpEffect {}
private

Definition at line 75 of file AnalysisTracks.h.

Referenced by Commit(), ModifiedAnalysisTrack(), and ~ModifiedAnalysisTrack().

◆ mpOrigTrack

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

Definition at line 77 of file AnalysisTracks.h.

Referenced by ModifiedAnalysisTrack(), and ~ModifiedAnalysisTrack().

◆ mpTrack

LabelTrack* ModifiedAnalysisTrack::mpTrack {}
private

Definition at line 76 of file AnalysisTracks.h.

Referenced by ModifiedAnalysisTrack(), and ~ModifiedAnalysisTrack().


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