Audacity  2.2.0
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 
40 #ifdef EXPERIMENTAL_OUTPUT_DISPLAY
41 #define MONO_WAVE_PAN(T) \
42  (T != NULL && \
43  T->GetChannel() == Track::MonoChannel && \
44  T->GetKind() == Track::Wave && \
45  ((const WaveTrack *)T)->GetPan() != 0 && \
46  WaveTrack::mMonoAsVirtualStereo && \
47  ((const WaveTrack *)T)->GetDisplay() == WaveTrack::Waveform)
48 
49 #define MONO_PAN \
50  (mPan != 0.0 && \
51  mChannel == MonoChannel && \
52  mDisplay == Waveform && \
53  mMonoAsVirtualStereo)
54 #endif
55 
58 struct Region
59 {
60  Region() : start(0), end(0) {}
61  Region(double start_, double end_) : start(start_), end(end_) {}
62 
63  double start, end;
64 
65  //used for sorting
66  bool operator < (const Region &b) const
67  {
68  return this->start < b.start;
69  }
70 };
71 
72 class Regions : public std::vector < Region > {};
73 
74 class Envelope;
75 
76 class AUDACITY_DLL_API WaveTrack final : public PlayableTrack {
77 
78  private:
79 
80  //
81  // Constructor / Destructor / Duplicator
82  //
83  // Private since only factories are allowed to construct WaveTracks
84  //
85 
86  WaveTrack(const std::shared_ptr<DirManager> &projDirManager,
87  sampleFormat format = (sampleFormat)0,
88  double rate = 0);
89  WaveTrack(const WaveTrack &orig);
90 
91  void Init(const WaveTrack &orig);
92 
93  Track::Holder Duplicate() const override;
94 
95 #ifdef EXPERIMENTAL_OUTPUT_DISPLAY
96  void VirtualStereoInit();
97 #endif
98  friend class TrackFactory;
99 
100  public:
101 #ifdef EXPERIMENTAL_OUTPUT_DISPLAY
102  static bool mMonoAsVirtualStereo;
103 #endif
104 
106  using Holder = std::unique_ptr<WaveTrack>;
107 
108  virtual ~WaveTrack();
109 
110  std::vector<UIHandlePtr> DetailedHitTest
111  (const TrackPanelMouseState &state,
112  const AudacityProject *pProject, int currentTool, bool bMultiTool)
113  override;
114 
115  double GetOffset() const override;
116  void SetOffset(double o) override;
117  virtual int GetChannel() const override;
118  virtual void SetPanFromChannelType() override;
119 
124  double GetStartTime() const;
125 
131  double GetEndTime() const;
132 
133  //
134  // Identifying the type of track
135  //
136 
137  int GetKind() const override { return Wave; }
138 #ifdef EXPERIMENTAL_OUTPUT_DISPLAY
139  int GetMinimizedHeight() const override;
140 #endif
141  //
142  // WaveTrack parameters
143  //
144 
145  double GetRate() const;
146  void SetRate(double newRate);
147 
148  // Multiplicative factor. Only converted to dB for display.
149  float GetGain() const;
150  void SetGain(float newGain);
151 
152  // -1.0 (left) -> 1.0 (right)
153  float GetPan() const;
154 #ifdef EXPERIMENTAL_OUTPUT_DISPLAY
155  bool SetPan(float newPan);
156 #else
157  void SetPan(float newPan) override;
158 #endif
159  // Takes gain and pan into account
160  float GetChannelGain(int channel) const;
161 #ifdef EXPERIMENTAL_OUTPUT_DISPLAY
162  void SetVirtualState(bool state, bool half=false);
163 #endif
164 
165  int GetWaveColorIndex() const { return mWaveColorIndex; };
166  void SetWaveColorIndex(int colorIndex);
167 
168  sampleFormat GetSampleFormat() const { return mFormat; }
169  void ConvertToSampleFormat(sampleFormat format);
170 
171  const SpectrogramSettings &GetSpectrogramSettings() const;
172  SpectrogramSettings &GetSpectrogramSettings();
173  SpectrogramSettings &GetIndependentSpectrogramSettings();
174  void SetSpectrogramSettings(std::unique_ptr<SpectrogramSettings> &&pSettings);
175 
176  const WaveformSettings &GetWaveformSettings() const;
177  WaveformSettings &GetWaveformSettings();
178  WaveformSettings &GetIndependentWaveformSettings();
179  void SetWaveformSettings(std::unique_ptr<WaveformSettings> &&pSettings);
180 
181  //
182  // High-level editing
183  //
184 
185  Track::Holder Cut(double t0, double t1) override;
186 
187  // If forClipboard is true,
188  // and there is no clip at the end time of the selection, then the result
189  // will contain a "placeholder" clip whose only purpose is to make
190  // GetEndTime() correct. This clip is not re-copied when pasting.
191  Track::Holder Copy(double t0, double t1, bool forClipboard = true) const override;
192  Track::Holder CopyNonconst(double t0, double t1) /* not override */;
193 
194  void Clear(double t0, double t1) override;
195  void Paste(double t0, const Track *src) override;
196  // May assume precondition: t0 <= t1
197  void ClearAndPaste(double t0, double t1,
198  const Track *src,
199  bool preserve = true,
200  bool merge = true,
201  const TimeWarper *effectWarper = NULL) /* not override */;
202 
203  void Silence(double t0, double t1) override;
204  void InsertSilence(double t, double len) override;
205 
206  void SplitAt(double t) /* not override */;
207  void Split(double t0, double t1) /* not override */;
208  // Track::Holder CutAndAddCutLine(double t0, double t1) /* not override */;
209  // May assume precondition: t0 <= t1
210  void ClearAndAddCutLine(double t0, double t1) /* not override */;
211 
212  Track::Holder SplitCut(double t0, double t1) /* not override */;
213  // May assume precondition: t0 <= t1
214  void SplitDelete(double t0, double t1) /* not override */;
215  void Join(double t0, double t1) /* not override */;
216  // May assume precondition: t0 <= t1
217  void Disjoin(double t0, double t1) /* not override */;
218 
219  // May assume precondition: t0 <= t1
220  void Trim(double t0, double t1) /* not override */;
221 
222  // May assume precondition: t0 <= t1
223  void HandleClear(double t0, double t1, bool addCutLines, bool split);
224 
225  void SyncLockAdjust(double oldT1, double newT1) override;
226 
232  bool IsEmpty(double t0, double t1) const;
233 
241  void Append(samplePtr buffer, sampleFormat format,
242  size_t len, unsigned int stride=1,
243  XMLWriter* blockFileLog=NULL);
245  void Flush();
246 
247  void AppendAlias(const wxString &fName, sampleCount start,
248  size_t len, int channel,bool useOD);
249 
253  //vvv Why not use the ODTypeEnum typedef to enforce that for the parameter?
254  void AppendCoded(const wxString &fName, sampleCount start,
255  size_t len, int channel, int decodeType);
256 
258  unsigned int GetODFlags() const;
259 
261  void ClearWaveCaches();
262 
264  void AddInvalidRegion(sampleCount startSample, sampleCount endSample);
265 
276  bool Get(samplePtr buffer, sampleFormat format,
277  sampleCount start, size_t len,
278  fillFormat fill = fillZero, bool mayThrow = true) const;
279  void Set(samplePtr buffer, sampleFormat format,
280  sampleCount start, size_t len);
281 
282  // Fetch envelope values corresponding to uniformly separated sample times
283  // starting at the given time.
284  void GetEnvelopeValues(double *buffer, size_t bufferLen,
285  double t0) const;
286 
287  // May assume precondition: t0 <= t1
288  std::pair<float, float> GetMinMax(
289  double t0, double t1, bool mayThrow = true) const;
290  // May assume precondition: t0 <= t1
291  float GetRMS(double t0, double t1, bool mayThrow = true) const;
292 
293  //
294  // MM: We now have more than one sequence and envelope per track, so
295  // instead of GetSequence() and GetEnvelope() we have the following
296  // function which give the sequence and envelope which is under the
297  // given X coordinate of the mouse pointer.
298  //
299  WaveClip* GetClipAtX(int xcoord);
300  Sequence* GetSequenceAtX(int xcoord);
301  Envelope* GetEnvelopeAtX(int xcoord);
302 
303  WaveClip* GetClipAtSample(sampleCount sample);
304  WaveClip* GetClipAtTime(double time);
305 
306  //
307  // Getting information about the track's internal block sizes
308  // and alignment for efficiency
309  //
310 
311  // This returns a possibly large or negative value
312  sampleCount GetBlockStart(sampleCount t) const;
313 
314  // These return a nonnegative number of samples meant to size a memory buffer
315  size_t GetBestBlockSize(sampleCount t) const;
316  size_t GetMaxBlockSize() const;
317  size_t GetIdealBlockSize();
318 
319  //
320  // XMLTagHandler callback methods for loading and saving
321  //
322 
323  bool HandleXMLTag(const wxChar *tag, const wxChar **attrs) override;
324  void HandleXMLEndTag(const wxChar *tag) override;
325  XMLTagHandler *HandleXMLChild(const wxChar *tag) override;
326  void WriteXML(XMLWriter &xmlFile) const override;
327 
328  // Returns true if an error occurred while reading from XML
329  bool GetErrorOpening() override;
330 
331  //
332  // Lock and unlock the track: you must lock the track before
333  // doing a copy and paste between projects.
334  //
335 
336  bool Lock() const;
337  bool Unlock() const;
338 
340  inline void operator () (const WaveTrack *pTrack) { pTrack->Unlock(); }
341  };
342  using LockerBase = std::unique_ptr<
343  const WaveTrack, WaveTrackLockDeleter
344  >;
345 
346  // RAII object for locking.
347  struct Locker : private LockerBase
348  {
349  friend LockerBase;
350  Locker (const WaveTrack *pTrack)
351  : LockerBase{ pTrack }
352  { pTrack->Lock(); }
353  Locker(Locker &&that) : LockerBase{std::move(that)} {}
354  Locker &operator= (Locker &&that) {
355  (LockerBase&)(*this) = std::move(that);
356  return *this;
357  }
358  };
359 
360  bool CloseLock(); //similar to Lock but should be called when the project closes.
361  // not balanced by unlocking calls.
362 
376  sampleCount TimeToLongSamples(double t0) const;
382  double LongSamplesToTime(sampleCount pos) const;
383 
384  // Get access to the (visible) clips in the tracks, in unspecified order
385  // (not necessarioy sequenced in time).
386  WaveClipHolders &GetClips() { return mClips; }
388  { return reinterpret_cast< const WaveClipConstHolders& >( mClips ); }
389 
390  // Get access to all clips (in some unspecified sequence),
391  // including those hidden in cutlines.
393  : public std::iterator< std::forward_iterator_tag, WaveClip* >
394  {
395  public:
396  // Constructs an "end" iterator
398 
399  // Construct a "begin" iterator
400  explicit AllClipsIterator( WaveTrack &track )
401  {
402  push( track.mClips );
403  }
404 
406  {
407  if (mStack.empty())
408  return nullptr;
409  else
410  return mStack.back().first->get();
411  }
412 
414  {
415  // The unspecified sequence is a post-order, but there is no
416  // promise whether sister nodes are ordered in time.
417  if ( !mStack.empty() ) {
418  auto &pair = mStack.back();
419  if ( ++pair.first == pair.second ) {
420  mStack.pop_back();
421  }
422  else
423  push( (*pair.first)->GetCutLines() );
424  }
425 
426  return *this;
427  }
428 
429  // Define == well enough to serve for loop termination test
430  friend bool operator ==
431  (const AllClipsIterator &a, const AllClipsIterator &b)
432  { return a.mStack.empty() == b.mStack.empty(); }
433 
434  friend bool operator !=
435  (const AllClipsIterator &a, const AllClipsIterator &b)
436  { return !( a == b ); }
437 
438  private:
439 
440  void push( WaveClipHolders &clips )
441  {
442  auto pClips = &clips;
443  while (!pClips->empty()) {
444  auto first = pClips->begin();
445  mStack.push_back( Pair( first, pClips->end() ) );
446  pClips = &(*first)->GetCutLines();
447  }
448  }
449 
450  using Iterator = WaveClipHolders::iterator;
451  using Pair = std::pair< Iterator, Iterator >;
452  using Stack = std::vector< Pair >;
453 
455  };
456 
458  {
459  return { AllClipsIterator{ *this }, AllClipsIterator{ } };
460  }
461 
462  // Create NEW clip and add it to this track. Returns a pointer
463  // to the newly created clip.
464  WaveClip* CreateClip();
465 
471  WaveClip* NewestOrNewClip();
472 
478  WaveClip* RightmostOrNewClip();
479 
480  // Get the linear index of a given clip (-1 if the clip is not found)
481  int GetClipIndex(const WaveClip* clip) const;
482 
483  // Get the nth clip in this WaveTrack (will return NULL if not found).
484  // Use this only in special cases (like getting the linked clip), because
485  // it is much slower than GetClipIterator().
486  WaveClip *GetClipByIndex(int index);
487  const WaveClip* GetClipByIndex(int index) const;
488 
489  // Get number of clips in this WaveTrack
490  int GetNumClips() const;
491 
492  // Add all wave clips to the given array 'clips' and sort the array by
493  // clip start time. The array is emptied prior to adding the clips.
494  WaveClipPointers SortedClipArray();
495  WaveClipConstPointers SortedClipArray() const;
496 
497  // Before calling 'Offset' on a clip, use this function to see if the
498  // offsetting is allowed with respect to the other clips in this track.
499  // This function can optionally return the amount that is allowed for offsetting
500  // in this direction maximally.
501  bool CanOffsetClip(WaveClip* clip, double amount, double *allowedAmount=NULL);
502 
503  // Before moving a clip into a track (or inserting a clip), use this
504  // function to see if the times are valid (i.e. don't overlap with
505  // existing clips).
506  bool CanInsertClip(WaveClip* clip, double &slideBy, double &tolerance);
507 
508  // Remove the clip from the track and return a SMART pointer to it.
509  // You assume responsibility for its memory!
510  std::shared_ptr<WaveClip> RemoveAndReturnClip(WaveClip* clip);
511 
512  // Append a clip to the track
513  void AddClip(std::shared_ptr<WaveClip> &&clip); // Call using std::move
514 
515  // Merge two clips, that is append data from clip2 to clip1,
516  // then remove clip2 from track.
517  // clipidx1 and clipidx2 are indices into the clip list.
518  void MergeClips(int clipidx1, int clipidx2);
519 
520  // Cache special locations (e.g. cut lines) for later speedy access
521  void UpdateLocationsCache() const;
522 
523  // Get cached locations
524  const std::vector<Location> &GetCachedLocations() const { return mDisplayLocationsCache; }
525 
526  // Expand cut line (that is, re-insert audio, then DELETE audio saved in cut line)
527  void ExpandCutLine(double cutLinePosition, double* cutlineStart = NULL, double* cutlineEnd = NULL);
528 
529  // Remove cut line, without expanding the audio in it
530  bool RemoveCutLine(double cutLinePosition);
531 
532  // This track has been merged into a stereo track. Copy shared parameters
533  // from the NEW partner.
534  void Merge(const Track &orig) override;
535 
536  // Resample track (i.e. all clips in the track)
537  void Resample(int rate, ProgressDialog *progress = NULL);
538 
539  //
540  // AutoSave related
541  //
542  // Retrieve the unique autosave ID
543  int GetAutoSaveIdent();
544  // Set the unique autosave ID
545  void SetAutoSaveIdent(int id);
546 
547  //
548  // The following code will eventually become part of a GUIWaveTrack
549  // and will be taken out of the WaveTrack class:
550  //
551 
553 
554  // DO NOT REORDER OLD VALUES! Replace obsoletes with placeholders.
555 
556  Waveform = 0,
557  MinDisplay = Waveform,
558 
560 
562 
563  obsolete1, // was SpectrumLogDisplay
564  obsolete2, // was SpectralSelectionDisplay
565  obsolete3, // was SpectralSelectionLogDisplay
566  obsolete4, // was PitchDisplay
567 
568  // Add values here, and update MaxDisplay.
569 
570  MaxDisplay = Spectrum,
571 
572  NoDisplay, // Preview track has no display
573  };
574 
575  // Only two types of sample display for now, but
576  // others (eg sinc interpolation) may be added later.
578  LinarInterpolate = 0,
579  StemPlot
580  };
581 
582  // Read appropriate value from preferences
583  static WaveTrackDisplay FindDefaultViewMode();
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 
617  sampleFormat mFormat;
618  int mRate;
619  float mGain;
620  float mPan;
622 
623 
624  //
625  // Data that should be part of GUIWaveTrack
626  // and will be taken out of the WaveTrack class:
627  //
628  mutable float mDisplayMin;
629  mutable float mDisplayMax;
630  mutable float mSpectrumMin;
631  mutable float mSpectrumMax;
632 
634  mutable int mLastScaleType; // last scale type choice
635  mutable int mLastdBRange;
636  mutable std::vector <Location> mDisplayLocationsCache;
637 
638  //
639  // Protected methods
640  //
641 
642  private:
643 
644  //
645  // Private variables
646  //
647 
648  wxCriticalSection mFlushCriticalSection;
649  wxCriticalSection mAppendCriticalSection;
652 
653  std::unique_ptr<SpectrogramSettings> mpSpectrumSettings;
654  std::unique_ptr<WaveformSettings> mpWaveformSettings;
655 
656  std::weak_ptr<CutlineHandle> mCutlineHandle;
657  std::weak_ptr<SampleHandle> mSampleHandle;
658  std::weak_ptr<EnvelopeHandle> mEnvelopeHandle;
659 
660 protected:
661  std::shared_ptr<TrackControls> GetControls() override;
662  std::shared_ptr<TrackVRulerControls> GetVRulerControls() override;
663 };
664 
665 // This is meant to be a short-lived object, during whose lifetime,
666 // the contents of the WaveTrack are known not to change. It can replace
667 // repeated calls to WaveTrack::Get() (each of which opens and closes at least
668 // one block file).
670 public:
672  : mPTrack(0)
673  , mBufferSize(0)
674  , mOverlapBuffer()
675  , mNValidBuffers(0)
676  {
677  }
678 
679  explicit WaveTrackCache(const WaveTrack *pTrack)
680  : mPTrack(0)
681  , mBufferSize(0)
682  , mOverlapBuffer()
683  , mNValidBuffers(0)
684  {
685  SetTrack(pTrack);
686  }
687  ~WaveTrackCache();
688 
689  const WaveTrack *GetTrack() const { return mPTrack; }
690  void SetTrack(const WaveTrack *pTrack);
691 
692  // Uses fillZero always
693  // Returns null on failure
694  // Returned pointer may be invalidated if Get is called again
695  // Do not DELETE[] the pointer
696  constSamplePtr Get(
697  sampleFormat format, sampleCount start, size_t len, bool mayThrow);
698 
699 private:
700  void Free();
701 
702  struct Buffer {
704  sampleCount start;
705  sampleCount len;
706 
707  Buffer() : start(0), len(0) {}
708  void Free() { data.reset(); start = 0; len = 0; }
709  sampleCount end() const { return start + len; }
710 
711  void swap ( Buffer &other )
712  {
713  data .swap ( other.data );
714  std::swap( start, other.start );
715  std::swap( len, other.len );
716  }
717  };
718 
720  size_t mBufferSize;
724 };
725 
726 #endif // __AUDACITY_WAVETRACK__
int GetKind() const override
Definition: WaveTrack.h:137
const std::vector< Location > & GetCachedLocations() const
Definition: WaveTrack.h:524
virtual void Paste(double WXUNUSED(t), const Track *WXUNUSED(src))=0
SampleDisplay
Definition: WaveTrack.h:577
Definition: Track.h:227
virtual void SetPan(float)
Definition: Track.h:273
std::unique_ptr< SpectrogramSettings > mpSpectrumSettings
Definition: WaveTrack.h:653
wxCriticalSection mAppendCriticalSection
Definition: WaveTrack.h:649
friend LockerBase
Definition: WaveTrack.h:349
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:651
~WaveTrackCache()
Definition: WaveTrack.cpp:2667
virtual double GetOffset() const =0
Definition: WaveTrackLocation.h:14
Spectrogram settings, either for one track or as defaults.
Definition: SpectrogramSettings.h:25
ProgressDialog Class.
Definition: ProgressDialog.h:56
int mLastdBRange
Definition: WaveTrack.h:635
Definition: WaveTrack.h:561
Definition: WaveTrack.h:347
fillFormat
Definition: SampleFormat.h:37
virtual std::shared_ptr< TrackVRulerControls > GetVRulerControls()=0
float mDisplayMin
Definition: WaveTrack.h:628
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:55
virtual void SetOffset(double o)
Definition: Track.h:267
Stack mStack
Definition: WaveTrack.h:454
Buffer mBuffers[2]
Definition: WaveTrack.h:721
virtual XMLTagHandler * HandleXMLChild(const wxChar *tag)=0
virtual double GetEndTime() const =0
std::weak_ptr< EnvelopeHandle > mEnvelopeHandle
Definition: WaveTrack.h:658
sampleCount start
Definition: WaveTrack.h:704
std::pair< Iterator, Iterator > Pair
Definition: WaveTrack.h:451
float mSpectrumMax
Definition: WaveTrack.h:631
Vector operator*(const Vector &left, const Vector &right)
Definition: Matrix.cpp:153
AllClipsIterator(WaveTrack &track)
Definition: WaveTrack.h:400
sampleCount len
Definition: WaveTrack.h:705
int mLastScaleType
Definition: WaveTrack.h:634
Draggable curve used in TrackPanel for varying amplification.
Definition: Envelope.h:78
virtual int GetChannel() const
Definition: Track.h:263
std::unique_ptr< WaveformSettings > mpWaveformSettings
Definition: WaveTrack.h:654
virtual Holder Cut(double WXUNUSED(t0), double WXUNUSED(t1))=0
int mNValidBuffers
Definition: WaveTrack.h:723
IteratorRange< AllClipsIterator > GetAllClips()
Definition: WaveTrack.h:457
Definition: MemoryX.h:853
Definition: WaveTrack.h:563
virtual int GetMinimizedHeight() const
Definition: Track.cpp:139
std::vector< WaveClipHolder > WaveClipHolders
Definition: WaveClip.h:123
int GetLastdBRange() const
Definition: WaveTrack.h:594
Definition: WaveTrack.h:565
WaveTrackCache()
Definition: WaveTrack.h:671
Locker(Locker &&that)
Definition: WaveTrack.h:353
virtual double GetStartTime() const =0
Definition: TrackPanelMouseEvent.h:23
constSamplePtr Get(sampleFormat format, sampleCount start, size_t len, bool mayThrow)
Definition: WaveTrack.cpp:2690
std::vector< const WaveClip * > WaveClipConstPointers
Definition: WaveClip.h:128
bool operator<(const Region &b) const
Definition: WaveTrack.h:66
void swap(Buffer &other)
Definition: WaveTrack.h:711
GrowableSampleBuffer mOverlapBuffer
Definition: WaveTrack.h:722
int GetWaveColorIndex() const
Definition: WaveTrack.h:165
Definition: WaveTrack.h:339
std::vector< Location > mDisplayLocationsCache
Definition: WaveTrack.h:636
Used to create a WaveTrack, or a LabelTrack.. Implementation of the functions of this class are dispe...
Definition: Track.h:694
virtual void WriteXML(XMLWriter &xmlFile) const =0
float mSpectrumMin
Definition: WaveTrack.h:630
Definition: WaveTrack.h:72
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:161
void SetDisplay(WaveTrackDisplay display)
Definition: WaveTrack.h:598
TrackPanelCellIterator::CellType & operator++(TrackPanelCellIterator::CellType &type)
Definition: TrackPanelCellIterator.h:64
int format
Definition: ExportPCM.cpp:56
Definition: EnvelopeHandle.h:27
Region()
Definition: WaveTrack.h:60
AllClipsIterator()
Definition: WaveTrack.h:397
This allows multiple clips to be a part of one WaveTrack.
Definition: WaveClip.h:177
virtual void SetPanFromChannelType()
Definition: Track.h:275
Structure to hold region of a wavetrack and a comparison function for sortability.
Definition: WaveTrack.h:58
virtual bool HandleXMLTag(const wxChar *tag, const wxChar **attrs)=0
Locker(const WaveTrack *pTrack)
Definition: WaveTrack.h:350
A Track that contains audio waveform data.
Definition: WaveTrack.h:76
WaveClipHolders & GetClips()
Definition: WaveTrack.h:386
double start
Definition: WaveTrack.h:63
Fundamental data object of Audacity, placed in the TrackPanel. Classes derived form it include the Wa...
Definition: Track.h:85
size_t mBufferSize
Definition: WaveTrack.h:720
std::vector< Pair > Stack
Definition: WaveTrack.h:452
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:69
wxCriticalSection mFlushCriticalSection
Definition: WaveTrack.h:648
void SetTrack(const WaveTrack *pTrack)
Definition: WaveTrack.cpp:2671
WaveTrackDisplay mDisplay
Definition: WaveTrack.h:633
std::weak_ptr< SampleHandle > mSampleHandle
Definition: WaveTrack.h:657
int min(int a, int b)
Definition: CompareAudioCommand.cpp:80
Definition: SampleHandle.h:26
Definition: SampleFormat.h:38
Definition: WaveTrack.h:564
int mRate
Definition: WaveTrack.h:618
void Free()
Definition: WaveTrack.h:708
Floats data
Definition: WaveTrack.h:703
An AudioTrack that can be played and stopped.
Definition: Track.h:357
float mGain
Definition: WaveTrack.h:619
std::weak_ptr< CutlineHandle > mCutlineHandle
Definition: WaveTrack.h:656
Definition: WaveTrack.h:702
Definition: WaveTrack.h:392
sampleFormat mFormat
Definition: WaveTrack.h:617
WaveClipHolders mClips
Definition: WaveTrack.h:615
WaveTrackDisplay
Definition: WaveTrack.h:552
Region(double start_, double end_)
Definition: WaveTrack.h:61
Definition: WaveTrack.h:669
bool Unlock() const
Definition: WaveTrack.cpp:1895
int GetLastScaleType() const
Definition: WaveTrack.h:591
bool Lock() const
Definition: WaveTrack.cpp:1878
virtual void InsertSilence(double WXUNUSED(t), double WXUNUSED(len))=0
Definition: WaveTrack.h:566
Interface to libsoxr.
Definition: Resample.h:30
double end
Definition: WaveTrack.h:63
const WaveTrack * mPTrack
Definition: WaveTrack.h:719
sampleFormat GetSampleFormat() const
Definition: WaveTrack.h:168
std::unique_ptr< const WaveTrack, WaveTrackLockDeleter > LockerBase
Definition: WaveTrack.h:344
float mPan
Definition: WaveTrack.h:620
virtual std::vector< UIHandlePtr > DetailedHitTest(const TrackPanelMouseState &, const AudacityProject *pProject, int currentTool, bool bMultiTool)=0
Definition: WaveTrack.h:559
void Free()
Definition: WaveTrack.cpp:2859
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:450
std::vector< WaveClip * > WaveClipPointers
Definition: WaveClip.h:127
virtual void HandleXMLEndTag(const wxChar *WXUNUSED(tag))
Definition: XMLTagHandler.h:86
Buffer()
Definition: WaveTrack.h:707
const WaveTrack * GetTrack() const
Definition: WaveTrack.h:689
const WaveClipConstHolders & GetClips() const
Definition: WaveTrack.h:387
Definition: SampleFormat.h:88
std::unique_ptr< Track > Holder
Definition: Track.h:245
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
WaveTrackCache(const WaveTrack *pTrack)
Definition: WaveTrack.h:679
WaveTrackDisplay GetDisplay() const
Definition: WaveTrack.h:597
WaveTrackLocation Location
Definition: WaveTrack.h:105
void push(WaveClipHolders &clips)
Definition: WaveTrack.h:440
virtual std::shared_ptr< TrackControls > GetControls()=0
std::vector< std::shared_ptr< const WaveClip > > WaveClipConstHolders
Definition: WaveClip.h:124
float mDisplayMax
Definition: WaveTrack.h:629
virtual bool GetErrorOpening()
Definition: Track.h:318
Definition: CutlineHandle.h:23
sampleCount end() const
Definition: WaveTrack.h:709
virtual Holder Duplicate() const =0
Definition: WaveTrack.h:572
double mLegacyProjectFileOffset
Definition: WaveTrack.h:650
int mWaveColorIndex
Definition: WaveTrack.h:621
Waveform settings, either for one track or as defaults.
Definition: WaveformSettings.h:16