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  virtual 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  // May assume precondition: t0 <= t1
286  virtual Holder Cut(double WXUNUSED(t0), double WXUNUSED(t1)) = 0;
287 
288  // Create a NEW track and don't modify this track
289  // Return non-NULL or else throw
290  // Note that subclasses may want to distinguish tracks stored in a clipboard
291  // from those stored in a project
292  // May assume precondition: t0 <= t1
293  virtual Holder Copy
294  (double WXUNUSED(t0), double WXUNUSED(t1), bool forClipboard = true) const = 0;
295 
296  // May assume precondition: t0 <= t1
297  virtual void Clear(double WXUNUSED(t0), double WXUNUSED(t1)) = 0;
298 
299  virtual void Paste(double WXUNUSED(t), const Track * WXUNUSED(src)) = 0;
300 
301  // This can be used to adjust a sync-lock selected track when the selection
302  // is replaced by one of a different length.
303  virtual void SyncLockAdjust(double oldT1, double newT1);
304 
305  // May assume precondition: t0 <= t1
306  virtual void Silence(double WXUNUSED(t0), double WXUNUSED(t1)) = 0;
307 
308  // May assume precondition: t0 <= t1
309  virtual void InsertSilence(double WXUNUSED(t), double WXUNUSED(len)) = 0;
310 
311  virtual int GetKind() const { return None; }
312 
313  // XMLTagHandler callback methods -- NEW virtual for writing
314  virtual void WriteXML(XMLWriter &xmlFile) const = 0;
315 
316  // Returns true if an error was encountered while trying to
317  // open the track from XML
318  virtual bool GetErrorOpening() { return false; }
319 
320  virtual double GetStartTime() const = 0;
321  virtual double GetEndTime() const = 0;
322 
323  // Checks if sync-lock is on and any track in its sync-lock group is selected.
324  bool IsSyncLockSelected() const;
325 
326 protected:
327  std::shared_ptr<Track> FindTrack() override;
328 
329  // These are called to create controls on demand:
330  virtual std::shared_ptr<TrackControls> GetControls() = 0;
331  virtual std::shared_ptr<TrackVRulerControls> GetVRulerControls() = 0;
332 
333  // These hold the controls:
334  std::shared_ptr<TrackControls> mpControls;
335  std::shared_ptr<TrackVRulerControls> mpVRulerContols;
336  std::shared_ptr<TrackPanelResizerCell> mpResizer;
337 
338  std::weak_ptr<SelectHandle> mSelectHandle;
339  std::weak_ptr<TimeShiftHandle> mTimeShiftHandle;
340 };
341 
342 class AUDACITY_DLL_API AudioTrack /* not final */ : public Track
343 {
344 public:
345  AudioTrack(const std::shared_ptr<DirManager> &projDirManager)
346  : Track{ projDirManager } {}
347  AudioTrack(const Track &orig) : Track{ orig } {}
348 
349  // Serialize, not with tags of its own, but as attributes within a tag.
350  void WriteXMLAttributes(XMLWriter &WXUNUSED(xmlFile)) const {}
351 
352  // Return true iff the attribute is recognized.
353  bool HandleXMLAttribute(const wxChar * /*attr*/, const wxChar * /*value*/)
354  { return false; }
355 };
356 
357 class AUDACITY_DLL_API PlayableTrack /* not final */ : public AudioTrack
358 {
359 public:
360  PlayableTrack(const std::shared_ptr<DirManager> &projDirManager)
361  : AudioTrack{ projDirManager } {}
362  PlayableTrack(const Track &orig) : AudioTrack{ orig } {}
363 
364  bool GetMute () const { return mMute; }
365  bool GetSolo () const { return mSolo; }
366  void SetMute (bool m) { mMute = m; }
367  void SetSolo (bool s) { mSolo = s; }
368 
369  void Init( const PlayableTrack &init );
370  void Merge( const Track &init ) override;
371 
372  // Serialize, not with tags of its own, but as attributes within a tag.
373  void WriteXMLAttributes(XMLWriter &xmlFile) const;
374 
375  // Return true iff the attribute is recognized.
376  bool HandleXMLAttribute(const wxChar *attr, const wxChar *value);
377 
378 protected:
379  bool mMute { false };
380  bool mSolo { false };
381 };
382 
383 class AUDACITY_DLL_API TrackListIterator /* not final */
384 {
385  public:
386  TrackListIterator(TrackList * val = NULL);
387  virtual ~TrackListIterator() {}
388 
389  // Iterate functions
390  virtual Track *First(TrackList * val = NULL);
391  virtual Track *StartWith(Track * val);
392  virtual Track *Next(bool skiplinked = false);
393  virtual Track *Prev(bool skiplinked = false);
394  virtual Track *Last(bool skiplinked = false);
395 
396  Track *RemoveCurrent(); // deletes track, returns next
397 
398  protected:
399  friend TrackList;
400 
403 };
404 
405 class AUDACITY_DLL_API TrackListConstIterator
406 {
407 public:
408  TrackListConstIterator(const TrackList * val = NULL)
409  : mIter(const_cast<TrackList*>(val))
410  {}
412 
413  // Iterate functions
414  const Track *First(const TrackList * val = NULL)
415  { return mIter.First(const_cast<TrackList*>(val)); }
416  const Track *StartWith(const Track * val)
417  { return mIter.StartWith(const_cast<Track*>(val)); }
418  const Track *Next(bool skiplinked = false)
419  { return mIter.Next(skiplinked); }
420  const Track *Prev(bool skiplinked = false)
421  { return mIter.Prev(skiplinked); }
422  const Track *Last(bool skiplinked = false)
423  { return mIter.Last(skiplinked); }
424 
425 private:
427 };
428 
429 // TrackListCondIterator (base class for iterators that iterate over all tracks)
430 // that meet a condition)
431 class AUDACITY_DLL_API TrackListCondIterator /* not final */ : public TrackListIterator
432 {
433  public:
435  : TrackListIterator(val) {}
437 
438  // Iteration functions
439  Track *First(TrackList *val = NULL) override;
440  Track *StartWith(Track *val) override;
441  Track *Next(bool skiplinked = false) override;
442  Track *Prev(bool skiplinked = false) override;
443  Track *Last(bool skiplinked = false) override;
444 
445  protected:
446  // NEW virtual
447  virtual bool Condition(Track *t) = 0;
448 };
449 
450 //
451 // TrackListOfKindIterator
452 //
453 // Based on TrackListIterator and returns only tracks of the specified type.
454 //
455 class AUDACITY_DLL_API TrackListOfKindIterator /* not final */ : public TrackListCondIterator
456 {
457  public:
458  TrackListOfKindIterator(int kind, TrackList * val = NULL);
460 
461  protected:
462  virtual bool Condition(Track *t) override;
463 
464  private:
465  int kind;
466 };
467 
468 //
469 // SelectedTrackListOfKindIterator
470 //
471 // Based on TrackListOfKindIterator and returns only tracks selected.
472 //
473 class AUDACITY_DLL_API SelectedTrackListOfKindIterator final : public TrackListOfKindIterator
474 {
475  public:
476  SelectedTrackListOfKindIterator(int kind, TrackList * val = NULL) : TrackListOfKindIterator(kind, val) {}
478 
479  protected:
480  bool Condition(Track *t) override;
481 };
482 
483 //
484 // VisibleTrackIterator
485 //
486 // Based on TrackListIterator returns only the currently visible tracks.
487 //
488 class AUDACITY_DLL_API VisibleTrackIterator final : public TrackListCondIterator
489 {
490  public:
493 
494  protected:
495  bool Condition(Track *t) override;
496 
497  private:
499  wxRect mPanelRect;
500 };
501 
502 
503 // SyncLockedTracksIterator returns only tracks belonging to the sync-locked tracks
504 // in which the starting track is a member.
505 class AUDACITY_DLL_API SyncLockedTracksIterator final : public TrackListIterator
506 {
507  public:
510 
511  // Iterate functions
512  Track *StartWith(Track *member) override;
513  Track *Next(bool skiplinked = false) override;
514  Track *Prev(bool skiplinked = false) override;
515  Track *Last(bool skiplinked = false) override;
516 
517  private:
518  bool IsGoodNextTrack(const Track *t) const;
520 };
521 
522 
527 struct TrackListEvent : public wxCommandEvent
528 {
529  TrackListEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
530  : wxCommandEvent{ commandType, winid } {}
531 
532  TrackListEvent( const TrackListEvent& ) = default;
533 
534  wxEvent *Clone() const override { return new TrackListEvent(*this); }
535 
536  std::weak_ptr<Track> mpTrack;
537 };
538 
539 // Posted when tracks are reordered but otherwise unchanged.
540 DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, EVT_TRACKLIST_PERMUTED, -1);
541 
542 // Posted when some track was added or changed its height.
543 // Cast to TrackListEvent and examine mpTrack to retrieve it.
544 DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, EVT_TRACKLIST_RESIZING, -1);
545 
546 // Posted when a track has been deleted from a tracklist.
547 // Also posted when one track replaces another
548 DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, EVT_TRACKLIST_DELETION, -1);
549 
550 class TrackList final : public wxEvtHandler, public ListOfTracks
551 {
552  // privatize this, make you use Swap instead:
553  using ListOfTracks::swap;
554 
555  // Create an empty TrackList
556  TrackList();
557 
558  TrackList(const TrackList &that) = delete;
559  TrackList(TrackList &&that) = delete;
560 
561  void clear() = delete;
562 
563  public:
564  // Create an empty TrackList
565  static std::shared_ptr<TrackList> Create();
566 
567  // Allow copy -- a deep copy that duplicates all tracks
568  TrackList &operator= (const TrackList &that);
569 
570  // Allow move
572 
573  // Move is defined in terms of Swap
574  void Swap(TrackList &that);
575 
576  // Destructor
577  virtual ~TrackList();
578 
579  friend class Track;
580  friend class TrackListIterator;
582 
584  void Permute(const std::vector<TrackNodePointer> &permutation);
585 
587  template<typename TrackKind>
588  Track *Add(std::unique_ptr<TrackKind> &&t);
589  template<typename TrackKind>
590  Track *AddToHead(std::unique_ptr<TrackKind> &&t);
591 
592  template<typename TrackKind>
593  Track *Add(std::shared_ptr<TrackKind> &&t);
594 
596  value_type Replace(Track * t, value_type &&with);
597 
601 
603  void Clear(bool sendEvent = true);
604 
606  void Select(Track * t, bool selected = true);
607 
608  Track *GetPrev(Track * t, bool linked = false) const;
609 
614  Track *GetNext(Track * t, bool linked = false) const;
615  int GetGroupHeight(Track * t) const;
616 
617  bool CanMoveUp(Track * t) const;
618  bool CanMoveDown(Track * t) const;
619 
620  bool MoveUp(Track * t);
621  bool MoveDown(Track * t);
622  bool Move(Track * t, bool up) { return up ? MoveUp(t) : MoveDown(t); }
623 
625  const TimeTrack *GetTimeTrack() const;
626 
633  unsigned GetNumExportChannels(bool selectionOnly) const;
634 
635  WaveTrackArray GetWaveTrackArray(bool selectionOnly, bool includeMuted = true);
636  WaveTrackConstArray GetWaveTrackConstArray(bool selectionOnly, bool includeMuted = true) const;
637 
638 #if defined(USE_MIDI)
639  NoteTrackArray GetNoteTrackArray(bool selectionOnly);
640 #endif
641 
643  bool Contains(const Track * t) const;
644 
645  // Return non-null only if the weak pointer is not, and the track is
646  // owned by this list; constant time.
647  template <typename Subclass>
648  std::shared_ptr<Subclass> Lock(const std::weak_ptr<Subclass> &wTrack)
649  {
650  auto pTrack = wTrack.lock();
651  if (pTrack) {
652  auto pList = pTrack->mList.lock();
653  if (pTrack && this == pList.get())
654  return pTrack;
655  }
656  return {};
657  }
658 
659  bool IsEmpty() const;
660  int GetCount() const;
661 
662  double GetStartTime() const;
663  double GetEndTime() const;
664 
665  double GetMinOffset() const;
666  int GetHeight() const;
667 
668 #if LEGACY_PROJECT_FILE_SUPPORT
669  // File I/O
670  bool Load(wxTextFile * in, DirManager * dirManager) override;
671  bool Save(wxTextFile * out, bool overwrite) override;
672 #endif
673 
674 private:
675  bool isNull(TrackNodePointer p) const
676  { return p == end(); }
678  { p = end(); }
679  bool hasPrev(TrackNodePointer p) const
680  { return p != begin(); }
681 
682  void DoAssign(const TrackList &that);
683 
685  void PermutationEvent();
686  void DeletionEvent();
687  void ResizingEvent(TrackNodePointer node);
688 
690 
691  std::weak_ptr<TrackList> mSelf;
692 };
693 
694 class AUDACITY_DLL_API TrackFactory
695 {
696  private:
697  TrackFactory(const std::shared_ptr<DirManager> &dirManager, const ZoomInfo *zoomInfo):
698  mDirManager(dirManager)
699  , mZoomInfo(zoomInfo)
700  {
701  }
702 
703  const std::shared_ptr<DirManager> mDirManager;
704  const ZoomInfo *const mZoomInfo;
705  friend class AudacityProject;
706  friend class BenchmarkDialog;
707 
708  public:
709  // These methods are defined in WaveTrack.cpp, NoteTrack.cpp,
710  // LabelTrack.cpp, and TimeTrack.cpp respectively
711  std::unique_ptr<WaveTrack> DuplicateWaveTrack(const WaveTrack &orig);
712  std::unique_ptr<WaveTrack> NewWaveTrack(sampleFormat format = (sampleFormat)0,
713  double rate = 0);
714  std::unique_ptr<LabelTrack> NewLabelTrack();
715  std::unique_ptr<TimeTrack> NewTimeTrack();
716 #if defined(USE_MIDI)
717  std::unique_ptr<NoteTrack> NewNoteTrack();
718 #endif
719 };
720 
721 #endif
friend TrackList
Definition: Track.h:399
TrackList & operator=(const TrackList &that)
Definition: Track.cpp:779
bool GetSolo() const
Definition: Track.h:365
int kind
Definition: Track.h:465
Definition: Track.h:227
virtual void SetPan(float)
Definition: Track.h:273
A list of TrackListNode items.
Definition: Track.h:550
virtual ~TrackListOfKindIterator()
Definition: Track.h:459
Definition: Track.h:232
Creates and manages BlockFile objects.
Definition: DirManager.h:52
void setNull(TrackNodePointer &p)
Definition: Track.h:677
int GetActualHeight() const
Definition: Track.h:174
virtual Track * Prev(bool skiplinked=false)
Definition: Track.cpp:486
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:492
virtual ~SyncLockedTracksIterator()
Definition: Track.h:509
bool CanMoveDown(Track *t) const
Definition: Track.cpp:1113
void Select(Track *t, bool selected=true)
Definition: Track.cpp:1017
int GetHeight() const
Definition: Track.cpp:1361
PlayableTrack(const std::shared_ptr< DirManager > &projDirManager)
Definition: Track.h:360
bool isNull(TrackNodePointer p) const
Definition: Track.h:675
double GetStartTime() const
Definition: Track.cpp:1411
int mIndex
Definition: Track.h:96
Definition: Track.h:455
std::weak_ptr< Track > mpTrack
Definition: Track.h:536
bool GetSelected() const
Definition: Track.h:257
TrackNodePointer mNode
Definition: Track.h:95
virtual ~TrackListIterator()
Definition: Track.h:387
virtual ~TrackListCondIterator()
Definition: Track.h:436
bool hasPrev(TrackNodePointer p) const
Definition: Track.h:679
const Track * First(const TrackList *val=NULL)
Definition: Track.h:414
virtual void SetOffset(double o)
Definition: Track.h:267
virtual bool Condition(Track *t) override
Definition: Track.cpp:593
value_type Replace(Track *t, value_type &&with)
Replace first track with second track, give back a holder.
Definition: Track.cpp:963
TrackKindEnum
Definition: Track.h:224
virtual ~SelectedTrackListOfKindIterator()
Definition: Track.h:477
Track * Add(std::unique_ptr< TrackKind > &&t)
Add this Track or all children of this TrackList.
Definition: Track.cpp:911
int mHeight
Definition: Track.h:98
void DeletionEvent()
Definition: Track.cpp:882
double GetEndTime() const
Definition: Track.cpp:1416
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:1123
bool GetLinked() const
Definition: Track.h:258
std::weak_ptr< SelectHandle > mSelectHandle
Definition: Track.h:338
const std::shared_ptr< DirManager > mDirManager
Definition: Track.h:703
TrackListCondIterator(TrackList *val=NULL)
Definition: Track.h:434
bool MoveUp(Track *t)
Definition: Track.cpp:1186
Definition: Track.h:53
virtual bool Condition(Track *t)=0
Definition: TrackPanelMouseEvent.h:27
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:498
wxString mDefaultName
Definition: Track.h:106
std::shared_ptr< TrackVRulerControls > mpVRulerContols
Definition: Track.h:335
TimeTrack * GetTimeTrack()
Definition: Track.cpp:1235
const Track * Last(bool skiplinked=false)
Definition: Track.h:422
Definition: ViewInfo.h:31
void ResizingEvent(TrackNodePointer node)
Definition: Track.cpp:889
virtual int GetKind() const
Definition: Track.h:311
static std::shared_ptr< TrackList > Create()
Definition: Track.cpp:772
void SetMute(bool m)
Definition: Track.h:366
Used to create a WaveTrack, or a LabelTrack.. Implementation of the functions of this class are dispe...
Definition: Track.h:694
PlayableTrack(const Track &orig)
Definition: Track.h:362
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:418
Definition: TimeShiftHandle.h:44
wxString GetDefaultName() const
Definition: Track.h:254
Definition: Track.h:431
TrackList()
Definition: Track.cpp:766
void Swap(TrackList &that)
Definition: Track.cpp:804
AudioTrack(const std::shared_ptr< DirManager > &projDirManager)
Definition: Track.h:345
TrackList is a flat linked list of tracks supporting Add, Remove, Clear, and Contains, plus serialization of the list of tracks.
Definition: Track.h:527
void DoAssign(const TrackList &that)
Definition: Track.cpp:797
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:1108
int format
Definition: ExportPCM.cpp:56
WaveTrackConstArray GetWaveTrackConstArray(bool selectionOnly, bool includeMuted=true) const
Definition: Track.cpp:1340
bool HandleXMLAttribute(const wxChar *, const wxChar *)
Definition: Track.h:353
const Track * Prev(bool skiplinked=false)
Definition: Track.h:420
AudioTrack(const Track &orig)
Definition: Track.h:347
Definition: Track.h:473
Track * GetNext(Track *t, bool linked=false) const
Return a track in the list that comes after Track t.
Definition: Track.cpp:1040
Definition: TrackControls.h:25
Track * AddToHead(std::unique_ptr< TrackKind > &&t)
Definition: Track.cpp:933
void RecalcPositions(TrackNodePointer node)
Definition: Track.cpp:818
std::shared_ptr< TrackPanelResizerCell > mpResizer
Definition: Track.h:336
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:1212
virtual void SetPanFromChannelType()
Definition: Track.h:275
bool Move(Track *t, bool up)
Definition: Track.h:622
A Track that can load/save audio data to/from XML.
Definition: Track.h:342
virtual ~TrackList()
Definition: Track.cpp:813
std::weak_ptr< TimeShiftHandle > mTimeShiftHandle
Definition: Track.h:339
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:1335
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:1251
Definition: Track.h:405
bool mInLabelSection
Definition: Track.h:519
wxString GetName() const
Definition: Track.h:252
virtual Track * Last(bool skiplinked=false)
Definition: Track.cpp:431
void Clear(bool sendEvent=true)
Make the list empty.
Definition: Track.cpp:1004
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:648
An AudioTrack that can be played and stopped.
Definition: Track.h:357
bool MoveDown(Track *t)
Definition: Track.cpp:1199
double mOffset
Definition: Track.h:208
void SetDefaultName(const wxString &n)
Definition: Track.h:255
An iterator for a TrackList.
Definition: Track.h:383
bool mLinked
Definition: Track.h:110
double GetMinOffset() const
Definition: Track.cpp:1406
wxRect mPanelRect
Definition: Track.h:499
int GetGroupHeight(Track *t) const
Definition: Track.cpp:1092
TrackNodePointer Remove(Track *t)
Definition: Track.cpp:983
DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, EVT_TRACKLIST_PERMUTED,-1)
TrackList * l
Definition: Track.h:401
WX_DEFINE_USER_EXPORTED_ARRAY(Track *, TrackArray, class AUDACITY_DLL_API)
Track * GetPrev(Track *t, bool linked=false) const
Definition: Track.cpp:1062
void SetName(const wxString &n)
Definition: Track.h:253
SelectedTrackListOfKindIterator(int kind, TrackList *val=NULL)
Definition: Track.h:476
void Permute(const std::vector< TrackNodePointer > &permutation)
For use in sorting: assume each iterator points into this list, no duplications.
Definition: Track.cpp:897
virtual Track * Next(bool skiplinked=false)
Definition: Track.cpp:453
int GetCount() const
Definition: Track.cpp:1224
TrackListIterator mIter
Definition: Track.h:426
void Init(const Track &orig)
Definition: Track.cpp:92
const Track * StartWith(const Track *val)
Definition: Track.h:416
std::vector< NoteTrack * > NoteTrackArray
Definition: Track.h:71
void WriteXMLAttributes(XMLWriter &WXUNUSED(xmlFile)) const
Definition: Track.h:350
TrackFactory(const std::shared_ptr< DirManager > &dirManager, const ZoomInfo *zoomInfo)
Definition: Track.h:697
Definition: TrackVRulerControls.h:20
Definition: Track.h:488
const ZoomInfo *const mZoomInfo
Definition: Track.h:704
Definition: CommonTrackPanelCell.h:20
bool GetMute() const
Definition: Track.h:364
TrackListConstIterator(const TrackList *val=NULL)
Definition: Track.h:408
virtual Track * StartWith(Track *val)
Definition: Track.cpp:395
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
TrackListEvent(wxEventType commandType=wxEVT_NULL, int winid=0)
Definition: Track.h:529
Base class for XMLFileWriter and XMLStringWriter that provides the general functionality for creating...
Definition: XMLWriter.h:22
void PermutationEvent()
Definition: Track.cpp:875
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:116
virtual Track * First(TrackList *val=NULL)
Definition: Track.cpp:412
~TrackListConstIterator()
Definition: Track.h:411
virtual bool GetErrorOpening()
Definition: Track.h:318
wxSize vrulerSize
Definition: Track.h:157
bool IsEmpty() const
Definition: Track.cpp:1219
void SetSolo(bool s)
Definition: Track.h:367
Definition: Track.h:505
int mY
Definition: Track.h:97
std::shared_ptr< DirManager > mDirManager
Definition: Track.h:210
std::shared_ptr< TrackControls > mpControls
Definition: Track.h:334
Definition: SelectHandle.h:32
std::weak_ptr< TrackList > mSelf
Definition: Track.h:691
wxEvent * Clone() const override
Definition: Track.h:534
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