Audacity  2.2.0
TimeTrack Class Referencefinal

A kind of Track used to 'warp time'. More...

#include <TimeTrack.h>

Inheritance diagram for TimeTrack:
Track CommonTrackPanelCell XMLTagHandler TrackPanelCell

Public Member Functions

 TimeTrack (const std::shared_ptr< DirManager > &projDirManager, const ZoomInfo *zoomInfo)
 TimeTrack (const TimeTrack &orig, double *pT0=nullptr, double *pT1=nullptr)
 Copy-Constructor - create a NEW TimeTrack:: which is an independent copy of the original. More...
virtual ~TimeTrack ()
Holder Cut (double t0, double t1) override
Holder Copy (double t0, double t1, bool forClipboard) const override
void Clear (double t0, double t1) override
void Paste (double t, const Track *src) override
void Silence (double t0, double t1) override
void InsertSilence (double t, double len) override
std::vector< UIHandlePtrDetailedHitTest (const TrackPanelMouseState &state, const AudacityProject *pProject, int currentTool, bool bMultiTool) override
int GetKind () const override
double GetOffset () const override
void SetOffset (double) override
double GetStartTime () const override
double GetEndTime () const override
void Draw (TrackPanelDrawingContext &context, const wxRect &r, const ZoomInfo &zoomInfo) const
bool HandleXMLTag (const wxChar *tag, const wxChar **attrs) override
void HandleXMLEndTag (const wxChar *tag) override
XMLTagHandlerHandleXMLChild (const wxChar *tag) override
void WriteXML (XMLWriter &xmlFile) const override
EnvelopeGetEnvelope ()
const EnvelopeGetEnvelope () const
double ComputeWarpFactor (double t0, double t1) const
 Compute the integral warp factor between two non-warped time points. More...
double ComputeWarpedLength (double t0, double t1) const
 Compute the duration (in seconds at playback) of the specified region of the track. More...
double SolveWarpedLength (double t0, double length) const
 Compute how much unwarped time must have elapsed if length seconds of warped time has elapsed. More...
double GetRangeLower () const
double GetRangeUpper () const
void SetRangeLower (double lower)
void SetRangeUpper (double upper)
bool GetDisplayLog () const
void SetDisplayLog (bool displayLog)
bool GetInterpolateLog () const
void SetInterpolateLog (bool interpolateLog)
void testMe ()
- Public Member Functions inherited from Track
std::vector< UIHandlePtrHitTest (const TrackPanelMouseState &, const AudacityProject *pProject) finaloverride
std::shared_ptr< TrackPanelCellGetTrackControl ()
std::shared_ptr< TrackPanelCellGetVRulerControl ()
std::shared_ptr< TrackPanelCellGetResizer ()
virtual int GetMinimizedHeight () const
int GetActualHeight () const
int GetIndex () const
void SetIndex (int index)
int GetY () const
void SetY (int y)
int GetHeight () const
virtual void SetHeight (int h)
bool GetMinimized () const
virtual void SetMinimized (bool isMinimized)
TrackGetLink () const
 Track (const std::shared_ptr< DirManager > &projDirManager)
 Track (const Track &orig)
virtual ~Track ()
void Init (const Track &orig)
virtual void Merge (const Track &orig)
wxString GetName () const
void SetName (const wxString &n)
wxString GetDefaultName () const
void SetDefaultName (const wxString &n)
bool GetSelected () const
bool GetLinked () const
virtual void SetSelected (bool s)
void SetLinked (bool l)
virtual int GetChannel () const
void Offset (double t)
void SetChannel (int c)
virtual void SetPan (float)
virtual void SetPanFromChannelType ()
const std::shared_ptr
< DirManager > & 
GetDirManager () const
virtual Holder Cut (double WXUNUSED(t0), double WXUNUSED(t1))=0
virtual Holder Copy (double WXUNUSED(t0), double WXUNUSED(t1), bool forClipboard=true) const =0
virtual void Clear (double WXUNUSED(t0), double WXUNUSED(t1))=0
virtual void Paste (double WXUNUSED(t), const Track *WXUNUSED(src))=0
virtual void SyncLockAdjust (double oldT1, double newT1)
virtual void Silence (double WXUNUSED(t0), double WXUNUSED(t1))=0
virtual void InsertSilence (double WXUNUSED(t), double WXUNUSED(len))=0
virtual bool GetErrorOpening ()
bool IsSyncLockSelected () const
- Public Member Functions inherited from CommonTrackPanelCell
 CommonTrackPanelCell ()
