Audacity 3.2.0
WaveTrackLocation.h
Go to the documentation of this file.
1/**********************************************************************
2
3Audacity: A Digital Audio Editor
4
5@file WaveTrackLocation.h
6@brief data cache for clip boundaries attached to WaveTrack
7
8Paul Licameli -- split from WaveTrack.h
9
10**********************************************************************/
11
12#ifndef __AUDACITY_WAVE_TRACK_LOCATION__
13#define __AUDACITY_WAVE_TRACK_LOCATION__
14
15#include "ClientData.h"
16
17class WaveTrack;
18
20
24 };
25
26 explicit
28 (double pos_ = 0.0, LocationType typ_ = locationCutLine,
29 int clipidx1_ = -1, int clipidx2_ = -1)
30 : pos(pos_), typ(typ_), clipidx1(clipidx1_), clipidx2(clipidx2_)
31 {}
32
33 // Position of track location
34 double pos;
35
36 // Type of track location
38
39 // Only for typ==locationMergePoint
40 int clipidx1; // first clip (left one)
41 int clipidx2; // second clip (right one)
42};
43
44inline
46{
47 return a.pos == b.pos &&
48 a.typ == b.typ &&
49 a.clipidx1 == b.clipidx1 &&
50 a.clipidx2 == b.clipidx2;
51}
52
53inline
55{
56 return !( a == b );
57}
58
59class AUDACITY_DLL_API WaveTrackLocations final
60 : public ClientData::Cloneable< ClientData::UniquePtr >
61{
63 std::vector <Location> mDisplayLocationsCache;
64
65public:
66 static WaveTrackLocations &Get( const WaveTrack &track );
67
69 PointerType Clone() const override;
70
71 // Cache special locations (e.g. cut lines) for later speedy access
72 void Update( const WaveTrack &track );
73
74 // Get cached locations
75 const std::vector<Location> &Get() const
76 { return mDisplayLocationsCache; }
77};
78
79#endif
Utility ClientData::Site to register hooks into a host class that attach client data.
bool operator==(const WaveTrackLocation &a, const WaveTrackLocation &b)
bool operator!=(const WaveTrackLocation &a, const WaveTrackLocation &b)
A Track that contains audio waveform data.
Definition: WaveTrack.h:51
const std::vector< Location > & Get() const
~WaveTrackLocations() override
std::vector< Location > mDisplayLocationsCache
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:196
A convenient base class defining abstract virtual Clone() for a given kind of pointer.
Definition: ClientData.h:48
virtual PointerType Clone() const =0
ClientData::UniquePtr< Base > PointerType
Definition: ClientData.h:50
WaveTrackLocation(double pos_=0.0, LocationType typ_=locationCutLine, int clipidx1_=-1, int clipidx2_=-1)