Audacity  2.2.2
WaveTrack.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  WaveTrack.h
6 
7  Dominic Mazzoni
8 
9 **********************************************************************/
10 
11 #ifndef __AUDACITY_WAVETRACK__
12 #define __AUDACITY_WAVETRACK__
13 
14 #include "Track.h"
15 #include "SampleFormat.h"
16 #include "WaveClip.h"
17 #include "Experimental.h"
18 #include "widgets/ProgressDialog.h"
19 
20 #include <vector>
21 #include <wx/gdicmn.h>
22 #include <wx/longlong.h>
23 #include <wx/thread.h>
24 
25 #include "WaveTrackLocation.h"
26 
28 class WaveformSettings;
29 class TimeWarper;
30 
31 class CutlineHandle;
32 class SampleHandle;
33 class EnvelopeHandle;
34 
35 //
36 // Tolerance for merging wave tracks (in seconds)
37 //
38 #define WAVETRACK_MERGE_POINT_TOLERANCE 0.01
39 
42 struct Region
43 {
44  Region() : start(0), end(0) {}
45  Region(double start_, double end_) : start(start_), end(end_) {}
46 
47  double start, end;
48 
49  //used for sorting
50  bool operator < (const Region &b) const
51  {
52  return this->start < b.start;
53  }
54 };
55 
56 class Regions : public std::vector < Region > {};
57 
58 class Envelope;
59 
60 class AUDACITY_DLL_API WaveTrack final : public PlayableTrack {
61 
62  private:
63 
64  //
65  // Constructor / Destructor / Duplicator
66  //
67  // Private since only factories are allowed to construct WaveTracks
68  //
69 
70  WaveTrack(const std::shared_ptr<DirManager> &projDirManager,
71  sampleFormat format = (sampleFormat)0,
72  double rate = 0);
73  WaveTrack(const WaveTrack &orig);
74 
75  void Init(const WaveTrack &orig);
76 
77 public:
78  // overwrite data excluding the sample sequence but including display
79  // settings
80  void Reinit(const WaveTrack &orig);
81 
82 private:
83  Track::Holder Duplicate() const override;
84 
85  friend class TrackFactory;
86 
87  public:
88 
90  using Holder = std::unique_ptr<WaveTrack>;
91 
92  virtual ~WaveTrack();
93 
94  std::vector<UIHandlePtr> DetailedHitTest
95  (const TrackPanelMouseState &state,
96  const AudacityProject *pProject, int currentTool, bool bMultiTool)
97  override;
98 
99  double GetOffset() const override;
100  void SetOffset(double o) override;
101  virtual int GetChannel() const override;
102  virtual void SetPanFromChannelType() override;
103 
108  double GetStartTime() const;
109 
115  double GetEndTime() const;
116 
117  //
118  // Identifying the type of track
119  //
120 
121  int GetKind() const override { return Wave; }
122 
123  //
124  // WaveTrack parameters
125  //
126 
127  double GetRate() const;
128  void SetRate(double newRate);
129 
130  // Multiplicative factor. Only converted to dB for display.
131  float GetGain() const;
132  void SetGain(float newGain);
133 
134  // -1.0 (left) -> 1.0 (right)
135  float GetPan() const;
136  void SetPan(float newPan) override;
137 
138  // Takes gain and pan into account
139  float GetChannelGain(int channel) const;
140 
141  void DoSetMinimized(bool isMinimized) override;
142 
143  int GetWaveColorIndex() const { return mWaveColorIndex; };
144  void SetWaveColorIndex(int colorIndex);
145 
146  sampleFormat GetSampleFormat() const { return mFormat; }
147  void ConvertToSampleFormat(sampleFormat format);
148 
149  const SpectrogramSettings &GetSpectrogramSettings() const;
150  SpectrogramSettings &GetSpectrogramSettings();
151  SpectrogramSettings &GetIndependentSpectrogramSettings();
152  void SetSpectrogramSettings(std::unique_ptr<SpectrogramSettings> &&pSettings);
153 
154  const WaveformSettings &GetWaveformSettings() const;
155  WaveformSettings &GetWaveformSettings();
156  WaveformSettings &GetIndependentWaveformSettings();
157  void SetWaveformSettings(std::unique_ptr<WaveformSettings> &&pSettings);
158 
159  //
160  // High-level editing
161  //
162 
163  Track::Holder Cut(double t0, double t1) override;
164 
165  // If forClipboard is true,
166  // and there is no clip at the end time of the selection, then the result
167  // will contain a "placeholder" clip whose only purpose is to make
168  // GetEndTime() correct. This clip is not re-copied when pasting.
169  Track::Holder Copy(double t0, double t1, bool forClipboard = true) const override;
170  Track::Holder CopyNonconst(double t0, double t1) /* not override */;
171 
172  void Clear(double t0, double t1) override;
173  void Paste(double t0, const Track *src) override;
174  // May assume precondition: t0 <= t1
175  void ClearAndPaste(double t0, double t1,
176  const Track *src,
177  bool preserve = true,
178  bool merge = true,
179  const TimeWarper *effectWarper = NULL) /* not override */;
180 
181  void Silence(double t0, double t1) override;
182  void InsertSilence(double t, double len) override;
183 
184  void SplitAt(double t) /* not override */;
185  void Split(double t0, double t1) /* not override */;
186  // Track::Holder CutAndAddCutLine(double t0, double t1) /* not override */;
187  // May assume precondition: t0 <= t1
188  void ClearAndAddCutLine(double t0, double t1) /* not override */;
189 
190  Track::Holder SplitCut(double t0, double t1) /* not override */;
191  // May assume precondition: t0 <= t1
192  void SplitDelete(double t0, double t1) /* not override */;
193  void Join(double t0, double t1) /* not override */;
194  // May assume precondition: t0 <= t1
195  void Disjoin(double t0, double t1) /* not override */;
196 
197  // May assume precondition: t0 <= t1
198  void Trim(double t0, double t1) /* not override */;
199 
200  // May assume precondition: t0 <= t1
201  void HandleClear(double t0, double t1, bool addCutLines, bool split);
202 
203  void SyncLockAdjust(double oldT1, double newT1) override;
204 
210  bool IsEmpty(double t0, double t1) const;
211 
219  void Append(samplePtr buffer, sampleFormat format,
220  size_t len, unsigned int stride=1,
221  XMLWriter* blockFileLog=NULL);
223  void Flush();
224 
225  void AppendAlias(const wxString &fName, sampleCount start,
226  size_t len, int channel,bool useOD);
227 
231  //vvv Why not use the ODTypeEnum typedef to enforce that for the parameter?
232  void AppendCoded(const wxString &fName, sampleCount start,
233  size_t len, int channel, int decodeType);
234 
236  unsigned int GetODFlags() const;
237 
239  void ClearWaveCaches();
240 
242  void AddInvalidRegion(sampleCount startSample, sampleCount endSample);
243 
254  bool Get(samplePtr buffer, sampleFormat format,
255  sampleCount start, size_t len,
256  fillFormat fill = fillZero, bool mayThrow = true) const;
257  void Set(samplePtr buffer, sampleFormat format,
258  sampleCount start, size_t len);
259 
260  // Fetch envelope values corresponding to uniformly separated sample times
261  // starting at the given time.
262  void GetEnvelopeValues(double *buffer, size_t bufferLen,
263  double t0) const;
264 
265  // May assume precondition: t0 <= t1
266  std::pair<float, float> GetMinMax(
267  double t0, double t1, bool mayThrow = true) const;
268  // May assume precondition: t0 <= t1
269  float GetRMS(double t0, double t1, bool mayThrow = true) const;
270 
271  //
272  // MM: We now have more than one sequence and envelope per track, so
273  // instead of GetSequence() and GetEnvelope() we have the following
274  // function which give the sequence and envelope which is under the
275  // given X coordinate of the mouse pointer.
276  //
277  WaveClip* GetClipAtX(int xcoord);
278  Sequence* GetSequenceAtX(int xcoord);
279  Envelope* GetEnvelopeAtX(int xcoord);
280 
281  WaveClip* GetClipAtSample(sampleCount sample);
282  WaveClip* GetClipAtTime(double time);
283 
284  //
285  // Getting information about the track's internal block sizes
286  // and alignment for efficiency
287  //
288 
289  // This returns a possibly large or negative value
290  sampleCount GetBlockStart(sampleCount t) const;
291 
292  // These return a nonnegative number of samples meant to size a memory buffer
293  size_t GetBestBlockSize(sampleCount t) const;
294  size_t GetMaxBlockSize() const;
295  size_t GetIdealBlockSize();
296 
297  //
298  // XMLTagHandler callback methods for loading and saving
299  //
300 
301  bool HandleXMLTag(const wxChar *tag, const wxChar **attrs) override;
302  void HandleXMLEndTag(const wxChar *tag) override;
303  XMLTagHandler *HandleXMLChild(const wxChar *tag) override;
304  void WriteXML(XMLWriter &xmlFile) const override;
305 
306  // Returns true if an error occurred while reading from XML
307  bool GetErrorOpening() override;
308 
309  //
310  // Lock and unlock the track: you must lock the track before
311  // doing a copy and paste between projects.
312  //
313 
314  bool Lock() const;
315  bool Unlock() const;
316 
318  inline void operator () (const WaveTrack *pTrack) { pTrack->Unlock(); }
319  };
320  using LockerBase = std::unique_ptr<
321  const WaveTrack, WaveTrackLockDeleter
322  >;
323 
324  // RAII object for locking.
325  struct Locker : private LockerBase
326  {
327  friend LockerBase;
328  Locker (const WaveTrack *pTrack)
329  : LockerBase{ pTrack }
330  { pTrack->Lock(); }
331  Locker(Locker &&that) : LockerBase{std::move(that)} {}
332  Locker &operator= (Locker &&that) {
333  (LockerBase&)(*this) = std::move(that);
334  return *this;
335  }
336  };
337 
338  bool CloseLock(); //similar to Lock but should be called when the project closes.
339  // not balanced by unlocking calls.
340 
354  sampleCount TimeToLongSamples(double t0) const;
360  double LongSamplesToTime(sampleCount pos) const;
361 
362  // Get access to the (visible) clips in the tracks, in unspecified order
363  // (not necessarioy sequenced in time).
364  WaveClipHolders &GetClips() { return mClips; }
366  { return reinterpret_cast< const WaveClipConstHolders& >( mClips ); }
367 
368  // Get access to all clips (in some unspecified sequence),
369  // including those hidden in cutlines.
371  : public std::iterator< std::forward_iterator_tag, WaveClip* >
372  {
373  public:
374  // Constructs an "end" iterator
376 
377  // Construct a "begin" iterator
378  explicit AllClipsIterator( WaveTrack &track )
379  {
380  push( track.mClips );
381  }
382 
384  {
385  if (mStack.empty())
386  return nullptr;
387  else
388  return mStack.back().first->get();
389  }
390 
392  {
393  // The unspecified sequence is a post-order, but there is no
394  // promise whether sister nodes are ordered in time.
395  if ( !mStack.empty() ) {
396  auto &pair = mStack.back();
397  if ( ++pair.first == pair.second ) {
398  mStack.pop_back();
399  }
400  else
401  push( (*pair.first)->GetCutLines() );
402  }
403 
404  return *this;
405  }
406 
407  // Define == well enough to serve for loop termination test
408  friend bool operator ==
409  (const AllClipsIterator &a, const AllClipsIterator &b)
410  { return a.mStack.empty() == b.mStack.empty(); }
411 
412  friend bool operator !=
413  (const AllClipsIterator &a, const AllClipsIterator &b)
414  { return !( a == b ); }
415 
416  private:
417 
418  void push( WaveClipHolders &clips )
419  {
420  auto pClips = &clips;
421  while (!pClips->empty()) {
422  auto first = pClips->begin();
423  mStack.push_back( Pair( first, pClips->end() ) );
424  pClips = &(*first)->GetCutLines();
425  }
426  }
427 
428  using Iterator = WaveClipHolders::iterator;
429  using Pair = std::pair< Iterator, Iterator >;
430  using Stack = std::vector< Pair >;
431 
433  };
434 
436  {
437  return { AllClipsIterator{ *this }, AllClipsIterator{ } };
438  }
439 
440  // Create NEW clip and add it to this track. Returns a pointer
441  // to the newly created clip.
442  WaveClip* CreateClip();
443 
449  WaveClip* NewestOrNewClip();
450 
456  WaveClip* RightmostOrNewClip();
457 
458  // Get the linear index of a given clip (-1 if the clip is not found)
459  int GetClipIndex(const WaveClip* clip) const;
460 
461  // Get the nth clip in this WaveTrack (will return NULL if not found).
462  // Use this only in special cases (like getting the linked clip), because
463  // it is much slower than GetClipIterator().
464  WaveClip *GetClipByIndex(int index);
465  const WaveClip* GetClipByIndex(int index) const;
466 
467  // Get number of clips in this WaveTrack
468  int GetNumClips() const;
469 
470  // Add all wave clips to the given array 'clips' and sort the array by
471  // clip start time. The array is emptied prior to adding the clips.
472  WaveClipPointers SortedClipArray();
473  WaveClipConstPointers SortedClipArray() const;
474 
475  // Before calling 'Offset' on a clip, use this function to see if the
476  // offsetting is allowed with respect to the other clips in this track.
477  // This function can optionally return the amount that is allowed for offsetting
478  // in this direction maximally.
479  bool CanOffsetClip(WaveClip* clip, double amount, double *allowedAmount=NULL);
480 
481  // Before moving a clip into a track (or inserting a clip), use this
482  // function to see if the times are valid (i.e. don't overlap with
483  // existing clips).
484  bool CanInsertClip(WaveClip* clip, double &slideBy, double &tolerance);
485 
486  // Remove the clip from the track and return a SMART pointer to it.
487  // You assume responsibility for its memory!
488  std::shared_ptr<WaveClip> RemoveAndReturnClip(WaveClip* clip);
489 
490  // Append a clip to the track
491  void AddClip(std::shared_ptr<WaveClip> &&clip); // Call using std::move
492 
493  // Merge two clips, that is append data from clip2 to clip1,
494  // then remove clip2 from track.
495  // clipidx1 and clipidx2 are indices into the clip list.
496  void MergeClips(int clipidx1, int clipidx2);
497 
498  // Cache special locations (e.g. cut lines) for later speedy access
499  void UpdateLocationsCache() const;
500 
501  // Get cached locations
502  const std::vector<Location> &GetCachedLocations() const { return mDisplayLocationsCache; }
503 
504  // Expand cut line (that is, re-insert audio, then DELETE audio saved in cut line)
505  void ExpandCutLine(double cutLinePosition, double* cutlineStart = NULL, double* cutlineEnd = NULL);
506 
507  // Remove cut line, without expanding the audio in it
508  bool RemoveCutLine(double cutLinePosition);
509 
510  // This track has been merged into a stereo track. Copy shared parameters
511  // from the NEW partner.
512  void Merge(const Track &orig) override;
513 
514  // Resample track (i.e. all clips in the track)
515  void Resample(int rate, ProgressDialog *progress = NULL);
516 
517  //
518  // AutoSave related
519  //
520  // Retrieve the unique autosave ID
521  int GetAutoSaveIdent();
522  // Set the unique autosave ID
523  void SetAutoSaveIdent(int id);
524 
525  //
526  // The following code will eventually become part of a GUIWaveTrack
527  // and will be taken out of the WaveTrack class:
528  //
529 
531 
532  // DO NOT REORDER OLD VALUES! Replace obsoletes with placeholders.
533 
534  Waveform = 0,
535  MinDisplay = Waveform,
536 
538 
540 
541  obsolete1, // was SpectrumLogDisplay
542  obsolete2, // was SpectralSelectionDisplay
543  obsolete3, // was SpectralSelectionLogDisplay
544  obsolete4, // was PitchDisplay
545 
546  // Add values here, and update MaxDisplay.
547 
548  MaxDisplay = Spectrum,
549 
550  NoDisplay, // Preview track has no display
551  };
552 
553  // Only two types of sample display for now, but
554  // others (eg sinc interpolation) may be added later.
556  LinearInterpolate = 0,
557  StemPlot
558  };
559 
560  // Various preset zooming levels.
561  enum ZoomPresets {
562  kZoomToFit = 0,
571  };
572 
573  // Read appropriate value from preferences
574  static WaveTrackDisplay FindDefaultViewMode();
575 
576  // Handle remapping of enum values from 2.1.0 and earlier
577  static WaveTrackDisplay ConvertLegacyDisplayValue(int oldValue);
578 
579  // Handle restriction of range of values of the enum from future versions
580  static WaveTrackDisplay ValidateWaveTrackDisplay(WaveTrackDisplay display);
581 
582  int GetLastScaleType() const { return mLastScaleType; }
583  void SetLastScaleType() const;
584 
585  int GetLastdBRange() const { return mLastdBRange; }
586  void SetLastdBRange() const;
587 
588  WaveTrackDisplay GetDisplay() const { return mDisplay; }
589  void SetDisplay(WaveTrackDisplay display) { mDisplay = display; }
590 
591  void GetDisplayBounds(float *min, float *max) const;
592  void SetDisplayBounds(float min, float max) const;
593  void GetSpectrumBounds(float *min, float *max) const;
594  void SetSpectrumBounds(float min, float max) const;
595 
596  // For display purposes, calculate the y coordinate where the midline of
597  // the wave should be drawn, if display minimum and maximum map to the
598  // bottom and top. Maybe that is out of bounds.
599  int ZeroLevelYCoordinate(wxRect rect) const;
600 
601  protected:
602  //
603  // Protected variables
604  //
605 
607 
608  sampleFormat mFormat;
609  int mRate;
610  float mGain;
611  float mPan;
613 
614 
615  //
616  // Data that should be part of GUIWaveTrack
617  // and will be taken out of the WaveTrack class:
618  //
619  mutable float mDisplayMin;
620  mutable float mDisplayMax;
621  mutable float mSpectrumMin;
622  mutable float mSpectrumMax;
623 
625  mutable int mLastScaleType; // last scale type choice
626  mutable int mLastdBRange;
627  mutable std::vector <Location> mDisplayLocationsCache;
628 
629  //
630  // Protected methods
631  //
632 
633  private:
634 
635  //
636  // Private variables
637  //
638 
639  wxCriticalSection mFlushCriticalSection;
640  wxCriticalSection mAppendCriticalSection;
643 
644  std::unique_ptr<SpectrogramSettings> mpSpectrumSettings;
645  std::unique_ptr<WaveformSettings> mpWaveformSettings;
646 
647  std::weak_ptr<CutlineHandle> mCutlineHandle;
648  std::weak_ptr<SampleHandle> mSampleHandle;
649  std::weak_ptr<EnvelopeHandle> mEnvelopeHandle;
650 
651 protected:
652  std::shared_ptr<TrackControls> GetControls() override;
653  std::shared_ptr<TrackVRulerControls> GetVRulerControls() override;
654 };
655 
656 // This is meant to be a short-lived object, during whose lifetime,
657 // the contents of the WaveTrack are known not to change. It can replace
658 // repeated calls to WaveTrack::Get() (each of which opens and closes at least
659 // one block file).
661 public:
663  : mBufferSize(0)
664  , mOverlapBuffer()
665  , mNValidBuffers(0)
666  {
667  }
668 
669  explicit WaveTrackCache(const std::shared_ptr<const WaveTrack> &pTrack)
670  : mBufferSize(0)
671  , mOverlapBuffer()
672  , mNValidBuffers(0)
673  {
674  SetTrack(pTrack);
675  }
676  ~WaveTrackCache();
677 
678  const WaveTrack *GetTrack() const { return mPTrack.get(); }
679  void SetTrack(const std::shared_ptr<const WaveTrack> &pTrack);
680 
681  // Uses fillZero always
682  // Returns null on failure
683  // Returned pointer may be invalidated if Get is called again
684  // Do not DELETE[] the pointer
685  constSamplePtr Get(
686  sampleFormat format, sampleCount start, size_t len, bool mayThrow);
687 
688 private:
689  void Free();
690 
691  struct Buffer {
693  sampleCount start;
694  sampleCount len;
695 
696  Buffer() : start(0), len(0) {}
697  void Free() { data.reset(); start = 0; len = 0; }
698  sampleCount end() const { return start + len; }
699 
700  void swap ( Buffer &other )
701  {
702  data .swap ( other.data );
703  std::swap( start, other.start );
704  std::swap( len, other.len );
705  }
706  };
707 
708  std::shared_ptr<const WaveTrack> mPTrack;
709  size_t mBufferSize;
713 };
714 
715 #endif // __AUDACITY_WAVETRACK__
int GetKind() const override
Definition: WaveTrack.h:121
const std::vector< Location > & GetCachedLocations() const
Definition: WaveTrack.h:502
virtual void Paste(double WXUNUSED(t), const Track *WXUNUSED(src))=0
virtual void SetPan(float)
Definition: Track.h:285
std::unique_ptr< SpectrogramSettings > mpSpectrumSettings
Definition: WaveTrack.h:644
wxCriticalSection mAppendCriticalSection
Definition: WaveTrack.h:640
void Merge(const Track &init) override
Definition: Track.cpp:346
virtual Holder Copy(double WXUNUSED(t0), double WXUNUSED(t1), bool forClipboard=true) const =0
int mAutoSaveIdent
Definition: WaveTrack.h:642
virtual double GetOffset() const =0
Spectrogram settings, either for one track or as defaults.
ProgressDialog Class.
int mLastdBRange
Definition: WaveTrack.h:626
fillFormat
Definition: SampleFormat.h:37
virtual std::shared_ptr< TrackVRulerControls > GetVRulerControls()=0
float mDisplayMin
Definition: WaveTrack.h:619
void Init(const PlayableTrack &init)
Definition: Track.cpp:339
A WaveTrack contains WaveClip(s). A WaveClip contains a Sequence. A Sequence is primarily an interfac...
Definition: Sequence.h:54
virtual void SetOffset(double o)
Definition: Track.h:282
Buffer mBuffers[2]
Definition: WaveTrack.h:710
virtual XMLTagHandler * HandleXMLChild(const wxChar *tag)=0
virtual double GetEndTime() const =0
std::weak_ptr< EnvelopeHandle > mEnvelopeHandle
Definition: WaveTrack.h:649
std::pair< Iterator, Iterator > Pair
Definition: WaveTrack.h:429
float mSpectrumMax
Definition: WaveTrack.h:622
Vector operator*(const Vector &left, const Vector &right)
Definition: Matrix.cpp:153
AllClipsIterator(WaveTrack &track)
Definition: WaveTrack.h:378
int mLastScaleType
Definition: WaveTrack.h:625
Draggable curve used in TrackPanel for varying amplification.
Definition: Envelope.h:77
virtual int GetChannel() const
Definition: Track.h:278
std::unique_ptr< WaveformSettings > mpWaveformSettings
Definition: WaveTrack.h:645
virtual Holder Cut(double WXUNUSED(t0), double WXUNUSED(t1))=0
int mNValidBuffers
Definition: WaveTrack.h:712
IteratorRange< AllClipsIterator > GetAllClips()
Definition: WaveTrack.h:435
std::vector< WaveClipHolder > WaveClipHolders
Definition: WaveClip.h:122
int GetLastdBRange() const
Definition: WaveTrack.h:585
Locker(Locker &&that)
Definition: WaveTrack.h:331
virtual double GetStartTime() const =0
constSamplePtr Get(sampleFormat format, sampleCount start, size_t len, bool mayThrow)
Definition: WaveTrack.cpp:2636
std::vector< const WaveClip * > WaveClipConstPointers
Definition: WaveClip.h:127
bool operator<(const Region &b) const
Definition: WaveTrack.h:50
void swap(Buffer &other)
Definition: WaveTrack.h:700
GrowableSampleBuffer mOverlapBuffer
Definition: WaveTrack.h:711
int GetWaveColorIndex() const
Definition: WaveTrack.h:143
std::vector< Location > mDisplayLocationsCache
Definition: WaveTrack.h:627
Used to create a WaveTrack, or a LabelTrack.. Implementation of the functions of this class are dispe...
Definition: Track.h:850
virtual void WriteXML(XMLWriter &xmlFile) const =0
float mSpectrumMin
Definition: WaveTrack.h:621
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:158
void SetDisplay(WaveTrackDisplay display)
Definition: WaveTrack.h:589
TrackPanelCellIterator::CellType & operator++(TrackPanelCellIterator::CellType &type)
int format
Definition: ExportPCM.cpp:56
Region()
Definition: WaveTrack.h:44
This allows multiple clips to be a part of one WaveTrack.
Definition: WaveClip.h:176
virtual void SetPanFromChannelType()
Definition: Track.h:286
WaveTrackCache(const std::shared_ptr< const WaveTrack > &pTrack)
Definition: WaveTrack.h:669
Structure to hold region of a wavetrack and a comparison function for sortability.
Definition: WaveTrack.h:42
virtual bool HandleXMLTag(const wxChar *tag, const wxChar **attrs)=0
Locker(const WaveTrack *pTrack)
Definition: WaveTrack.h:328
A Track that contains audio waveform data.
Definition: WaveTrack.h:60
WaveClipHolders & GetClips()
Definition: WaveTrack.h:364
double start
Definition: WaveTrack.h:47
Fundamental data object of Audacity, placed in the TrackPanel. Classes derived form it include the Wa...
Definition: Track.h:94
virtual void DoSetMinimized(bool isMinimized)
Definition: Track.cpp:237
void SetTrack(const std::shared_ptr< const WaveTrack > &pTrack)
Definition: WaveTrack.cpp:2617
size_t mBufferSize
Definition: WaveTrack.h:709
std::vector< Pair > Stack
Definition: WaveTrack.h:430
virtual void Clear(double WXUNUSED(t0), double WXUNUSED(t1))=0
This class is an interface which should be implemented by classes which wish to be able to load and s...
Definition: XMLTagHandler.h:70
wxCriticalSection mFlushCriticalSection
Definition: WaveTrack.h:639
WaveTrackDisplay mDisplay
Definition: WaveTrack.h:624
std::weak_ptr< SampleHandle > mSampleHandle
Definition: WaveTrack.h:648
int min(int a, int b)
int mRate
Definition: WaveTrack.h:609
std::shared_ptr< const WaveTrack > mPTrack
Definition: WaveTrack.h:708
An AudioTrack that can be played and stopped.
Definition: Track.h:368
float mGain
Definition: WaveTrack.h:610
std::weak_ptr< CutlineHandle > mCutlineHandle
Definition: WaveTrack.h:647
sampleFormat mFormat
Definition: WaveTrack.h:608
WaveClipHolders mClips
Definition: WaveTrack.h:606
WaveTrackDisplay
Definition: WaveTrack.h:530
Region(double start_, double end_)
Definition: WaveTrack.h:45
bool Unlock() const
Definition: WaveTrack.cpp:1841
int GetLastScaleType() const
Definition: WaveTrack.h:582
bool Lock() const
Definition: WaveTrack.cpp:1824
virtual void InsertSilence(double WXUNUSED(t), double WXUNUSED(len))=0
Interface to libsoxr.
Definition: Resample.h:30
double end
Definition: WaveTrack.h:47
std::unordered_set< ConstBlockFilePtr > Set
Definition: UndoManager.cpp:44
sampleFormat GetSampleFormat() const
Definition: WaveTrack.h:146
std::unique_ptr< const WaveTrack, WaveTrackLockDeleter > LockerBase
Definition: WaveTrack.h:322
float mPan
Definition: WaveTrack.h:611
virtual std::vector< UIHandlePtr > DetailedHitTest(const TrackPanelMouseState &, const AudacityProject *pProject, int currentTool, bool bMultiTool)=0
Transforms one point in time to another point. For example, a time stretching effect might use one to...
Definition: TimeWarper.h:61
WaveClipHolders::iterator Iterator
Definition: WaveTrack.h:428
std::vector< WaveClip * > WaveClipPointers
Definition: WaveClip.h:126
virtual void HandleXMLEndTag(const wxChar *WXUNUSED(tag))
Definition: XMLTagHandler.h:87
const WaveTrack * GetTrack() const
Definition: WaveTrack.h:678
const WaveClipConstHolders & GetClips() const
Definition: WaveTrack.h:365
std::unique_ptr< Track > Holder
Definition: Track.h:256
virtual void SyncLockAdjust(double oldT1, double newT1)
Definition: Track.cpp:316
virtual void Silence(double WXUNUSED(t0), double WXUNUSED(t1))=0
Base class for XMLFileWriter and XMLStringWriter that provides the general functionality for creating...
Definition: XMLWriter.h:22
WaveTrackDisplay GetDisplay() const
Definition: WaveTrack.h:588
WaveTrackLocation Location
Definition: WaveTrack.h:89
void push(WaveClipHolders &clips)
Definition: WaveTrack.h:418
virtual std::shared_ptr< TrackControls > GetControls()=0
std::vector< std::shared_ptr< const WaveClip > > WaveClipConstHolders
Definition: WaveClip.h:123
float mDisplayMax
Definition: WaveTrack.h:620
virtual bool GetErrorOpening()
Definition: Track.h:329
sampleCount end() const
Definition: WaveTrack.h:698
virtual Holder Duplicate() const =0
double mLegacyProjectFileOffset
Definition: WaveTrack.h:641
int mWaveColorIndex
Definition: WaveTrack.h:612
Waveform settings, either for one track or as defaults.