virtual ~CommonTrackPanelCell ()=0
- Public Member Functions inherited from TrackPanelCell
virtual ~TrackPanelCell ()=0
virtual unsigned DoContextMenu (const wxRect &rect, wxWindow *pParent, wxPoint *pPosition)
virtual unsigned CaptureKey (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent)
virtual unsigned KeyDown (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent)
virtual unsigned KeyUp (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent)
virtual unsigned Char (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent)
- Public Member Functions inherited from XMLTagHandler
 XMLTagHandler ()
virtual ~XMLTagHandler ()
virtual void HandleXMLEndTag (const wxChar *WXUNUSED(tag))
virtual void HandleXMLContent (const wxString &WXUNUSED(content))
bool ReadXMLTag (const char *tag, const char **attrs)
void ReadXMLEndTag (const char *tag)
void ReadXMLContent (const char *s, int len)
XMLTagHandlerReadXMLChild (const char *tag)

Protected Member Functions

std::shared_ptr< TrackControlsGetControls () override
< TrackVRulerControls
GetVRulerControls () override
- Protected Member Functions inherited from Track
std::shared_ptr< TrackFindTrack () override
- Protected Member Functions inherited from CommonTrackPanelCell
unsigned HandleWheelRotation (const TrackPanelMouseEvent &event, AudacityProject *pProject) override

Private Types

using Holder = std::unique_ptr< TimeTrack >

Private Member Functions

void Init (const TimeTrack &orig)
 Copy the metadata from another track but not the points. More...
Track::Holder Duplicate () const override

Private Attributes

const ZoomInfo *const mZoomInfo
std::unique_ptr< EnvelopemEnvelope
std::unique_ptr< RulermRuler
double mRangeLower
double mRangeUpper
bool mDisplayLog
bool mRescaleXMLValues
std::weak_ptr< EnvelopeHandlemEnvelopeHandle


class TrackFactory

Additional Inherited Members

