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,
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 override;
109 
115  double GetEndTime() const override;
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  void UseSpectralPrefs( bool bUse=true );
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, sampleCount * pNumCopied = nullptr) 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 
530 
531  typedef int WaveTrackDisplay;
533 
534  // DO NOT REORDER OLD VALUES! Replace obsoletes with placeholders.
535 
536  Waveform = 0,
537  MinDisplay = Waveform,
538 
540 
542 
543  obsolete1, // was SpectrumLogDisplay
544  obsolete2, // was SpectralSelectionDisplay
545  obsolete3, // was SpectralSelectionLogDisplay
546  obsolete4, // was PitchDisplay
547 
548  // Add values here, and update MaxDisplay.
549 
550  MaxDisplay = Spectrum,
551 
552  NoDisplay, // Preview track has no display
553  };
554 
555  // Only two types of sample display for now, but
556  // others (eg sinc interpolation) may be added later.
558  LinearInterpolate = 0,
559  StemPlot
560  };
561 
562  // Various preset zooming levels.
563  enum ZoomPresets {
564  kZoomToFit = 0,
579  };
580 
581  // Handle remapping of enum values from 2.1.0 and earlier
582  static WaveTrackDisplay ConvertLegacyDisplayValue(int oldValue);
583 
584  // Handle restriction of range of values of the enum from future versions
585  static WaveTrackDisplay ValidateWaveTrackDisplay(WaveTrackDisplay display);
586 
587  int GetLastScaleType() const { return mLastScaleType; }
588  void SetLastScaleType() const;
589 
590  int GetLastdBRange() const { return mLastdBRange; }
591  void SetLastdBRange() const;
592 
593  WaveTrackDisplay GetDisplay() const { return mDisplay; }
594  void SetDisplay(WaveTrackDisplay display) { mDisplay = display; }
595 
596  void GetDisplayBounds(float *min, float *max) const;
597  void SetDisplayBounds(float min, float max) const;
598  void GetSpectrumBounds(float *min, float *max) const;
599  void SetSpectrumBounds(float min, float max) const;
600 
601  // For display purposes, calculate the y coordinate where the midline of
602  // the wave should be drawn, if display minimum and maximum map to the
603  // bottom and top. Maybe that is out of bounds.
604  int ZeroLevelYCoordinate(wxRect rect) const;
605 
606  protected:
607  //
608  // Protected variables
609  //
610 
612 
614  int mRate;
615  float mGain;
616  float mPan;
618 
619 
620  //
621  // Data that should be part of GUIWaveTrack
622  // and will be taken out of the WaveTrack class:
623  //
624  mutable float mDisplayMin;
625  mutable float mDisplayMax;
626  mutable float mSpectrumMin;
627  mutable float mSpectrumMax;
628 
630  mutable int mLastScaleType; // last scale type choice
631  mutable int mLastdBRange;
632  mutable std::vector <Location> mDisplayLocationsCache;
633 
634  //
635  // Protected methods
636  //
637 
638  private:
639 
640  //
641  // Private variables
642  //
643 
644  wxCriticalSection mFlushCriticalSection;
645  wxCriticalSection mAppendCriticalSection;
648 
649  std::unique_ptr<SpectrogramSettings> mpSpectrumSettings;
650  std::unique_ptr<WaveformSettings> mpWaveformSettings;
651 
652  std::weak_ptr<CutlineHandle> mCutlineHandle;
653  std::weak_ptr<SampleHandle> mSampleHandle;
654  std::weak_ptr<EnvelopeHandle> mEnvelopeHandle;
655 
656 protected:
657  std::shared_ptr<TrackControls> GetControls() override;
658  std::shared_ptr<TrackVRulerControls> GetVRulerControls() override;
659 };
660 
661 // This is meant to be a short-lived object, during whose lifetime,
662 // the contents of the WaveTrack are known not to change. It can replace
663 // repeated calls to WaveTrack::Get() (each of which opens and closes at least
664 // one block file).
666 public:
668  : mBufferSize(0)
669  , mOverlapBuffer()
670  , mNValidBuffers(0)
671  {
672  }
673 
674  explicit WaveTrackCache(const std::shared_ptr<const WaveTrack> &pTrack)
675  : mBufferSize(0)
676  , mOverlapBuffer()
677  , mNValidBuffers(0)
678  {
679  SetTrack(pTrack);
680  }
681  ~WaveTrackCache();
682 
683  const WaveTrack *GetTrack() const { return mPTrack.get(); }
684  void SetTrack(const std::shared_ptr<const WaveTrack> &pTrack);
685 
686  // Uses fillZero always
687  // Returns null on failure
688  // Returned pointer may be invalidated if Get is called again
689  // Do not DELETE[] the pointer
691  sampleFormat format, sampleCount start, size_t len, bool mayThrow);
692 
693 private:
694  void Free();
695 
696  struct Buffer {
700 
701  Buffer() : start(0), len(0) {}
702  void Free() { data.reset(); start = 0; len = 0; }
703  sampleCount end() const { return start + len; }
704 
705  void swap ( Buffer &other )
706  {
707  data .swap ( other.data );
708  std::swap( start, other.start );
709  std::swap( len, other.len );
710  }
711  };
712 
713  std::shared_ptr<const WaveTrack> mPTrack;
714  size_t mBufferSize;
718 };
719 
720 #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:293
std::unique_ptr< SpectrogramSettings > mpSpectrumSettings
Definition: WaveTrack.h:649
wxCriticalSection mAppendCriticalSection
Definition: WaveTrack.h:645
void Merge(const Track &init) override
Definition: Track.cpp:350
virtual Holder Copy(double WXUNUSED(t0), double WXUNUSED(t1), bool forClipboard=true) const =0
int mAutoSaveIdent
Definition: WaveTrack.h:647
virtual double GetOffset() const =0
Spectrogram settings, either for one track or as defaults.
ProgressDialog Class.
int mLastdBRange
Definition: WaveTrack.h:631
fillFormat
Definition: SampleFormat.h:37
virtual std::shared_ptr< TrackVRulerControls > GetVRulerControls()=0
float mDisplayMin
Definition: WaveTrack.h:624
void Init(const PlayableTrack &init)
Definition: Track.cpp:343
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:290
Buffer mBuffers[2]
Definition: WaveTrack.h:715
virtual XMLTagHandler * HandleXMLChild(const wxChar *tag)=0
virtual double GetEndTime() const =0
std::weak_ptr< EnvelopeHandle > mEnvelopeHandle
Definition: WaveTrack.h:654
std::pair< Iterator, Iterator > Pair
Definition: WaveTrack.h:429
float mSpectrumMax
Definition: WaveTrack.h:627
Vector operator*(const Vector &left, const Vector &right)
Definition: Matrix.cpp:153
AllClipsIterator(WaveTrack &track)
Definition: WaveTrack.h:378
int mLastScaleType
Definition: WaveTrack.h:630
Draggable curve used in TrackPanel for varying amplification.
Definition: Envelope.h:77
virtual int GetChannel() const
Definition: Track.h:286
std::unique_ptr< WaveformSettings > mpWaveformSettings
Definition: WaveTrack.h:650
virtual Holder Cut(double WXUNUSED(t0), double WXUNUSED(t1))=0
int mNValidBuffers
Definition: WaveTrack.h:717
IteratorRange< AllClipsIterator > GetAllClips()
Definition: WaveTrack.h:435
int WaveTrackDisplay
Definition: WaveTrack.h:531
std::vector< WaveClipHolder > WaveClipHolders
Definition: WaveClip.h:122
int GetLastdBRange() const
Definition: WaveTrack.h:590
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:2633
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:705
GrowableSampleBuffer mOverlapBuffer
Definition: WaveTrack.h:716
int GetWaveColorIndex() const
Definition: WaveTrack.h:143
std::vector< Location > mDisplayLocationsCache
Definition: WaveTrack.h:632
Used to create a WaveTrack, or a LabelTrack.. Implementation of the functions of this class are dispe...
Definition: Track.h:863
virtual void WriteXML(XMLWriter &xmlFile) const =0
float mSpectrumMin
Definition: WaveTrack.h:626
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:176
void SetDisplay(WaveTrackDisplay display)
Definition: WaveTrack.h:594
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:294
WaveTrackCache(const std::shared_ptr< const WaveTrack > &pTrack)
Definition: WaveTrack.h:674
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:328
char * samplePtr
Definition: Types.h:203
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:102
virtual void DoSetMinimized(bool isMinimized)
Definition: Track.cpp:239
void SetTrack(const std::shared_ptr< const WaveTrack > &pTrack)
Definition: WaveTrack.cpp:2614
size_t mBufferSize
Definition: WaveTrack.h:714
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:644
WaveTrackDisplay mDisplay
Definition: WaveTrack.h:629
std::weak_ptr< SampleHandle > mSampleHandle
Definition: WaveTrack.h:653
int min(int a, int b)
int mRate
Definition: WaveTrack.h:614
std::shared_ptr< const WaveTrack > mPTrack
Definition: WaveTrack.h:713
An AudioTrack that can be played and stopped.
Definition: Track.h:376
float mGain
Definition: WaveTrack.h:615
std::weak_ptr< CutlineHandle > mCutlineHandle
Definition: WaveTrack.h:652
sampleFormat mFormat
Definition: WaveTrack.h:613
WaveClipHolders mClips
Definition: WaveTrack.h:611
Region(double start_, double end_)
Definition: WaveTrack.h:45
bool Unlock() const
Definition: WaveTrack.cpp:1835
int GetLastScaleType() const
Definition: WaveTrack.h:587
WaveTrackDisplayValues
Definition: WaveTrack.h:532
bool Lock() const
Definition: WaveTrack.cpp:1818
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:42
sampleFormat GetSampleFormat() const
Definition: WaveTrack.h:146
std::unique_ptr< const WaveTrack, WaveTrackLockDeleter > LockerBase
Definition: WaveTrack.h:322
float mPan
Definition: WaveTrack.h:616
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: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:683
const WaveClipConstHolders & GetClips() const
Definition: WaveTrack.h:365
std::unique_ptr< Track > Holder
Definition: Track.h:264
virtual void SyncLockAdjust(double oldT1, double newT1)
Definition: Track.cpp:320
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:593
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:625
virtual bool GetErrorOpening()
Definition: Track.h:337
sampleCount end() const
Definition: WaveTrack.h:703
virtual Holder Duplicate() const =0
double mLegacyProjectFileOffset
Definition: WaveTrack.h:646
int mWaveColorIndex
Definition: WaveTrack.h:617
Waveform settings, either for one track or as defaults.