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