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  sampleFormat GetSampleFormat() const { return mFormat; }
165  void ConvertToSampleFormat(sampleFormat format);
166 
167  const SpectrogramSettings &GetSpectrogramSettings() const;
168  SpectrogramSettings &GetSpectrogramSettings();
169  SpectrogramSettings &GetIndependentSpectrogramSettings();
170  void SetSpectrogramSettings(std::unique_ptr<SpectrogramSettings> &&pSettings);
171 
172  const WaveformSettings &GetWaveformSettings() const;
173  WaveformSettings &GetWaveformSettings();
174  WaveformSettings &GetIndependentWaveformSettings();
175  void SetWaveformSettings(std::unique_ptr<WaveformSettings> &&pSettings);
176 
177  //
178  // High-level editing
179  //
180 
181  Track::Holder Cut(double t0, double t1) override;
182 
183  // If forClipboard is true,
184  // and there is no clip at the end time of the selection, then the result
185  // will contain a "placeholder" clip whose only purpose is to make
186  // GetEndTime() correct. This clip is not re-copied when pasting.
187  Track::Holder Copy(double t0, double t1, bool forClipboard = true) const override;
188  Track::Holder CopyNonconst(double t0, double t1) /* not override */;
189 
190  void Clear(double t0, double t1) override;
191  void Paste(double t0, const Track *src) override;
192  void ClearAndPaste(double t0, double t1,
193  const Track *src,
194  bool preserve = true,
195  bool merge = true,
196  const TimeWarper *effectWarper = NULL) /* not override */;
197 
198  void Silence(double t0, double t1) override;
199  void InsertSilence(double t, double len) override;
200 
201  void SplitAt(double t) /* not override */;
202  void Split(double t0, double t1) /* not override */;
203  // Track::Holder CutAndAddCutLine(double t0, double t1) /* not override */;
204  void ClearAndAddCutLine(double t0, double t1) /* not override */;
205 
206  Track::Holder SplitCut(double t0, double t1) /* not override */;
207  void SplitDelete(double t0, double t1) /* not override */;
208  void Join(double t0, double t1) /* not override */;
209  void Disjoin(double t0, double t1) /* not override */;
210 
211  void Trim(double t0, double t1) /* not override */;
212 
213  void HandleClear(double t0, double t1, bool addCutLines, bool split);
214 
215  void SyncLockAdjust(double oldT1, double newT1) override;
216 
222  bool IsEmpty(double t0, double t1) const;
223 
231  void Append(samplePtr buffer, sampleFormat format,
232  size_t len, unsigned int stride=1,
233  XMLWriter* blockFileLog=NULL);
235  void Flush();
236 
237  void AppendAlias(const wxString &fName, sampleCount start,
238  size_t len, int channel,bool useOD);
239 
243  //vvv Why not use the ODTypeEnum typedef to enforce that for the parameter?
244  void AppendCoded(const wxString &fName, sampleCount start,
245  size_t len, int channel, int decodeType);
246 
248  unsigned int GetODFlags() const;
249 
251  void ClearWaveCaches();
252 
254  void AddInvalidRegion(sampleCount startSample, sampleCount endSample);
255 
266  bool Get(samplePtr buffer, sampleFormat format,
267  sampleCount start, size_t len,
268  fillFormat fill = fillZero, bool mayThrow = true) const;
269  void Set(samplePtr buffer, sampleFormat format,
270  sampleCount start, size_t len);
271 
272  // Fetch envelope values corresponding to uniformly separated sample times
273  // starting at the given time.
274  void GetEnvelopeValues(double *buffer, size_t bufferLen,
275  double t0) const;
276 
277  std::pair<float, float> GetMinMax(
278  double t0, double t1, bool mayThrow = true) const;
279  float GetRMS(double t0, double t1, bool mayThrow = true) const;
280 
281  //
282  // MM: We now have more than one sequence and envelope per track, so
283  // instead of GetSequence() and GetEnvelope() we have the following
284  // function which give the sequence and envelope which is under the
285  // given X coordinate of the mouse pointer.
286  //
287  WaveClip* GetClipAtX(int xcoord);
288  Sequence* GetSequenceAtX(int xcoord);
289  Envelope* GetEnvelopeAtX(int xcoord);
290 
291  WaveClip* GetClipAtSample(sampleCount sample);
292  WaveClip* GetClipAtTime(double time);
293 
294  //
295  // Getting information about the track's internal block sizes
296  // and alignment for efficiency
297  //
298 
299  // This returns a possibly large or negative value
300  sampleCount GetBlockStart(sampleCount t) const;
301 
302  // These return a nonnegative number of samples meant to size a memory buffer
303  size_t GetBestBlockSize(sampleCount t) const;
304  size_t GetMaxBlockSize() const;
305  size_t GetIdealBlockSize();
306 
307  //
308  // XMLTagHandler callback methods for loading and saving
309  //
310 
311  bool HandleXMLTag(const wxChar *tag, const wxChar **attrs) override;
312  void HandleXMLEndTag(const wxChar *tag) override;
313  XMLTagHandler *HandleXMLChild(const wxChar *tag) override;
314  void WriteXML(XMLWriter &xmlFile) const override;
315 
316  // Returns true if an error occurred while reading from XML
317  bool GetErrorOpening() override;
318 
319  //
320  // Lock and unlock the track: you must lock the track before
321  // doing a copy and paste between projects.
322  //
323 
324  bool Lock() const;
325  bool Unlock() const;
326 
328  inline void operator () (const WaveTrack *pTrack) { pTrack->Unlock(); }
329  };
330  using LockerBase = std::unique_ptr<
331  const WaveTrack, WaveTrackLockDeleter
332  >;
333 
334  // RAII object for locking.
335  struct Locker : private LockerBase
336  {
337  friend LockerBase;
338  Locker (const WaveTrack *pTrack)
339  : LockerBase{ pTrack }
340  { pTrack->Lock(); }
341  Locker(Locker &&that) : LockerBase{std::move(that)} {}
342  Locker &operator= (Locker &&that) {
343  (LockerBase&)(*this) = std::move(that);
344  return *this;
345  }
346  };
347 
348  bool CloseLock(); //similar to Lock but should be called when the project closes.
349  // not balanced by unlocking calls.
350 
364  sampleCount TimeToLongSamples(double t0) const;
370  double LongSamplesToTime(sampleCount pos) const;
371 
372  // Get access to the (visible) clips in the tracks, in unspecified order
373  // (not necessarioy sequenced in time).
374  WaveClipHolders &GetClips() { return mClips; }
376  { return reinterpret_cast< const WaveClipConstHolders& >( mClips ); }
377 
378  // Get access to all clips (in some unspecified sequence),
379  // including those hidden in cutlines.
381  : public std::iterator< std::forward_iterator_tag, WaveClip* >
382  {
383  public:
384  // Constructs an "end" iterator
386 
387  // Construct a "begin" iterator
388  explicit AllClipsIterator( WaveTrack &track )
389  {
390  push( track.mClips );
391  }
392 
394  {
395  if (mStack.empty())
396  return nullptr;
397  else
398  return mStack.back().first->get();
399  }
400 
402  {
403  // The unspecified sequence is a post-order, but there is no
404  // promise whether sister nodes are ordered in time.
405  if ( !mStack.empty() ) {
406  auto &pair = mStack.back();
407  if ( ++pair.first == pair.second ) {
408  mStack.pop_back();
409  }
410  else
411  push( (*pair.first)->GetCutLines() );
412  }
413 
414  return *this;
415  }
416 
417  // Define == well enough to serve for loop termination test
418  friend bool operator ==
419  (const AllClipsIterator &a, const AllClipsIterator &b)
420  { return a.mStack.empty() == b.mStack.empty(); }
421 
422  friend bool operator !=
423  (const AllClipsIterator &a, const AllClipsIterator &b)
424  { return !( a == b ); }
425 
426  private:
427 
428  void push( WaveClipHolders &clips )
429  {
430  auto pClips = &clips;
431  while (!pClips->empty()) {
432  auto first = pClips->begin();
433  mStack.push_back( Pair( first, pClips->end() ) );
434  pClips = &(*first)->GetCutLines();
435  }
436  }
437 
438  using Iterator = WaveClipHolders::iterator;
439  using Pair = std::pair< Iterator, Iterator >;
440  using Stack = std::vector< Pair >;
441 
443  };
444 
446  {
447  return { AllClipsIterator{ *this }, AllClipsIterator{ } };
448  }
449 
450  // Create NEW clip and add it to this track. Returns a pointer
451  // to the newly created clip.
452  WaveClip* CreateClip();
453 
459  WaveClip* NewestOrNewClip();
460 
466  WaveClip* RightmostOrNewClip();
467 
468  // Get the linear index of a given clip (-1 if the clip is not found)
469  int GetClipIndex(const WaveClip* clip) const;
470 
471  // Get the nth clip in this WaveTrack (will return NULL if not found).
472  // Use this only in special cases (like getting the linked clip), because
473  // it is much slower than GetClipIterator().
474  WaveClip *GetClipByIndex(int index);
475  const WaveClip* GetClipByIndex(int index) const;
476 
477  // Get number of clips in this WaveTrack
478  int GetNumClips() const;
479 
480  // Add all wave clips to the given array 'clips' and sort the array by
481  // clip start time. The array is emptied prior to adding the clips.
482  WaveClipPointers SortedClipArray();
483  WaveClipConstPointers SortedClipArray() const;
484 
485  // Before calling 'Offset' on a clip, use this function to see if the
486  // offsetting is allowed with respect to the other clips in this track.
487  // This function can optionally return the amount that is allowed for offsetting
488  // in this direction maximally.
489  bool CanOffsetClip(WaveClip* clip, double amount, double *allowedAmount=NULL);
490 
491  // Before moving a clip into a track (or inserting a clip), use this
492  // function to see if the times are valid (i.e. don't overlap with
493  // existing clips).
494  bool CanInsertClip(WaveClip* clip, double &slideBy, double &tolerance);
495 
496  // Remove the clip from the track and return a SMART pointer to it.
497  // You assume responsibility for its memory!
498  std::shared_ptr<WaveClip> RemoveAndReturnClip(WaveClip* clip);
499 
500  // Append a clip to the track
501  void AddClip(std::shared_ptr<WaveClip> &&clip); // Call using std::move
502 
503  // Merge two clips, that is append data from clip2 to clip1,
504  // then remove clip2 from track.
505  // clipidx1 and clipidx2 are indices into the clip list.
506  void MergeClips(int clipidx1, int clipidx2);
507 
508  // Cache special locations (e.g. cut lines) for later speedy access
509  void UpdateLocationsCache() const;
510 
511  // Get cached locations
512  const std::vector<Location> &GetCachedLocations() const { return mDisplayLocationsCache; }
513 
514  // Expand cut line (that is, re-insert audio, then DELETE audio saved in cut line)
515  void ExpandCutLine(double cutLinePosition, double* cutlineStart = NULL, double* cutlineEnd = NULL);
516 
517  // Remove cut line, without expanding the audio in it
518  bool RemoveCutLine(double cutLinePosition);
519 
520  // This track has been merged into a stereo track. Copy shared parameters
521  // from the NEW partner.
522  void Merge(const Track &orig) override;
523 
524  // Resample track (i.e. all clips in the track)
525  void Resample(int rate, ProgressDialog *progress = NULL);
526 
527  //
528  // AutoSave related
529  //
530  // Retrieve the unique autosave ID
531  int GetAutoSaveIdent();
532  // Set the unique autosave ID
533  void SetAutoSaveIdent(int id);
534 
535  //
536  // The following code will eventually become part of a GUIWaveTrack
537  // and will be taken out of the WaveTrack class:
538  //
539 
541 
542  // DO NOT REORDER OLD VALUES! Replace obsoletes with placeholders.
543 
544  Waveform = 0,
545  MinDisplay = Waveform,
546 
548 
550 
551  obsolete1, // was SpectrumLogDisplay
552  obsolete2, // was SpectralSelectionDisplay
553  obsolete3, // was SpectralSelectionLogDisplay
554  obsolete4, // was PitchDisplay
555 
556  // Add values here, and update MaxDisplay.
557 
558  MaxDisplay = Spectrum,
559 
560  NoDisplay, // Preview track has no display
561  };
562 
563  // Only two types of sample display for now, but
564  // others (eg sinc interpolation) may be added later.
566  LinarInterpolate = 0,
567  StemPlot
568  };
569 
570  // Read appropriate value from preferences
571  static WaveTrackDisplay FindDefaultViewMode();
572 
573  // Handle remapping of enum values from 2.1.0 and earlier
574  static WaveTrackDisplay ConvertLegacyDisplayValue(int oldValue);
575 
576  // Handle restriction of range of values of the enum from future versions
577  static WaveTrackDisplay ValidateWaveTrackDisplay(WaveTrackDisplay display);
578 
579  int GetLastScaleType() const { return mLastScaleType; }
580  void SetLastScaleType() const;
581 
582  int GetLastdBRange() const { return mLastdBRange; }
583  void SetLastdBRange() const;
584 
585  WaveTrackDisplay GetDisplay() const { return mDisplay; }
586  void SetDisplay(WaveTrackDisplay display) { mDisplay = display; }
587 
588  void GetDisplayBounds(float *min, float *max) const;
589  void SetDisplayBounds(float min, float max) const;
590  void GetSpectrumBounds(float *min, float *max) const;
591  void SetSpectrumBounds(float min, float max) const;
592 
593  // For display purposes, calculate the y coordinate where the midline of
594  // the wave should be drawn, if display minimum and maximum map to the
595  // bottom and top. Maybe that is out of bounds.
596  int ZeroLevelYCoordinate(wxRect rect) const;
597 
598  protected:
599  //
600  // Protected variables
601  //
602 
604 
605  sampleFormat mFormat;
606  int mRate;
607  float mGain;
608  float mPan;
609 
610 
611  //
612  // Data that should be part of GUIWaveTrack
613  // and will be taken out of the WaveTrack class:
614  //
615  mutable float mDisplayMin;
616  mutable float mDisplayMax;
617  mutable float mSpectrumMin;
618  mutable float mSpectrumMax;
619 
621  mutable int mLastScaleType; // last scale type choice
622  mutable int mLastdBRange;
623  mutable std::vector <Location> mDisplayLocationsCache;
624 
625  //
626  // Protected methods
627  //
628 
629  private:
630 
631  //
632  // Private variables
633  //
634 
635  wxCriticalSection mFlushCriticalSection;
636  wxCriticalSection mAppendCriticalSection;
639 
640  std::unique_ptr<SpectrogramSettings> mpSpectrumSettings;
641  std::unique_ptr<WaveformSettings> mpWaveformSettings;
642 
643  std::weak_ptr<CutlineHandle> mCutlineHandle;
644  std::weak_ptr<SampleHandle> mSampleHandle;
645  std::weak_ptr<EnvelopeHandle> mEnvelopeHandle;
646 
647 protected:
648  std::shared_ptr<TrackControls> GetControls() override;
649  std::shared_ptr<TrackVRulerControls> GetVRulerControls() override;
650 };
651 
652 // This is meant to be a short-lived object, during whose lifetime,
653 // the contents of the WaveTrack are known not to change. It can replace
654 // repeated calls to WaveTrack::Get() (each of which opens and closes at least
655 // one block file).
657 public:
659  : mPTrack(0)
660  , mBufferSize(0)
661  , mOverlapBuffer()
662  , mNValidBuffers(0)
663  {
664  }
665 
666  explicit WaveTrackCache(const WaveTrack *pTrack)
667  : mPTrack(0)
668  , mBufferSize(0)
669  , mOverlapBuffer()
670  , mNValidBuffers(0)
671  {
672  SetTrack(pTrack);
673  }
674  ~WaveTrackCache();
675 
676  const WaveTrack *GetTrack() const { return mPTrack; }
677  void SetTrack(const WaveTrack *pTrack);
678 
679  // Uses fillZero always
680  // Returns null on failure
681  // Returned pointer may be invalidated if Get is called again
682  // Do not DELETE[] the pointer
683  constSamplePtr Get(
684  sampleFormat format, sampleCount start, size_t len, bool mayThrow);
685 
686 private:
687  void Free();
688 
689  struct Buffer {
691  sampleCount start;
692  sampleCount len;
693 
694  Buffer() : start(0), len(0) {}
695  void Free() { data.reset(); start = 0; len = 0; }
696  sampleCount end() const { return start + len; }
697 
698  void swap ( Buffer &other )
699  {
700  data .swap ( other.data );
701  std::swap( start, other.start );
702  std::swap( len, other.len );
703  }
704  };
705 
707  size_t mBufferSize;
711 };
712 
713 #endif // __AUDACITY_WAVETRACK__
int GetKind() const override
Definition: WaveTrack.h:137
const std::vector< Location > & GetCachedLocations() const
Definition: WaveTrack.h:512
virtual void Paste(double WXUNUSED(t), const Track *WXUNUSED(src))=0
SampleDisplay
Definition: WaveTrack.h:565
Definition: Track.h:227
virtual void SetPan(float)
Definition: Track.h:273
std::unique_ptr< SpectrogramSettings > mpSpectrumSettings
Definition: WaveTrack.h:640
wxCriticalSection mAppendCriticalSection
Definition: WaveTrack.h:636
friend LockerBase
Definition: WaveTrack.h:337
void Merge(const Track &init) override
Definition: Track.cpp:344
virtual Holder Copy(double WXUNUSED(t0), double WXUNUSED(t1), bool forClipboard=true) const =0
int mAutoSaveIdent
Definition: WaveTrack.h:638
~WaveTrackCache()
Definition: WaveTrack.cpp:2645
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:622
Definition: WaveTrack.h:549
Definition: WaveTrack.h:335
fillFormat
Definition: SampleFormat.h:37
virtual std::shared_ptr< TrackVRulerControls > GetVRulerControls()=0
float mDisplayMin
Definition: WaveTrack.h:615
void Init(const PlayableTrack &init)
Definition: Track.cpp:337
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:442
Buffer mBuffers[2]
Definition: WaveTrack.h:708
virtual XMLTagHandler * HandleXMLChild(const wxChar *tag)=0
virtual double GetEndTime() const =0
std::weak_ptr< EnvelopeHandle > mEnvelopeHandle
Definition: WaveTrack.h:645
sampleCount start
Definition: WaveTrack.h:691
std::pair< Iterator, Iterator > Pair
Definition: WaveTrack.h:439
float mSpectrumMax
Definition: WaveTrack.h:618
Vector operator*(const Vector &left, const Vector &right)
Definition: Matrix.cpp:153
AllClipsIterator(WaveTrack &track)
Definition: WaveTrack.h:388
sampleCount len
Definition: WaveTrack.h:692
int mLastScaleType
Definition: WaveTrack.h:621
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:641
virtual Holder Cut(double WXUNUSED(t0), double WXUNUSED(t1))=0
int mNValidBuffers
Definition: WaveTrack.h:710
IteratorRange< AllClipsIterator > GetAllClips()
Definition: WaveTrack.h:445
Definition: MemoryX.h:853
Definition: WaveTrack.h:551
virtual int GetMinimizedHeight() const
Definition: Track.cpp:133
std::vector< WaveClipHolder > WaveClipHolders
Definition: WaveClip.h:123
int GetLastdBRange() const
Definition: WaveTrack.h:582
Definition: WaveTrack.h:553
WaveTrackCache()
Definition: WaveTrack.h:658
Locker(Locker &&that)
Definition: WaveTrack.h:341
virtual double GetStartTime() const =0
Definition: TrackPanelMouseEvent.h:23
constSamplePtr Get(sampleFormat format, sampleCount start, size_t len, bool mayThrow)
Definition: WaveTrack.cpp:2668
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:698
GrowableSampleBuffer mOverlapBuffer
Definition: WaveTrack.h:709
Definition: WaveTrack.h:327
std::vector< Location > mDisplayLocationsCache
Definition: WaveTrack.h:623
Used to create a WaveTrack, or a LabelTrack.. Implementation of the functions of this class are dispe...
Definition: Track.h:676
virtual void WriteXML(XMLWriter &xmlFile) const =0
float mSpectrumMin
Definition: WaveTrack.h:617
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:586
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:385
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:338
A Track that contains audio waveform data.
Definition: WaveTrack.h:76
WaveClipHolders & GetClips()
Definition: WaveTrack.h:374
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:707
std::vector< Pair > Stack
Definition: WaveTrack.h:440
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:635
void SetTrack(const WaveTrack *pTrack)
Definition: WaveTrack.cpp:2649
WaveTrackDisplay mDisplay
Definition: WaveTrack.h:620
std::weak_ptr< SampleHandle > mSampleHandle
Definition: WaveTrack.h:644
int min(int a, int b)
Definition: CompareAudioCommand.cpp:80
Definition: SampleHandle.h:26
Definition: SampleFormat.h:38
Definition: WaveTrack.h:552
int mRate
Definition: WaveTrack.h:606
void Free()
Definition: WaveTrack.h:695
Floats data
Definition: WaveTrack.h:690
Definition: Track.h:351
float mGain
Definition: WaveTrack.h:607
std::weak_ptr< CutlineHandle > mCutlineHandle
Definition: WaveTrack.h:643
Definition: WaveTrack.h:689
Definition: WaveTrack.h:380
sampleFormat mFormat
Definition: WaveTrack.h:605
WaveClipHolders mClips
Definition: WaveTrack.h:603
WaveTrackDisplay
Definition: WaveTrack.h:540
Region(double start_, double end_)
Definition: WaveTrack.h:61
Definition: WaveTrack.h:656
bool Unlock() const
Definition: WaveTrack.cpp:1872
int GetLastScaleType() const
Definition: WaveTrack.h:579
bool Lock() const
Definition: WaveTrack.cpp:1855
virtual void InsertSilence(double WXUNUSED(t), double WXUNUSED(len))=0
Definition: WaveTrack.h:554
Interface to libsoxr.
Definition: Resample.h:30
double end
Definition: WaveTrack.h:63
const WaveTrack * mPTrack
Definition: WaveTrack.h:706
sampleFormat GetSampleFormat() const
Definition: WaveTrack.h:164
std::unique_ptr< const WaveTrack, WaveTrackLockDeleter > LockerBase
Definition: WaveTrack.h:332
float mPan
Definition: WaveTrack.h:608
virtual std::vector< UIHandlePtr > DetailedHitTest(const TrackPanelMouseState &, const AudacityProject *pProject, int currentTool, bool bMultiTool)=0
Definition: WaveTrack.h:547
void Free()
Definition: WaveTrack.cpp:2836
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:438
std::vector< WaveClip * > WaveClipPointers
Definition: WaveClip.h:127
virtual void HandleXMLEndTag(const wxChar *WXUNUSED(tag))
Definition: XMLTagHandler.h:86
Buffer()
Definition: WaveTrack.h:694
const WaveTrack * GetTrack() const
Definition: WaveTrack.h:676
const WaveClipConstHolders & GetClips() const
Definition: WaveTrack.h:375
Definition: SampleFormat.h:88
std::unique_ptr< Track > Holder
Definition: Track.h:245
virtual void SyncLockAdjust(double oldT1, double newT1)
Definition: Track.cpp:314
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:666
WaveTrackDisplay GetDisplay() const
Definition: WaveTrack.h:585
WaveTrackLocation Location
Definition: WaveTrack.h:105
void push(WaveClipHolders &clips)
Definition: WaveTrack.h:428
virtual std::shared_ptr< TrackControls > GetControls()=0
std::vector< std::shared_ptr< const WaveClip > > WaveClipConstHolders
Definition: WaveClip.h:124
float mDisplayMax
Definition: WaveTrack.h:616
virtual bool GetErrorOpening()
Definition: Track.h:312
Definition: CutlineHandle.h:23
sampleCount end() const
Definition: WaveTrack.h:696
virtual Holder Duplicate() const =0
Definition: WaveTrack.h:560
double mLegacyProjectFileOffset
Definition: WaveTrack.h:637
Waveform settings, either for one track or as defaults.
Definition: WaveformSettings.h:16