- Public Types inherited from Track
enum  { LeftChannel = 0, RightChannel = 1, MonoChannel = 2 }
enum  TrackKindEnum {
  None, Wave, Label, Time,
enum  : unsigned { DefaultHeight = 150 }
using Holder = std::unique_ptr< Track >
- Static Public Member Functions inherited from Track
template<typename Subclass = Track>
static std::shared_ptr< Subclass > Pointer (Track *t)
template<typename Subclass = const Track>
static std::shared_ptr< Subclass > Pointer (const Track *t)
- Public Attributes inherited from Track
wxSize vrulerSize
- Protected Attributes inherited from Track
std::weak_ptr< TrackListmList
TrackNodePointer mNode {}
int mIndex
int mY
int mHeight
wxString mName
wxString mDefaultName
bool mSelected
bool mLinked
bool mMinimized
int mChannel
double mOffset
std::shared_ptr< DirManagermDirManager
std::shared_ptr< TrackControlsmpControls
< TrackVRulerControls
< TrackPanelResizerCell
std::weak_ptr< SelectHandlemSelectHandle
std::weak_ptr< TimeShiftHandlemTimeShiftHandle

Detailed Description

A kind of Track used to 'warp time'.

Member Typedef Documentation

using TimeTrack::Holder = std::unique_ptr<TimeTrack>

Constructor & Destructor Documentation

TimeTrack::TimeTrack ( const std::shared_ptr< DirManager > &  projDirManager,
const ZoomInfo zoomInfo 
TimeTrack::TimeTrack ( const TimeTrack orig,
double *  pT0 = nullptr,
double *  pT1 = nullptr 

Copy-Constructor - create a NEW TimeTrack:: which is an independent copy of the original.

Calls TimeTrack::Init() to copy the track metadata, then does a bunch of manipulations on the Envelope:: and Ruler:: members in order to copy one to the other - unfortunately both lack a copy-constructor to encapsulate this.

origThe original track to copy from
pT0if not null, then the start of the sub-range to copy
pT1if not null, then the end of the sub-range to copy

: Give Ruler:: a copy-constructor instead of this?

References Init(), mEnvelope, mRuler, mZoomInfo, and Ruler::TimeFormat.

TimeTrack::~TimeTrack ( )

Member Function Documentation

void TimeTrack::Clear ( double  t0,
double  t1 
double TimeTrack::ComputeWarpedLength ( double  t0,
double  t1 
) const

Compute the duration (in seconds at playback) of the specified region of the track.

Takes a region of the time track (specified by the unwarped time points in the project), and calculates how long it will actually take to play this region back, taking the time track's warping effects into account.

t0unwarped time to start calculation from
t1unwarped time to stop calculation at
the warped duration in seconds

References GetEnvelope(), and Envelope::IntegralOfInverse().

Referenced by audacityAudioCallback(), AudioIO::StartStream(), and Ruler::Update().

double TimeTrack::ComputeWarpFactor ( double  t0,
double  t1 
) const

Compute the integral warp factor between two non-warped time points.

Calculate the relative length increase of the chosen segment from the original sound. So if this time track has a low value (i.e. makes the sound slower), the NEW warped sound will be longer than the original sound, so the return value of this function is larger.

t0The starting time to calculate from
t1The ending time to calculate to
The relative length increase of the chosen segment from the original sound.

References Envelope::AverageOfInverse(), and GetEnvelope().

Referenced by Mixer::MixVariableRates().

Track::Holder TimeTrack::Copy ( double  t0,
double  t1,
bool  forClipboard 
) const

Referenced by Cut().

Track::Holder TimeTrack::Cut ( double  t0,
double  t1 

References Clear(), and Copy().

std::vector< UIHandlePtr > TimeTrack::DetailedHitTest ( const TrackPanelMouseState state,
const AudacityProject pProject,
int  currentTool,
bool  bMultiTool 
Track::Holder TimeTrack::Duplicate ( ) const

Implements Track.

std::shared_ptr< TrackControls > TimeTrack::GetControls ( )

Implements Track.

References Track::Pointer().

bool TimeTrack::GetDisplayLog ( ) const
double TimeTrack::GetEndTime ( ) const

Implements Track.

Envelope* TimeTrack::GetEnvelope ( )
const Envelope* TimeTrack::GetEnvelope ( ) const

References mEnvelope.

bool TimeTrack::GetInterpolateLog ( ) const
int TimeTrack::GetKind ( ) const

Reimplemented from Track.

References Track::Time.

double TimeTrack::GetOffset ( ) const

Implements Track.

double TimeTrack::GetRangeLower ( ) const
double TimeTrack::GetRangeUpper ( ) const
double TimeTrack::GetStartTime ( ) const

Implements Track.

std::shared_ptr< TrackVRulerControls > TimeTrack::GetVRulerControls ( )

Implements Track.

References Track::Pointer().

XMLTagHandler * TimeTrack::HandleXMLChild ( const wxChar *  tag)

Implements XMLTagHandler.

References mEnvelope.

void TimeTrack::HandleXMLEndTag ( const wxChar *  tag)
void TimeTrack::Init ( const TimeTrack orig)

Copy the metadata from another track but not the points.

Copies the Name, DefaultName, Range and Display data from the source track

origthe TimeTrack to copy from

References Track::GetDefaultName(), GetDisplayLog(), Track::GetName(), GetRangeLower(), GetRangeUpper(), Track::Init(), Track::SetDefaultName(), SetDisplayLog(), Track::SetName(), SetRangeLower(), and SetRangeUpper().

Referenced by TimeTrack().

void TimeTrack::InsertSilence ( double  t,
double  len 

References mEnvelope.

void TimeTrack::Paste ( double  t,
const Track src 
void TimeTrack::SetDisplayLog ( bool  displayLog)
void TimeTrack::SetInterpolateLog ( bool  interpolateLog)
void TimeTrack::SetOffset ( double  )

Reimplemented from Track.

void TimeTrack::SetRangeLower ( double  lower)
void TimeTrack::SetRangeUpper ( double  upper)
void TimeTrack::Silence ( double  t0,
double  t1 
double TimeTrack::SolveWarpedLength ( double  t0,
double  length 
) const

Compute how much unwarped time must have elapsed if length seconds of warped time has elapsed.

t0The unwarped time (seconds from project start) at which to start
lengthHow many seconds of warped time went past.
The end point (in seconds from project start) as unwarped time

References GetEnvelope(), and Envelope::SolveIntegralOfInverse().

Referenced by audacityAudioCallback().

void TimeTrack::WriteXML ( XMLWriter xmlFile) const

Implements Track.

Friends And Related Function Documentation

friend class TrackFactory

Member Data Documentation

bool TimeTrack::mDisplayLog
std::weak_ptr<EnvelopeHandle> TimeTrack::mEnvelopeHandle
double TimeTrack::mRangeLower
double TimeTrack::mRangeUpper
bool TimeTrack::mRescaleXMLValues

Referenced by HandleXMLEndTag(), and HandleXMLTag().

std::unique_ptr<Ruler> TimeTrack::mRuler

Referenced by TimeTrack().

const ZoomInfo* const TimeTrack::mZoomInfo

Referenced by TimeTrack().

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