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