Audacity  2.2.0
Track.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  Track.h
6 
7  Dominic Mazzoni
8 
9 **********************************************************************/
10 
11 #ifndef __AUDACITY_TRACK__
12 #define __AUDACITY_TRACK__
13 
14 #include "Audacity.h"
15 
16 #include "MemoryX.h"
17 #include <vector>
18 #include <list>
19 #include <wx/dynarray.h>
20 #include <wx/event.h>
21 #include <wx/gdicmn.h>
22 #include <wx/longlong.h>
23 #include <wx/string.h>
24 
25 #include "Experimental.h"
26 #include "SampleFormat.h"
28 #include "xml/XMLTagHandler.h"
29 
30 #ifdef __WXMSW__
31 #pragma warning(disable:4284)
32 #endif
33 
34 class wxTextFile;
35 class DirManager;
36 class Track;
37 class LabelTrack;
38 class TimeTrack;
39 class TrackControls;
42 class WaveTrack;
43 class NoteTrack;
44 class AudacityProject;
45 class ZoomInfo;
46 
47 class SelectHandle;
48 class TimeShiftHandle;
49 
50 WX_DEFINE_USER_EXPORTED_ARRAY(Track*, TrackArray, class AUDACITY_DLL_API);
51 using WaveTrackArray = std::vector < WaveTrack* > ;
52 
53 class WaveTrackConstArray : public std::vector < const WaveTrack* > {
54 public:
56  // I'd like to use an inherited constructor, but that's not here yet in MSVC compiler...
57 #ifdef __AUDACITY_OLD_STD__
59  (std::initializer_list<value_type> tracks)
60  {
61  reserve(tracks.size());
62  for (const auto &track : tracks)
63  push_back(track);
64  }
65 #else
67  (std::initializer_list<value_type> tracks) : std::vector<value_type>(tracks) {}
68 #endif
69 };
70 
71 using NoteTrackArray = std::vector < NoteTrack* >;
72 
73 #if defined(USE_MIDI)
74 class NoteTrack;
75 #endif
76 
77 class TrackList;
78 
79 using ListOfTracks = std::list< std::shared_ptr< Track > >;
80 
81 using TrackNodePointer = ListOfTracks::iterator;
82 
83 class ViewInfo;
84 
85 class AUDACITY_DLL_API Track /* not final */
86  : public CommonTrackPanelCell, public XMLTagHandler
87 {
88  friend class TrackList;
89  friend class TrackListIterator;
91 
92  // To be TrackDisplay
93  protected:
94  std::weak_ptr<TrackList> mList;
96  int mIndex;
97  int mY;
98  int mHeight;
99 #ifdef EXPERIMENTAL_OUTPUT_DISPLAY
100  int mYv; //For mono a virtual Y value is necessary.
101  int mHeightv; // For mono a virtual height value is necessary.
102  float mPerY; //mY as a percent of mYv + mY
103  bool mVirtualStereo;
104 #endif
105  wxString mName;
106  wxString mDefaultName;
107 
108  bool mSelected;
109 
110  bool mLinked;
112 
113  public:
114 
115  // Given a bare pointer, find a shared_ptr. But this is not possible for
116  // a track not owned by any project, so the result can be null.
117  template<typename Subclass = Track>
118  inline static std::shared_ptr<Subclass> Pointer( Track *t )
119  {
120  if (t) {
121  auto pList = t->mList.lock();
122  if (pList)
123  return std::static_pointer_cast<Subclass>(*t->mNode);
124  }
125  return {};
126  }
127 
128  template<typename Subclass = const Track>
129  inline static std::shared_ptr<Subclass> Pointer( const Track *t )
130  {
131  if (t) {
132  auto pList = t->mList.lock();
133  if (pList) {
134  std::shared_ptr<const Track> p{ *t->mNode };
135  // Let you change the type, but not cast away the const
136  return std::static_pointer_cast<Subclass>(p);
137  }
138  }
139  return {};
140  }
141 
142  // Cause certain overriding tool modes (Zoom; future ones?) to behave
143  // uniformly in all tracks, disregarding track contents.
144  // Do not further override this...
145  std::vector<UIHandlePtr> HitTest
146  (const TrackPanelMouseState &, const AudacityProject *pProject)
147  final override;
148 
149  public:
150 
151  // Rather override this for subclasses:
152  virtual std::vector<UIHandlePtr> DetailedHitTest
153  (const TrackPanelMouseState &,
154  const AudacityProject *pProject, int currentTool, bool bMultiTool)
155  = 0;
156 
157  mutable wxSize vrulerSize;
158 
159  // Return another, associated TrackPanelCell object that implements the
160  // drop-down, close and minimize buttons, etc.
161  std::shared_ptr<TrackPanelCell> GetTrackControl();
162 
163  // Return another, associated TrackPanelCell object that implements the
164  // mouse actions for the vertical ruler
165  std::shared_ptr<TrackPanelCell> GetVRulerControl();
166 
167  // Return another, associated TrackPanelCell object that implements the
168  // click and drag to resize
169  std::shared_ptr<TrackPanelCell> GetResizer();
170 
171  // This just returns a constant and can be overriden by subclasses
172  // to specify a different height for the case that the track is minimized.
173  virtual int GetMinimizedHeight() const;
174  int GetActualHeight() const { return mHeight; }
175 
176  int GetIndex() const;
177  void SetIndex(int index);
178 #ifdef EXPERIMENTAL_OUTPUT_DISPLAY
179  int GetY(bool vStereo = false) const;
180  void SetY(int y, bool vStereo = false);
181  int GetHeight(bool vStereo = false) const;
182  void SetHeight(int h, bool vStereo = false);
183 #else
184  int GetY() const;
185  void SetY(int y);
186  int GetHeight() const;
187  virtual void SetHeight(int h);
188 #endif
189  bool GetMinimized() const;
190  void SetMinimized(bool isMinimized);
191 #ifdef EXPERIMENTAL_OUTPUT_DISPLAY
192  float GetVirtualTrackPercentage() const { return mPerY;}
193  void SetVirtualTrackPercentage(float val) { mPerY = val;}
194  bool GetVirtualStereo() { return mVirtualStereo;}
195  void SetVirtualStereo(bool vStereo) { mVirtualStereo = vStereo;}
196 #endif
197  Track *GetLink() const;
198 
199  private:
200  TrackNodePointer GetNode() const;
201  void SetOwner
202  (const std::weak_ptr<TrackList> &list, TrackNodePointer node);
203 
204  // Keep in Track
205 
206  protected:
207  int mChannel;
208  double mOffset;
209 
210  mutable std::shared_ptr<DirManager> mDirManager;
211 
212  public:
213 #ifdef EXPERIMENTAL_OUTPUT_DISPLAY
214  void ReorderList(bool resize = true);
215 #endif
216 
217  enum
218  {
219  LeftChannel = 0,
220  RightChannel = 1,
221  MonoChannel = 2
222  };
223 
225  {
228 #if defined(USE_MIDI)
229  Note,
230 #endif
233  All
234  };
235 
236  enum : unsigned { DefaultHeight = 150 };
237 
238  Track(const std::shared_ptr<DirManager> &projDirManager);
239  Track(const Track &orig);
240 
241  virtual ~ Track();
242 
243  void Init(const Track &orig);
244 
245  using Holder = std::unique_ptr<Track>;
246  virtual Holder Duplicate() const = 0;
247 
248  // Called when this track is merged to stereo with another, and should
249  // take on some paramaters of its partner.
250  virtual void Merge(const Track &orig);
251 
252  wxString GetName() const { return mName; }
253  void SetName( const wxString &n ) { mName = n; }
254  wxString GetDefaultName() const { return mDefaultName; }
255  void SetDefaultName( const wxString &n ) { mDefaultName = n; }
256 
257  bool GetSelected() const { return mSelected; }
258  bool GetLinked () const { return mLinked; }
259 
260  virtual void SetSelected(bool s);
261  void SetLinked (bool l);
262 
263  virtual int GetChannel() const { return mChannel;};
264  virtual double GetOffset() const = 0;
265 
266  void Offset(double t) { SetOffset(GetOffset() + t); }
267  virtual void SetOffset (double o) { mOffset = o; }
268 
269  void SetChannel(int c) { mChannel = c; }
270 #ifdef EXPERIMENTAL_OUTPUT_DISPLAY
271  virtual bool SetPan( float ){ return false; }
272 #else
273  virtual void SetPan( float ){ ;}
274 #endif
275  virtual void SetPanFromChannelType(){ ;};
276 
277  // AS: Note that the dirManager is mutable. This is
278  // mostly to support "Duplicate" of const objects,
279  // but in general, mucking with the dir manager is
280  // separate from the Track.
281  const std::shared_ptr<DirManager> &GetDirManager() const { return mDirManager; }
282 
283  // Create a NEW track and modify this track
284  // Return non-NULL or else throw
285  virtual Holder Cut(double WXUNUSED(t0), double WXUNUSED(t1)) = 0;
286 
287  // Create a NEW track and don't modify this track
288  // Return non-NULL or else throw
289  // Note that subclasses may want to distinguish tracks stored in a clipboard
290  // from those stored in a project
291  virtual Holder Copy
292  (double WXUNUSED(t0), double WXUNUSED(t1), bool forClipboard = true) const = 0;
293 
294  virtual void Clear(double WXUNUSED(t0), double WXUNUSED(t1)) = 0;
295 
296  virtual void Paste(double WXUNUSED(t), const Track * WXUNUSED(src)) = 0;
297 
298  // This can be used to adjust a sync-lock selected track when the selection
299  // is replaced by one of a different length.
300  virtual void SyncLockAdjust(double oldT1, double newT1);
301 
302  virtual void Silence(double WXUNUSED(t0), double WXUNUSED(t1)) = 0;
303  virtual void InsertSilence(double WXUNUSED(t), double WXUNUSED(len)) = 0;
304 
305  virtual int GetKind() const { return None; }
306 
307  // XMLTagHandler callback methods -- NEW virtual for writing
308  virtual void WriteXML(XMLWriter &xmlFile) const = 0;
309 
310  // Returns true if an error was encountered while trying to
311  // open the track from XML
312  virtual bool GetErrorOpening() { return false; }
313 
314  virtual double GetStartTime() const = 0;
315  virtual double GetEndTime() const = 0;
316 
317  // Checks if sync-lock is on and any track in its sync-lock group is selected.
318  bool IsSyncLockSelected() const;
319 
320 protected:
321  std::shared_ptr<Track> FindTrack() override;
322 
323  // These are called to create controls on demand:
324  virtual std::shared_ptr<TrackControls> GetControls() = 0;
325  virtual std::shared_ptr<TrackVRulerControls> GetVRulerControls() = 0;
326 
327  // These hold the controls:
328  std::shared_ptr<TrackControls> mpControls;
329  std::shared_ptr<TrackVRulerControls> mpVRulerContols;
330  std::shared_ptr<TrackPanelResizerCell> mpResizer;
331 
332  std::weak_ptr<SelectHandle> mSelectHandle;
333  std::weak_ptr<TimeShiftHandle> mTimeShiftHandle;
334 };
335 
336 class AUDACITY_DLL_API AudioTrack /* not final */ : public Track
337 {
338 public:
339  AudioTrack(const std::shared_ptr<DirManager> &projDirManager)
340  : Track{ projDirManager } {}
341  AudioTrack(const Track &orig) : Track{ orig } {}
342 
343  // Serialize, not with tags of its own, but as attributes within a tag.
344  void WriteXMLAttributes(XMLWriter &xmlFile) const {}
345 
346  // Return true iff the attribute is recognized.
347  bool HandleXMLAttribute(const wxChar * /*attr*/, const wxChar * /*value*/)
348  { return false; }
349 };
350 
351 class AUDACITY_DLL_API PlayableTrack /* not final */ : public AudioTrack
352 {
353 public:
354  PlayableTrack(const std::shared_ptr<DirManager> &projDirManager)
355  : AudioTrack{ projDirManager } {}
356  PlayableTrack(const Track &orig) : AudioTrack{ orig } {}
357 
358  bool GetMute () const { return mMute; }
359  bool GetSolo () const { return mSolo; }
360  void SetMute (bool m) { mMute = m; }
361  void SetSolo (bool s) { mSolo = s; }
362 
363  void Init( const PlayableTrack &init );
364  void Merge( const Track &init ) override;
365 
366  // Serialize, not with tags of its own, but as attributes within a tag.
367  void WriteXMLAttributes(XMLWriter &xmlFile) const;
368 
369  // Return true iff the attribute is recognized.
370  bool HandleXMLAttribute(const wxChar *attr, const wxChar *value);
371 
372 protected:
373  bool mMute { false };
374  bool mSolo { false };
375 };
376 
377 class AUDACITY_DLL_API TrackListIterator /* not final */
378 {
379  public:
380  TrackListIterator(TrackList * val = NULL);
381  virtual ~TrackListIterator() {}
382 
383  // Iterate functions
384  virtual Track *First(TrackList * val = NULL);
385  virtual Track *StartWith(Track * val);
386  virtual Track *Next(bool skiplinked = false);
387  virtual Track *Prev(bool skiplinked = false);
388  virtual Track *Last(bool skiplinked = false);
389 
390  Track *RemoveCurrent(); // deletes track, returns next
391 
392  protected:
393  friend TrackList;
394 
397 };
398 
399 class AUDACITY_DLL_API TrackListConstIterator
400 {
401 public:
402  TrackListConstIterator(const TrackList * val = NULL)
403  : mIter(const_cast<TrackList*>(val))
404  {}
406 
407  // Iterate functions
408  const Track *First(const TrackList * val = NULL)
409  { return mIter.First(const_cast<TrackList*>(val)); }
410  const Track *StartWith(const Track * val)
411  { return mIter.StartWith(const_cast<Track*>(val)); }
412  const Track *Next(bool skiplinked = false)
413  { return mIter.Next(skiplinked); }
414  const Track *Prev(bool skiplinked = false)
415  { return mIter.Prev(skiplinked); }
416  const Track *Last(bool skiplinked = false)
417  { return mIter.Last(skiplinked); }
418 
419 private:
421 };
422 
423 // TrackListCondIterator (base class for iterators that iterate over all tracks)
424 // that meet a condition)
425 class AUDACITY_DLL_API TrackListCondIterator /* not final */ : public TrackListIterator
426 {
427  public:
429  : TrackListIterator(val) {}
431 
432  // Iteration functions
433  Track *First(TrackList *val = NULL) override;
434  Track *StartWith(Track *val) override;
435  Track *Next(bool skiplinked = false) override;
436  Track *Prev(bool skiplinked = false) override;
437  Track *Last(bool skiplinked = false) override;
438 
439  protected:
440  // NEW virtual
441  virtual bool Condition(Track *t) = 0;
442 };
443 
444 //
445 // TrackListOfKindIterator
446 //
447 // Based on TrackListIterator and returns only tracks of the specified type.
448 //
449 class AUDACITY_DLL_API TrackListOfKindIterator /* not final */ : public TrackListCondIterator
450 {
451  public:
452  TrackListOfKindIterator(int kind, TrackList * val = NULL);
454 
455  protected:
456  virtual bool Condition(Track *t) override;
457 
458  private:
459  int kind;
460 };
461 
462 //
463 // SelectedTrackListOfKindIterator
464 //
465 // Based on TrackListOfKindIterator and returns only tracks selected.
466 //
467 class AUDACITY_DLL_API SelectedTrackListOfKindIterator final : public TrackListOfKindIterator
468 {
469  public:
470  SelectedTrackListOfKindIterator(int kind, TrackList * val = NULL) : TrackListOfKindIterator(kind, val) {}
472 
473  protected:
474  bool Condition(Track *t) override;
475 };
476 
477 //
478 // VisibleTrackIterator
479 //
480 // Based on TrackListIterator returns only the currently visible tracks.
481 //
482 class AUDACITY_DLL_API VisibleTrackIterator final : public TrackListCondIterator
483 {
484  public:
487 
488  protected:
489  bool Condition(Track *t) override;
490 
491  private:
493  wxRect mPanelRect;
494 };
495 
496 
497 // SyncLockedTracksIterator returns only tracks belonging to the sync-locked tracks
498 // in which the starting track is a member.
499 class AUDACITY_DLL_API SyncLockedTracksIterator final : public TrackListIterator
500 {
501  public:
504 
505  // Iterate functions
506  Track *StartWith(Track *member) override;
507  Track *Next(bool skiplinked = false) override;
508  Track *Prev(bool skiplinked = false) override;
509  Track *Last(bool skiplinked = false) override;
510 
511  private:
512  bool IsGoodNextTrack(const Track *t) const;
514 };
515 
516 
521 // Posted when tracks are reordered but otherwise unchanged.
522 DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, EVT_TRACKLIST_PERMUTED, -1);
523 
524 // Posted when some track was added or changed its height.
525 // The wxCommandEvent::GetClientData() method can be used to retrieve it.
526 DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, EVT_TRACKLIST_RESIZING, -1);
527 
528 // Posted when a track has been deleted from a tracklist.
529 // Also posted when one track replaces another
530 DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, EVT_TRACKLIST_DELETION, -1);
531 
532 class TrackList final : public wxEvtHandler, public ListOfTracks
533 {
534  // privatize this, make you use Swap instead:
535  using ListOfTracks::swap;
536 
537  // Create an empty TrackList
538  TrackList();
539 
540  TrackList(const TrackList &that) = delete;
541  TrackList(TrackList &&that) = delete;
542 
543  void clear() = delete;
544 
545  public:
546  // Create an empty TrackList
547  static std::shared_ptr<TrackList> Create();
548 
549  // Allow copy -- a deep copy that duplicates all tracks
550  TrackList &operator= (const TrackList &that);
551 
552  // Allow move
554 
555  // Move is defined in terms of Swap
556  void Swap(TrackList &that);
557 
558  // Destructor
559  virtual ~TrackList();
560 
561  friend class Track;
562  friend class TrackListIterator;
564 
566  void Permute(const std::vector<TrackNodePointer> &permutation);
567 
569  template<typename TrackKind>
570  Track *Add(std::unique_ptr<TrackKind> &&t);
571  template<typename TrackKind>
572  Track *AddToHead(std::unique_ptr<TrackKind> &&t);
573 
574  template<typename TrackKind>
575  Track *Add(std::shared_ptr<TrackKind> &&t);
576 
578  value_type Replace(Track * t, value_type &&with);
579 
583 
585  void Clear(bool sendEvent = true);
586 
588  void Select(Track * t, bool selected = true);
589 
590  Track *GetPrev(Track * t, bool linked = false) const;
591 
596  Track *GetNext(Track * t, bool linked = false) const;
597  int GetGroupHeight(Track * t) const;
598 
599  bool CanMoveUp(Track * t) const;
600  bool CanMoveDown(Track * t) const;
601 
602  bool MoveUp(Track * t);
603  bool MoveDown(Track * t);
604  bool Move(Track * t, bool up) { return up ? MoveUp(t) : MoveDown(t); }
605 
607  const TimeTrack *GetTimeTrack() const;
608 
615  unsigned GetNumExportChannels(bool selectionOnly) const;
616 
617  WaveTrackArray GetWaveTrackArray(bool selectionOnly, bool includeMuted = true);
618  WaveTrackConstArray GetWaveTrackConstArray(bool selectionOnly, bool includeMuted = true) const;
619 
620 #if defined(USE_MIDI)
621  NoteTrackArray GetNoteTrackArray(bool selectionOnly);
622 #endif
623 
625  bool Contains(const Track * t) const;
626 
627  // Return non-null only if the weak pointer is not, and the track is
628  // owned by this list; constant time.
629  template <typename Subclass>
630  std::shared_ptr<Subclass> Lock(const std::weak_ptr<Subclass> &wTrack)
631  {
632  auto pTrack = wTrack.lock();
633  if (pTrack) {
634  auto pList = pTrack->mList.lock();
635  if (pTrack && this == pList.get())
636  return pTrack;
637  }
638  return {};
639  }
640 
641  bool IsEmpty() const;
642  int GetCount() const;
643 
644  double GetStartTime() const;
645  double GetEndTime() const;
646 
647  double GetMinOffset() const;
648  int GetHeight() const;
649 
650 #if LEGACY_PROJECT_FILE_SUPPORT
651  // File I/O
652  bool Load(wxTextFile * in, DirManager * dirManager) override;
653  bool Save(wxTextFile * out, bool overwrite) override;
654 #endif
655 
656 private:
657  bool isNull(TrackNodePointer p) const
658  { return p == end(); }
660  { p = end(); }
661  bool hasPrev(TrackNodePointer p) const
662  { return p != begin(); }
663 
664  void DoAssign(const TrackList &that);
665 
667  void PermutationEvent();
668  void DeletionEvent();
669  void ResizingEvent(TrackNodePointer node);
670 
672 
673  std::weak_ptr<TrackList> mSelf;
674 };
675 
676 class AUDACITY_DLL_API TrackFactory
677 {
678  private:
679  TrackFactory(const std::shared_ptr<DirManager> &dirManager, const ZoomInfo *zoomInfo):
680  mDirManager(dirManager)
681  , mZoomInfo(zoomInfo)
682  {
683  }
684 
685  const std::shared_ptr<DirManager> mDirManager;
686  const ZoomInfo *const mZoomInfo;
687  friend class AudacityProject;
688  friend class BenchmarkDialog;
689 
690  public:
691  // These methods are defined in WaveTrack.cpp, NoteTrack.cpp,
692  // LabelTrack.cpp, and TimeTrack.cpp respectively
693  std::unique_ptr<WaveTrack> DuplicateWaveTrack(const WaveTrack &orig);
694  std::unique_ptr<WaveTrack> NewWaveTrack(sampleFormat format = (sampleFormat)0,
695  double rate = 0);
696  std::unique_ptr<LabelTrack> NewLabelTrack();
697  std::unique_ptr<TimeTrack> NewTimeTrack();
698 #if defined(USE_MIDI)
699  std::unique_ptr<NoteTrack> NewNoteTrack();
700 #endif
701 };
702 
703 #endif
friend TrackList
Definition: Track.h:393
TrackList & operator=(const TrackList &that)
Definition: Track.cpp:773
bool GetSolo() const
Definition: Track.h:359
int kind
Definition: Track.h:459
Definition: Track.h:227
virtual void SetPan(float)
Definition: Track.h:273
A list of TrackListNode items.
Definition: Track.h:532
virtual ~TrackListOfKindIterator()
Definition: Track.h:453
Definition: Track.h:232
Creates and manages BlockFile objects.
Definition: DirManager.h:52
void setNull(TrackNodePointer &p)
Definition: Track.h:659
int GetActualHeight() const
Definition: Track.h:174
virtual Track * Prev(bool skiplinked=false)
Definition: Track.cpp:480
ViewInfo is used mainly to hold the zooming, selection and scroll information. It also has some statu...
Definition: ViewInfo.h:138
virtual ~VisibleTrackIterator()
Definition: Track.h:486
virtual ~SyncLockedTracksIterator()
Definition: Track.h:503
bool CanMoveDown(Track *t) const
Definition: Track.cpp:1108
void Select(Track *t, bool selected=true)
Definition: Track.cpp:1012
int GetHeight() const
Definition: Track.cpp:1356
PlayableTrack(const std::shared_ptr< DirManager > &projDirManager)
Definition: Track.h:354
bool isNull(TrackNodePointer p) const
Definition: Track.h:657
double GetStartTime() const
Definition: Track.cpp:1406
int mIndex
Definition: Track.h:96
Definition: Track.h:449
bool GetSelected() const
Definition: Track.h:257
TrackNodePointer mNode
Definition: Track.h:95
virtual ~TrackListIterator()
Definition: Track.h:381
virtual ~TrackListCondIterator()
Definition: Track.h:430
bool hasPrev(TrackNodePointer p) const
Definition: Track.h:661
const Track * First(const TrackList *val=NULL)
Definition: Track.h:408
virtual void SetOffset(double o)
Definition: Track.h:267
virtual bool Condition(Track *t) override
Definition: Track.cpp:587
value_type Replace(Track *t, value_type &&with)
Replace first track with second track, give back a holder.
Definition: Track.cpp:958
TrackKindEnum
Definition: Track.h:224
virtual ~SelectedTrackListOfKindIterator()
Definition: Track.h:471
Track * Add(std::unique_ptr< TrackKind > &&t)
Add this Track or all children of this TrackList.
Definition: Track.cpp:906
int mHeight
Definition: Track.h:98
void DeletionEvent()
Definition: Track.cpp:876
double GetEndTime() const
Definition: Track.cpp:1411
void Offset(double t)
Definition: Track.h:266
bool mSelected
Definition: Track.h:108
void clear()=delete
ListOfTracks::iterator TrackNodePointer
Definition: Track.h:81
Definition: TrackPanelResizerCell.h:18
virtual int GetChannel() const
Definition: Track.h:263
void SwapNodes(TrackNodePointer s1, TrackNodePointer s2)
Definition: Track.cpp:1118
bool GetLinked() const
Definition: Track.h:258
std::weak_ptr< SelectHandle > mSelectHandle
Definition: Track.h:332
const std::shared_ptr< DirManager > mDirManager
Definition: Track.h:685
void WriteXMLAttributes(XMLWriter &xmlFile) const
Definition: Track.h:344
TrackListCondIterator(TrackList *val=NULL)
Definition: Track.h:428
bool MoveUp(Track *t)
Definition: Track.cpp:1181
Definition: Track.h:53
virtual bool Condition(Track *t)=0
Definition: TrackPanelMouseEvent.h:23
void SetChannel(int c)
Definition: Track.h:269
virtual std::shared_ptr< Track > FindTrack()=0
const std::shared_ptr< DirManager > & GetDirManager() const
Definition: Track.h:281
AudacityProject * mProject
Definition: Track.h:492
wxString mDefaultName
Definition: Track.h:106
std::shared_ptr< TrackVRulerControls > mpVRulerContols
Definition: Track.h:329
TimeTrack * GetTimeTrack()
Definition: Track.cpp:1230
const Track * Last(bool skiplinked=false)
Definition: Track.h:416
Definition: ViewInfo.h:31
void ResizingEvent(TrackNodePointer node)
Definition: Track.cpp:883
virtual int GetKind() const
Definition: Track.h:305
static std::shared_ptr< TrackList > Create()
Definition: Track.cpp:766
void SetMute(bool m)
Definition: Track.h:360
Used to create a WaveTrack, or a LabelTrack.. Implementation of the functions of this class are dispe...
Definition: Track.h:676
PlayableTrack(const Track &orig)
Definition: Track.h:356
virtual std::vector< UIHandlePtr > HitTest(const TrackPanelMouseState &state, const AudacityProject *pProject)=0
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:114
const Track * Next(bool skiplinked=false)
Definition: Track.h:412
Definition: TimeShiftHandle.h:44
wxString GetDefaultName() const
Definition: Track.h:254
Definition: Track.h:425
TrackList()
Definition: Track.cpp:760
void Swap(TrackList &that)
Definition: Track.cpp:798
AudioTrack(const std::shared_ptr< DirManager > &projDirManager)
Definition: Track.h:339
void DoAssign(const TrackList &that)
Definition: Track.cpp:791
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:161
A kind of Track used to 'warp time'.
Definition: TimeTrack.h:29
bool CanMoveUp(Track *t) const
Definition: Track.cpp:1103
int format
Definition: ExportPCM.cpp:56
WaveTrackConstArray GetWaveTrackConstArray(bool selectionOnly, bool includeMuted=true) const
Definition: Track.cpp:1335
bool HandleXMLAttribute(const wxChar *, const wxChar *)
Definition: Track.h:347
const Track * Prev(bool skiplinked=false)
Definition: Track.h:414
AudioTrack(const Track &orig)
Definition: Track.h:341
Definition: Track.h:467
Track * GetNext(Track *t, bool linked=false) const
Return a track in the list that comes after Track t.
Definition: Track.cpp:1035
Definition: TrackControls.h:25
Track * AddToHead(std::unique_ptr< TrackKind > &&t)
Definition: Track.cpp:928
void RecalcPositions(TrackNodePointer node)
Definition: Track.cpp:812
std::shared_ptr< TrackPanelResizerCell > mpResizer
Definition: Track.h:330
WaveTrackConstArray()
Definition: Track.h:55
bool mMinimized
Definition: Track.h:111
bool Contains(const Track *t) const
Mainly a test function. Uses a linear search, so could be slow.
Definition: Track.cpp:1207
virtual void SetPanFromChannelType()
Definition: Track.h:275
bool Move(Track *t, bool up)
Definition: Track.h:604
Definition: Track.h:336
virtual ~TrackList()
Definition: Track.cpp:807
std::weak_ptr< TimeShiftHandle > mTimeShiftHandle
Definition: Track.h:333
std::weak_ptr< TrackList > mList
Definition: Track.h:94
A Track that contains audio waveform data.
Definition: WaveTrack.h:76
WaveTrackArray GetWaveTrackArray(bool selectionOnly, bool includeMuted=true)
Definition: Track.cpp:1330
Fundamental data object of Audacity, placed in the TrackPanel. Classes derived form it include the Wa...
Definition: Track.h:85
This class is an interface which should be implemented by classes which wish to be able to load and s...
Definition: XMLTagHandler.h:69
unsigned GetNumExportChannels(bool selectionOnly) const
Find out how many channels this track list mixes to.
Definition: Track.cpp:1246
Definition: Track.h:399
bool mInLabelSection
Definition: Track.h:513
wxString GetName() const
Definition: Track.h:252
virtual Track * Last(bool skiplinked=false)
Definition: Track.cpp:425
void Clear(bool sendEvent=true)
Make the list empty.
Definition: Track.cpp:999
Definition: Track.h:226
std::vector< WaveTrack * > WaveTrackArray
Definition: AudioIO.h:63
std::shared_ptr< Subclass > Lock(const std::weak_ptr< Subclass > &wTrack)
Definition: Track.h:630
Definition: Track.h:351
bool MoveDown(Track *t)
Definition: Track.cpp:1194
double mOffset
Definition: Track.h:208
void SetDefaultName(const wxString &n)
Definition: Track.h:255
An iterator for a TrackList.
Definition: Track.h:377
bool mLinked
Definition: Track.h:110
double GetMinOffset() const
Definition: Track.cpp:1401
wxRect mPanelRect
Definition: Track.h:493
int GetGroupHeight(Track *t) const
Definition: Track.cpp:1087
TrackNodePointer Remove(Track *t)
Definition: Track.cpp:978
DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, EVT_TRACKLIST_PERMUTED,-1)
TrackList is a flat linked list of tracks supporting Add, Remove, Clear, and Contains, plus serialization of the list of tracks.
TrackList * l
Definition: Track.h:395
WX_DEFINE_USER_EXPORTED_ARRAY(Track *, TrackArray, class AUDACITY_DLL_API)
Track * GetPrev(Track *t, bool linked=false) const
Definition: Track.cpp:1057
void SetName(const wxString &n)
Definition: Track.h:253
SelectedTrackListOfKindIterator(int kind, TrackList *val=NULL)
Definition: Track.h:470
void Permute(const std::vector< TrackNodePointer > &permutation)
For use in sorting: assume each iterator points into this list, no duplications.
Definition: Track.cpp:892
virtual Track * Next(bool skiplinked=false)
Definition: Track.cpp:447
int GetCount() const
Definition: Track.cpp:1219
TrackListIterator mIter
Definition: Track.h:420
void Init(const Track &orig)
Definition: Track.cpp:86
const Track * StartWith(const Track *val)
Definition: Track.h:410
std::vector< NoteTrack * > NoteTrackArray
Definition: Track.h:71
TrackFactory(const std::shared_ptr< DirManager > &dirManager, const ZoomInfo *zoomInfo)
Definition: Track.h:679
Definition: TrackVRulerControls.h:20
Definition: Track.h:482
const ZoomInfo *const mZoomInfo
Definition: Track.h:686
Definition: CommonTrackPanelCell.h:20
bool GetMute() const
Definition: Track.h:358
TrackListConstIterator(const TrackList *val=NULL)
Definition: Track.h:402
virtual Track * StartWith(Track *val)
Definition: Track.cpp:389
static std::shared_ptr< Subclass > Pointer(const Track *t)
Definition: Track.h:129
std::unique_ptr< Track > Holder
Definition: Track.h:245
Definition: Track.h:231
Base class for XMLFileWriter and XMLStringWriter that provides the general functionality for creating...
Definition: XMLWriter.h:22
void PermutationEvent()
Definition: Track.cpp:869
static std::shared_ptr< Subclass > Pointer(Track *t)
Definition: Track.h:118
std::list< std::shared_ptr< Track > > ListOfTracks
Definition: Track.h:79
virtual void Merge(const Track &orig)
Definition: Track.cpp:110
virtual Track * First(TrackList *val=NULL)
Definition: Track.cpp:406
~TrackListConstIterator()
Definition: Track.h:405
virtual bool GetErrorOpening()
Definition: Track.h:312
wxSize vrulerSize
Definition: Track.h:157
bool IsEmpty() const
Definition: Track.cpp:1214
void SetSolo(bool s)
Definition: Track.h:361
Definition: Track.h:499
int mY
Definition: Track.h:97
std::shared_ptr< DirManager > mDirManager
Definition: Track.h:210
std::shared_ptr< TrackControls > mpControls
Definition: Track.h:328
Definition: SelectHandle.h:32
std::weak_ptr< TrackList > mSelf
Definition: Track.h:673
BenchmarkDialog is used for measuring performance and accuracy of the BlockFile system.
Definition: Benchmark.cpp:46
int mChannel
Definition: Track.h:207
A Track that is used for Midi notes. (Somewhat old code).
wxString mName
Definition: Track.h:105