Audacity  3.0.3
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 "SampleCount.h"
16 
17 #include <vector>
18 #include <functional>
19 #include <wx/longlong.h>
20 
21 #include "WaveTrackLocation.h"
22 
23 class ProgressDialog;
24 
25 class SampleBlockFactory;
26 using SampleBlockFactoryPtr = std::shared_ptr<SampleBlockFactory>;
27 
29 class WaveformSettings;
30 class TimeWarper;
31 
32 class Sequence;
33 class WaveClip;
34 
35 // Array of pointers that assume ownership
36 using WaveClipHolder = std::shared_ptr< WaveClip >;
37 using WaveClipHolders = std::vector < WaveClipHolder >;
38 using WaveClipConstHolders = std::vector < std::shared_ptr< const WaveClip > >;
39 
40 // Temporary arrays of mere pointers
41 using WaveClipPointers = std::vector < WaveClip* >;
42 using WaveClipConstPointers = std::vector < const WaveClip* >;
43 
44 //
45 // Tolerance for merging wave tracks (in seconds)
46 //
47 #define WAVETRACK_MERGE_POINT_TOLERANCE 0.01
48 
51 struct Region
52 {
53  Region() : start(0), end(0) {}
54  Region(double start_, double end_) : start(start_), end(end_) {}
55 
56  double start, end;
57 
58  //used for sorting
59  bool operator < (const Region &b) const
60  {
61  return this->start < b.start;
62  }
63 };
64 
65 using Regions = std::vector < Region >;
66 
67 class Envelope;
68 
69 class AUDACITY_DLL_API WaveTrack final : public PlayableTrack {
70 public:
71 
72  //
73  // Constructor / Destructor / Duplicator
74  //
75 
76  WaveTrack(
77  const SampleBlockFactoryPtr &pFactory, sampleFormat format, double rate);
78  WaveTrack(const WaveTrack &orig);
79 
80  // overwrite data excluding the sample sequence but including display
81  // settings
82  void Reinit(const WaveTrack &orig);
83 
84 private:
85  void Init(const WaveTrack &orig);
86 
87  Track::Holder Clone() const override;
88 
89  friend class WaveTrackFactory;
90 
91  wxString MakeClipCopyName(const wxString& originalName) const;
92  wxString MakeNewClipName() const;
93  public:
94 
96  using Holder = std::shared_ptr<WaveTrack>;
97 
98  virtual ~WaveTrack();
99 
100  double GetOffset() const override;
101  void SetOffset(double o) override;
102  virtual ChannelType GetChannelIgnoringPan() const;
103  ChannelType GetChannel() const override;
104  virtual void SetPanFromChannelType() override;
105 
106  bool LinkConsistencyCheck() override;
107 
112  double GetStartTime() const override;
113 
119  double GetEndTime() const override;
120 
121  //
122  // Identifying the type of track
123  //
124 
125  //
126  // WaveTrack parameters
127  //
128 
129  double GetRate() const;
130  void SetRate(double newRate);
131 
132  // Multiplicative factor. Only converted to dB for display.
133  float GetGain() const;
134  void SetGain(float newGain);
135 
136  // -1.0 (left) -> 1.0 (right)
137  float GetPan() const;
138  void SetPan(float newPan) override;
139 
140  // Takes gain and pan into account
141  float GetChannelGain(int channel) const;
142 
143  // Old gain is used in playback in linearly interpolating
144  // the gain.
145  float GetOldChannelGain(int channel) const;
146  void SetOldChannelGain(int channel, float gain);
147 
148  int GetWaveColorIndex() const { return mWaveColorIndex; };
149  void SetWaveColorIndex(int colorIndex);
150 
151  sampleCount GetNumSamples() const;
152 
153  sampleFormat GetSampleFormat() const { return mFormat; }
154  void ConvertToSampleFormat(sampleFormat format,
155  const std::function<void(size_t)> & progressReport = {});
156 
157  const SpectrogramSettings &GetSpectrogramSettings() const;
158  SpectrogramSettings &GetSpectrogramSettings();
159  SpectrogramSettings &GetIndependentSpectrogramSettings();
160  void SetSpectrogramSettings(std::unique_ptr<SpectrogramSettings> &&pSettings);
161 
162  const WaveformSettings &GetWaveformSettings() const;
163  WaveformSettings &GetWaveformSettings();
164  void SetWaveformSettings(std::unique_ptr<WaveformSettings> &&pSettings);
165  void UseSpectralPrefs( bool bUse=true );
166  //
167  // High-level editing
168  //
169 
170  Track::Holder Cut(double t0, double t1) override;
171 
172  // Make another track copying format, rate, color, etc. but containing no
173  // clips
174  // It is important to pass the correct factory (that for the project
175  // which will own the copy) in the unusual case that a track is copied from
176  // another project or the clipboard. For copies within one project, the
177  // default will do.
178  Holder EmptyCopy(const SampleBlockFactoryPtr &pFactory = {} ) const;
179 
180  // If forClipboard is true,
181  // and there is no clip at the end time of the selection, then the result
182  // will contain a "placeholder" clip whose only purpose is to make
183  // GetEndTime() correct. This clip is not re-copied when pasting.
184  Track::Holder Copy(double t0, double t1, bool forClipboard = true) const override;
185  Track::Holder CopyNonconst(double t0, double t1) /* not override */;
186 
187  void Clear(double t0, double t1) override;
188  void Paste(double t0, const Track *src) override;
189  // May assume precondition: t0 <= t1
190  void ClearAndPaste(double t0, double t1,
191  const Track *src,
192  bool preserve = true,
193  bool merge = true,
194  const TimeWarper *effectWarper = NULL) /* not override */;
195 
196  void Silence(double t0, double t1) override;
197  void InsertSilence(double t, double len) override;
198 
199  void SplitAt(double t) /* not override */;
200  void Split(double t0, double t1) /* not override */;
201  // Track::Holder CutAndAddCutLine(double t0, double t1) /* not override */;
202  // May assume precondition: t0 <= t1
203  void ClearAndAddCutLine(double t0, double t1) /* not override */;
204 
205  Track::Holder SplitCut(double t0, double t1) /* not override */;
206  // May assume precondition: t0 <= t1
207  void SplitDelete(double t0, double t1) /* not override */;
208  void Join(double t0, double t1) /* not override */;
209  // May assume precondition: t0 <= t1
210  void Disjoin(double t0, double t1) /* not override */;
211 
212  // May assume precondition: t0 <= t1
213  void Trim(double t0, double t1) /* not override */;
214 
215  // May assume precondition: t0 <= t1
216  void HandleClear(double t0, double t1, bool addCutLines, bool split);
217 
218  void SyncLockAdjust(double oldT1, double newT1) override;
219 
225  bool IsEmpty(double t0, double t1) const;
226 
237  size_t len, unsigned int stride=1);
239  void Flush();
240 
242  void ClearWaveCaches();
243 
254 
256 
265  bool GetFloats(float *buffer, sampleCount start, size_t len,
266  fillFormat fill = fillZero, bool mayThrow = true,
267  sampleCount * pNumWithinClips = nullptr) const
268  {
270  return Get(reinterpret_cast<samplePtr>(buffer),
271  floatSample, start, len, fill, mayThrow, pNumWithinClips);
272  }
273 
275 
279  bool Get(samplePtr buffer, sampleFormat format,
280  sampleCount start, size_t len,
281  fillFormat fill = fillZero,
282  bool mayThrow = true,
283  // Report how many samples were copied from within clips, rather than
284  // filled according to fillFormat; but these were not necessarily one
285  // contiguous range.
286  sampleCount * pNumWithinClips = nullptr) const;
287 
288  void Set(constSamplePtr buffer, sampleFormat format,
289  sampleCount start, size_t len);
290 
291  // Fetch envelope values corresponding to uniformly separated sample times
292  // starting at the given time.
293  void GetEnvelopeValues(double *buffer, size_t bufferLen,
294  double t0) const;
295 
296  // May assume precondition: t0 <= t1
297  std::pair<float, float> GetMinMax(
298  double t0, double t1, bool mayThrow = true) const;
299  // May assume precondition: t0 <= t1
300  float GetRMS(double t0, double t1, bool mayThrow = true) const;
301 
302  //
303  // MM: We now have more than one sequence and envelope per track, so
304  // instead of GetSequence() and GetEnvelope() we have the following
305  // function which give the sequence and envelope which contains the given
306  // time.
307  //
308  Sequence* GetSequenceAtTime(double time);
309  Envelope* GetEnvelopeAtTime(double time);
310 
311  WaveClip* GetClipAtSample(sampleCount sample);
312  WaveClip* GetClipAtTime(double time);
313 
314  //
315  // Getting information about the track's internal block sizes
316  // and alignment for efficiency
317  //
318 
319  // This returns a possibly large or negative value
320  sampleCount GetBlockStart(sampleCount t) const;
321 
322  // These return a nonnegative number of samples meant to size a memory buffer
323  size_t GetBestBlockSize(sampleCount t) const;
324  size_t GetMaxBlockSize() const;
325  size_t GetIdealBlockSize();
326 
327  //
328  // XMLTagHandler callback methods for loading and saving
329  //
330 
331  bool HandleXMLTag(const wxChar *tag, const wxChar **attrs) override;
332  void HandleXMLEndTag(const wxChar *tag) override;
333  XMLTagHandler *HandleXMLChild(const wxChar *tag) override;
334  void WriteXML(XMLWriter &xmlFile) const override;
335 
336  // Returns true if an error occurred while reading from XML
337  bool GetErrorOpening() override;
338 
339  //
340  // Lock and unlock the track: you must lock the track before
341  // doing a copy and paste between projects.
342  //
343 
344  bool CloseLock(); //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 necessarily sequenced in time).
370  WaveClipHolders &GetClips() { return mClips; }
372  { return reinterpret_cast< const WaveClipConstHolders& >( mClips ); }
373 
374  // Get mutative access to all clips (in some unspecified sequence),
375  // including those hidden in cutlines.
377  : public ValueIterator< 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 
397  AllClipsIterator &operator ++ ();
398 
399  // Define == well enough to serve for loop termination test
400  friend bool operator == (
401  const AllClipsIterator &a, const AllClipsIterator &b)
402  { return a.mStack.empty() == b.mStack.empty(); }
403 
404  friend bool operator != (
405  const AllClipsIterator &a, const AllClipsIterator &b)
406  { return !( a == b ); }
407 
408  private:
409 
410  void push( WaveClipHolders &clips );
411 
412  using Iterator = WaveClipHolders::iterator;
413  using Pair = std::pair< Iterator, Iterator >;
414  using Stack = std::vector< Pair >;
415 
417  };
418 
419  // Get const access to all clips (in some unspecified sequence),
420  // including those hidden in cutlines.
422  : public ValueIterator< const WaveClip * >
423  {
424  public:
425  // Constructs an "end" iterator
427 
428  // Construct a "begin" iterator
429  explicit AllClipsConstIterator( const WaveTrack &track )
430  : mIter{ const_cast< WaveTrack& >( track ) }
431  {}
432 
433  const WaveClip *operator * () const
434  { return *mIter; }
435 
436  AllClipsConstIterator &operator ++ ()
437  { ++mIter; return *this; }
438 
439  // Define == well enough to serve for loop termination test
440  friend bool operator == (
441  const AllClipsConstIterator &a, const AllClipsConstIterator &b)
442  { return a.mIter == b.mIter; }
443 
444  friend bool operator != (
445  const AllClipsConstIterator &a, const AllClipsConstIterator &b)
446  { return !( a == b ); }
447 
448  private:
450  };
451 
453  {
454  return { AllClipsIterator{ *this }, AllClipsIterator{ } };
455  }
456 
458  {
459  return { AllClipsConstIterator{ *this }, AllClipsConstIterator{ } };
460  }
461 
462  // Create NEW clip and add it to this track. Returns a pointer
463  // to the newly created clip. Optionally initial offset and
464  // clip name may be provided
465  WaveClip* CreateClip(double offset = .0, const wxString& name = wxEmptyString);
466 
472  WaveClip* NewestOrNewClip();
473 
479  WaveClip* RightmostOrNewClip();
480 
481  // Get the linear index of a given clip (-1 if the clip is not found)
482  int GetClipIndex(const WaveClip* clip) const;
483 
484  // Get the nth clip in this WaveTrack (will return NULL if not found).
485  // Use this only in special cases (like getting the linked clip), because
486  // it is much slower than GetClipIterator().
487  WaveClip *GetClipByIndex(int index);
488  const WaveClip* GetClipByIndex(int index) const;
489 
490  // Get number of clips in this WaveTrack
491  int GetNumClips() const;
492 
493  // Add all wave clips to the given array 'clips' and sort the array by
494  // clip start time. The array is emptied prior to adding the clips.
495  WaveClipPointers SortedClipArray();
496  WaveClipConstPointers SortedClipArray() const;
497 
499 
502  bool CanOffsetClips(
503  const std::vector<WaveClip*> &clips,
504  double amount,
505  double *allowedAmount = nullptr
507  );
508 
509  // Before moving a clip into a track (or inserting a clip), use this
510  // function to see if the times are valid (i.e. don't overlap with
511  // existing clips).
512  bool CanInsertClip(WaveClip* clip, double &slideBy, double &tolerance) const;
513 
514  // Remove the clip from the track and return a SMART pointer to it.
515  // You assume responsibility for its memory!
516  std::shared_ptr<WaveClip> RemoveAndReturnClip(WaveClip* clip);
517 
519  bool AddClip(const std::shared_ptr<WaveClip> &clip);
520 
521  // Merge two clips, that is append data from clip2 to clip1,
522  // then remove clip2 from track.
523  // clipidx1 and clipidx2 are indices into the clip list.
524  void MergeClips(int clipidx1, int clipidx2);
525 
526  // Cache special locations (e.g. cut lines) for later speedy access
527  void UpdateLocationsCache() const;
528 
529  // Get cached locations
530  const std::vector<Location> &GetCachedLocations() const { return mDisplayLocationsCache; }
531 
532  // Expand cut line (that is, re-insert audio, then DELETE audio saved in cut line)
533  void ExpandCutLine(double cutLinePosition, double* cutlineStart = NULL, double* cutlineEnd = NULL);
534 
535  // Remove cut line, without expanding the audio in it
536  bool RemoveCutLine(double cutLinePosition);
537 
538  // This track has been merged into a stereo track. Copy shared parameters
539  // from the NEW partner.
540  void Merge(const Track &orig) override;
541 
542  // Resample track (i.e. all clips in the track)
543  void Resample(int rate, ProgressDialog *progress = NULL);
544 
545  int GetLastScaleType() const { return mLastScaleType; }
546  void SetLastScaleType() const;
547 
548  int GetLastdBRange() const { return mLastdBRange; }
549  void SetLastdBRange() const;
550 
551  void GetDisplayBounds(float *min, float *max) const;
552  void SetDisplayBounds(float min, float max) const;
553  void GetSpectrumBounds(float *min, float *max) const;
554  void SetSpectrumBounds(float min, float max) const;
555 
556  // For display purposes, calculate the y coordinate where the midline of
557  // the wave should be drawn, if display minimum and maximum map to the
558  // bottom and top. Maybe that is out of bounds.
559  int ZeroLevelYCoordinate(wxRect rect) const;
560 
561  class IntervalData final : public Track::IntervalData {
562  public:
563  explicit IntervalData( const std::shared_ptr<WaveClip> &pClip )
564  : pClip{ pClip }
565  {}
566  std::shared_ptr<const WaveClip> GetClip() const { return pClip; }
567  std::shared_ptr<WaveClip> &GetClip() { return pClip; }
568  private:
569  std::shared_ptr<WaveClip> pClip;
570  };
571 
572  Track::Holder PasteInto( AudacityProject & ) const override;
573 
574  ConstIntervals GetIntervals() const override;
575  Intervals GetIntervals() override;
576 
578  const WaveClip* FindClipByName(const wxString& name) const;
579 
580  protected:
581  //
582  // Protected variables
583  //
584 
586 
588  int mRate;
589  float mGain;
590  float mPan;
592  float mOldGain[2];
593 
594 
595  //
596  // Data that should be part of GUIWaveTrack
597  // and will be taken out of the WaveTrack class:
598  //
599  mutable float mDisplayMin;
600  mutable float mDisplayMax;
601  mutable float mSpectrumMin;
602  mutable float mSpectrumMax;
603 
604  mutable int mLastScaleType; // last scale type choice
605  mutable int mLastdBRange;
606  mutable std::vector <Location> mDisplayLocationsCache;
607 
608  //
609  // Protected methods
610  //
611 
612 private:
613 
614  TrackKind GetKind() const override { return TrackKind::Wave; }
615 
616  //
617  // Private variables
618  //
619 
621 
622  wxCriticalSection mFlushCriticalSection;
623  wxCriticalSection mAppendCriticalSection;
625 
626  std::unique_ptr<SpectrogramSettings> mpSpectrumSettings;
627  std::unique_ptr<WaveformSettings> mpWaveformSettings;
628 };
629 
631 
633 class AUDACITY_DLL_API WaveTrackCache {
634 public:
636  : mBufferSize(0)
637  , mOverlapBuffer()
638  , mNValidBuffers(0)
639  {
640  }
641 
642  explicit WaveTrackCache(const std::shared_ptr<const WaveTrack> &pTrack)
643  : mBufferSize(0)
644  , mOverlapBuffer()
645  , mNValidBuffers(0)
646  {
647  SetTrack(pTrack);
648  }
649  ~WaveTrackCache();
650 
651  const std::shared_ptr<const WaveTrack>& GetTrack() const { return mPTrack; }
652  void SetTrack(const std::shared_ptr<const WaveTrack> &pTrack);
653 
655 
658  const float *GetFloats(sampleCount start, size_t len, bool mayThrow);
659 
660 private:
661  void Free();
662 
663  struct Buffer {
667 
668  Buffer() : start(0), len(0) {}
669  void Free() { data.reset(); start = 0; len = 0; }
670  sampleCount end() const { return start + len; }
671 
672  void swap ( Buffer &other )
673  {
674  data .swap ( other.data );
675  std::swap( start, other.start );
676  std::swap( len, other.len );
677  }
678  };
679 
680  std::shared_ptr<const WaveTrack> mPTrack;
681  size_t mBufferSize;
682  Buffer mBuffers[2];
685 };
686 
687 #include <unordered_set>
688 class SampleBlock;
689 using SampleBlockID = long long;
690 using SampleBlockIDSet = std::unordered_set<SampleBlockID>;
691 class TrackList;
692 using BlockVisitor = std::function< void(SampleBlock&) >;
693 using BlockInspector = std::function< void(const SampleBlock&) >;
694 
695 // Function to visit all sample blocks from a list of tracks.
696 // If a set is supplied, then only visit once each unique block ID not already
697 // in that set, and accumulate those into the set as a side-effect.
698 // The visitor function may be null.
699 void VisitBlocks(TrackList &tracks, BlockVisitor visitor,
700  SampleBlockIDSet *pIDs = nullptr);
701 
702 // Non-mutating version of the above
703 void InspectBlocks(const TrackList &tracks, BlockInspector inspector,
704  SampleBlockIDSet *pIDs = nullptr);
705 
706 class ProjectRate;
707 
708 class AUDACITY_DLL_API WaveTrackFactory final
709  : public ClientData::Base
710 {
711  public:
712  static WaveTrackFactory &Get( AudacityProject &project );
713  static const WaveTrackFactory &Get( const AudacityProject &project );
714  static WaveTrackFactory &Reset( AudacityProject &project );
715  static void Destroy( AudacityProject &project );
716 
718  const SampleBlockFactoryPtr &pFactory)
719  : mRate{ rate }
720  , mpFactory(pFactory)
721  {
722  }
723  WaveTrackFactory( const WaveTrackFactory & ) PROHIBITED;
725 
727  { return mpFactory; }
728 
729  private:
732  public:
733  std::shared_ptr<WaveTrack> DuplicateWaveTrack(const WaveTrack &orig);
734  std::shared_ptr<WaveTrack> NewWaveTrack(
736  double rate = 0);
737 };
738 
739 #endif // __AUDACITY_WAVETRACK__
WaveTrackCache
A short-lived object, during whose lifetime, the contents of the WaveTrack are assumed not to change.
Definition: WaveTrack.h:633
XMLWriter
Base class for XMLFileWriter and XMLStringWriter that provides the general functionality for creating...
Definition: XMLWriter.h:23
WaveClipConstPointers
std::vector< const WaveClip * > WaveClipConstPointers
Definition: WaveTrack.h:42
WaveTrack::AllClipsIterator::AllClipsIterator
AllClipsIterator(WaveTrack &track)
Definition: WaveTrack.h:384
WaveTrack::IntervalData::IntervalData
IntervalData(const std::shared_ptr< WaveClip > &pClip)
Definition: WaveTrack.h:563
SpectrogramSettings
Spectrogram settings, either for one track or as defaults.
Definition: SpectrogramSettings.h:27
WaveTrack
A Track that contains audio waveform data.
Definition: WaveTrack.h:69
VisitBlocks
void VisitBlocks(TrackList &tracks, BlockVisitor visitor, SampleBlockIDSet *pIDs=nullptr)
Definition: WaveTrack.cpp:2861
TimeWarper
Transforms one point in time to another point. For example, a time stretching effect might use one to...
Definition: TimeWarper.h:62
WaveTrack::AllClipsConstIterator::AllClipsConstIterator
AllClipsConstIterator()
Definition: WaveTrack.h:426
SampleBlockIDSet
std::unordered_set< SampleBlockID > SampleBlockIDSet
Definition: WaveTrack.h:690
operator*
Vector operator*(const Vector &left, const Vector &right)
Definition: Matrix.cpp:153
WaveTrackCache::Buffer::swap
void swap(Buffer &other)
Definition: WaveTrack.h:672
WaveTrack::AllClipsIterator::Pair
std::pair< Iterator, Iterator > Pair
Definition: WaveTrack.h:413
WaveTrackCache::mNValidBuffers
int mNValidBuffers
Definition: WaveTrack.h:684
WaveTrack::GetAllClips
IteratorRange< AllClipsIterator > GetAllClips()
Definition: WaveTrack.h:452
WaveTrack::AllClipsConstIterator::mIter
AllClipsIterator mIter
Definition: WaveTrack.h:449
Track::GetEndTime
virtual double GetEndTime() const =0
WaveTrack::mWaveColorIndex
int mWaveColorIndex
Definition: WaveTrack.h:591
Track::ConstIntervals
std::vector< ConstInterval > ConstIntervals
Definition: Track.h:331
WaveTrackFactory::mRate
const ProjectRate & mRate
Definition: WaveTrack.h:730
ClientData::Site::Get
Subclass & Get(const RegisteredFactory &key)
Get reference to an attachment, creating on demand if not present, down-cast it to Subclass.
Definition: ClientData.h:309
WaveTrackLocation.h
fillFormat
fillFormat
Definition: SampleFormat.h:53
WaveTrack::mLastdBRange
int mLastdBRange
Definition: WaveTrack.h:605
Track::GetIntervals
virtual ConstIntervals GetIntervals() const
Report times on the track where important intervals begin and end, for UI to snap to.
Definition: Track.cpp:1244
PlayableTrack::Merge
void Merge(const Track &init) override
Definition: Track.cpp:318
operator!=
bool operator!=(const Tags &lhs, const Tags &rhs)
Definition: Tags.h:140
TrackList
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition: Track.h:1280
Envelope
Piecewise linear or piecewise exponential function from double to double.
Definition: Envelope.h:71
TrackIntervalData
Optional extra information about an interval, appropriate to a subtype of Track.
Definition: Track.h:186
WaveTrack::mpSpectrumSettings
std::unique_ptr< SpectrogramSettings > mpSpectrumSettings
Definition: WaveTrack.h:626
Track::Cut
virtual Holder Cut(double WXUNUSED(t0), double WXUNUSED(t1))=0
WaveTrack::AllClipsIterator::mStack
Stack mStack
Definition: WaveTrack.h:416
Track::LinkConsistencyCheck
virtual bool LinkConsistencyCheck()
Definition: Track.cpp:397
IteratorRange
A convenience for use with range-for.
Definition: MemoryX.h:380
XMLTagHandler::HandleXMLEndTag
virtual void HandleXMLEndTag(const wxChar *WXUNUSED(tag))
Definition: XMLTagHandler.h:79
Track::InsertSilence
virtual void InsertSilence(double WXUNUSED(t), double WXUNUSED(len))=0
ClientData::Base
A convenient default parameter for class template Site.
Definition: ClientData.h:28
Region::start
double start
Definition: WaveTrack.h:56
WaveTrack::GetWaveColorIndex
int GetWaveColorIndex() const
Definition: WaveTrack.h:148
WaveTrack::IntervalData
Definition: WaveTrack.h:561
Track::SetPanFromChannelType
virtual void SetPanFromChannelType()
Definition: Track.h:448
PlayableTrack::Init
void Init(const PlayableTrack &init)
Definition: Track.cpp:311
Track::Paste
virtual void Paste(double WXUNUSED(t), const Track *WXUNUSED(src))=0
WaveTrack::mSpectrumMax
float mSpectrumMax
Definition: WaveTrack.h:602
WaveTrackLocation
Definition: WaveTrackLocation.h:14
Track::SetOffset
virtual void SetOffset(double o)
Definition: Track.h:445
WaveClipPointers
std::vector< WaveClip * > WaveClipPointers
Definition: WaveTrack.h:41
WaveTrackFactory::WaveTrackFactory
WaveTrackFactory(const WaveTrackFactory &) PROHIBITED
WaveTrackCache::Buffer::end
sampleCount end() const
Definition: WaveTrack.h:670
Sequence
A WaveTrack contains WaveClip(s). A WaveClip contains a Sequence. A Sequence is primarily an interfac...
Definition: Sequence.h:61
WaveTrack::mpWaveformSettings
std::unique_ptr< WaveformSettings > mpWaveformSettings
Definition: WaveTrack.h:627
WaveClipHolders
std::vector< WaveClipHolder > WaveClipHolders
Definition: WaveClip.h:122
Regions
std::vector< Region > Regions
Definition: WaveTrack.h:65
fillZero
@ fillZero
Definition: SampleFormat.h:54
InspectBlocks
void InspectBlocks(const TrackList &tracks, BlockInspector inspector, SampleBlockIDSet *pIDs=nullptr)
Definition: WaveTrack.cpp:2882
WaveTrack::IntervalData::GetClip
std::shared_ptr< WaveClip > & GetClip()
Definition: WaveTrack.h:567
WaveTrack::GetCachedLocations
const std::vector< Location > & GetCachedLocations() const
Definition: WaveTrack.h:530
SampleBlockID
long long SampleBlockID
Definition: ProjectFileIO.h:39
WaveTrack::mSpectrumMin
float mSpectrumMin
Definition: WaveTrack.h:601
operator==
bool operator==(const Tags &lhs, const Tags &rhs)
Definition: Tags.cpp:361
WaveTrack::AllClipsIterator::AllClipsIterator
AllClipsIterator()
Definition: WaveTrack.h:381
WaveTrackFactory::mpFactory
SampleBlockFactoryPtr mpFactory
Definition: WaveTrack.h:731
WaveTrackCache::WaveTrackCache
WaveTrackCache()
Definition: WaveTrack.h:635
WaveTrackFactory::operator=
WaveTrackFactory & operator=(const WaveTrackFactory &) PROHIBITED
WaveTrack::AllClipsConstIterator::AllClipsConstIterator
AllClipsConstIterator(const WaveTrack &track)
Definition: WaveTrack.h:429
floatSample
@ floatSample
Definition: SampleFormat.h:34
SampleCount.h
BlockVisitor
std::function< void(SampleBlock &) > BlockVisitor
Definition: WaveTrack.h:692
WaveTrack::mLastScaleType
int mLastScaleType
Definition: WaveTrack.h:604
Track::GetStartTime
virtual double GetStartTime() const =0
WaveTrack::IntervalData::pClip
std::shared_ptr< WaveClip > pClip
Definition: WaveTrack.h:569
ProjectRate
Holds project sample rate.
Definition: ProjectRate.h:27
Track::GetErrorOpening
virtual bool GetErrorOpening()
Definition: Track.h:799
WaveClip
This allows multiple clips to be a part of one WaveTrack.
Definition: WaveClip.h:173
Region::Region
Region(double start_, double end_)
Definition: WaveTrack.h:54
ProgressDialog
ProgressDialog Class.
Definition: ProgressDialog.h:51
WaveTrack::GetKind
TrackKind GetKind() const override
Definition: WaveTrack.h:614
Track::Holder
std::shared_ptr< Track > Holder
Definition: Track.h:336
BasicUI::Get
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:26
WaveTrackCache::Buffer::len
sampleCount len
Definition: WaveTrack.h:666
WaveTrack::mRate
int mRate
Definition: WaveTrack.h:588
constSamplePtr
const char * constSamplePtr
Definition: SampleFormat.h:50
WaveTrackCache::Buffer::Free
void Free()
Definition: WaveTrack.h:669
WaveTrackCache::mPTrack
std::shared_ptr< const WaveTrack > mPTrack
Definition: WaveTrack.h:680
Append
Append([](My &table) -> Registry::BaseItemPtr { if(WaveTrackSubViews::slots() > 1) return std::make_unique< Entry >("MultiView", Entry::CheckItem, OnMultiViewID, XXO("&Multi-view"), POPUP_MENU_FN(OnMultiView), table, [](PopupMenuHandler &handler, wxMenu &menu, int id){ auto &table=static_cast< WaveTrackMenuTable & >(handler);auto &track=table.FindWaveTrack();const auto &view=WaveTrackView::Get(track);menu.Check(id, view.GetMultiView());});else return nullptr;})
Track::Silence
virtual void Silence(double WXUNUSED(t0), double WXUNUSED(t1))=0
Region::Region
Region()
Definition: WaveTrack.h:53
WaveTrackCache::mOverlapBuffer
GrowableSampleBuffer mOverlapBuffer
Definition: WaveTrack.h:683
WaveTrack::GetClips
WaveClipHolders & GetClips()
Definition: WaveTrack.h:370
Track::GetOffset
virtual double GetOffset() const =0
anonymous_namespace{TimeTrack.cpp}::GetRate
double GetRate()
Definition: TimeTrack.cpp:175
WaveTrackCache::mBufferSize
size_t mBufferSize
Definition: WaveTrack.h:681
WaveTrack::mGain
float mGain
Definition: WaveTrack.h:589
Track::Clone
virtual Holder Clone() const =0
GrowableSampleBuffer
Definition: SampleFormat.h:106
name
const TranslatableString name
Definition: Distortion.cpp:98
WaveTrack::mDisplayLocationsCache
std::vector< Location > mDisplayLocationsCache
Definition: WaveTrack.h:606
WaveTrack::AllClipsConstIterator
Definition: WaveTrack.h:423
format
int format
Definition: ExportPCM.cpp:56
WaveTrack::mpFactory
SampleBlockFactoryPtr mpFactory
Definition: WaveTrack.h:620
WaveTrack::mClips
WaveClipHolders mClips
Definition: WaveTrack.h:585
Region::operator<
bool operator<(const Region &b) const
Definition: WaveTrack.h:59
anonymous_namespace{NoteTrack.cpp}::swap
void swap(std::unique_ptr< Alg_seq > &a, std::unique_ptr< Alg_seq > &b)
Definition: NoteTrack.cpp:735
WaveTrackCache::WaveTrackCache
WaveTrackCache(const std::shared_ptr< const WaveTrack > &pTrack)
Definition: WaveTrack.h:642
Resample
Interface to libsoxr.
Definition: Resample.h:27
Track::SetPan
virtual void SetPan(float)
Definition: Track.h:447
WaveTrack::GetSampleFormat
sampleFormat GetSampleFormat() const
Definition: WaveTrack.h:153
WaveClipHolder
std::shared_ptr< WaveClip > WaveClipHolder
Definition: WaveClip.h:121
Region::end
double end
Definition: WaveTrack.h:56
PlayableTrack
AudioTrack subclass that can also be audibly replayed by the program.
Definition: Track.h:854
WaveTrack::GetLastdBRange
int GetLastdBRange() const
Definition: WaveTrack.h:548
WaveTrack::AllClipsIterator::Iterator
WaveClipHolders::iterator Iterator
Definition: WaveTrack.h:412
WaveTrackFactory
Used to create or clone a WaveTrack, with appropriate context from the project that will own the trac...
Definition: WaveTrack.h:710
XMLTagHandler
This class is an interface which should be implemented by classes which wish to be able to load and s...
Definition: XMLTagHandler.h:62
Track::Intervals
std::vector< Interval > Intervals
Definition: Track.h:329
WaveTrack::mFlushCriticalSection
wxCriticalSection mFlushCriticalSection
Definition: WaveTrack.h:622
WaveTrack::mFormat
sampleFormat mFormat
Definition: WaveTrack.h:587
sampleFormat
sampleFormat
Definition: SampleFormat.h:29
WaveTrackFactory::WaveTrackFactory
WaveTrackFactory(const ProjectRate &rate, const SampleBlockFactoryPtr &pFactory)
Definition: WaveTrack.h:717
samplePtr
char * samplePtr
Definition: SampleFormat.h:49
BlockInspector
std::function< void(const SampleBlock &) > BlockInspector
Definition: WaveTrack.h:693
TrackKind
TrackKind
Enumerates all subclasses of Track (not just the leaf classes) and the None value.
Definition: Track.h:69
min
int min(int a, int b)
Definition: CompareAudioCommand.cpp:106
Track::WriteXML
virtual void WriteXML(XMLWriter &xmlFile) const =0
WaveTrackCache::GetTrack
const std::shared_ptr< const WaveTrack > & GetTrack() const
Definition: WaveTrack.h:651
Track
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:239
Track::ChannelType
ChannelType
Definition: Track.h:275
sampleCount
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:18
WaveTrack::Location
WaveTrackLocation Location
Definition: WaveTrack.h:95
WaveTrackFactory::GetSampleBlockFactory
const SampleBlockFactoryPtr & GetSampleBlockFactory() const
Definition: WaveTrack.h:726
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:92
WaveTrack::AllClipsIterator
Definition: WaveTrack.h:378
TrackKind::Wave
@ Wave
SampleBlock
Abstract class allows access to contents of a block of sound samples, serialization as XML,...
Definition: SampleBlock.h:45
WaveTrack::GetAllClips
IteratorRange< AllClipsConstIterator > GetAllClips() const
Definition: WaveTrack.h:457
WaveClipConstHolders
std::vector< std::shared_ptr< const WaveClip > > WaveClipConstHolders
Definition: WaveClip.h:123
ValueIterator
A convenience for defining iterators that return rvalue types, so that they cooperate correctly with ...
Definition: MemoryX.h:366
WaveTrack::GetLastScaleType
int GetLastScaleType() const
Definition: WaveTrack.h:545
WaveTrack::AllClipsIterator::Stack
std::vector< Pair > Stack
Definition: WaveTrack.h:414
Track::GetChannel
virtual ChannelType GetChannel() const
Definition: Track.h:441
WaveTrack::IntervalData::GetClip
std::shared_ptr< const WaveClip > GetClip() const
Definition: WaveTrack.h:566
WaveformSettings
Waveform settings, either for one track or as defaults.
Definition: WaveformSettings.h:19
XMLTagHandler::HandleXMLTag
virtual bool HandleXMLTag(const wxChar *tag, const wxChar **attrs)=0
XMLTagHandler::HandleXMLChild
virtual XMLTagHandler * HandleXMLChild(const wxChar *tag)=0
SampleBlockFactory
abstract base class with methods to produce SampleBlock objects
Definition: SampleBlock.h:106
Track::Clear
virtual void Clear(double WXUNUSED(t0), double WXUNUSED(t1))=0
Track.h
declares abstract base class Track, TrackList, and iterators over TrackList
WaveTrack::mDisplayMax
float mDisplayMax
Definition: WaveTrack.h:600
SampleBlockFactoryPtr
std::shared_ptr< SampleBlockFactory > SampleBlockFactoryPtr
Definition: SampleBlock.h:25
Region
Structure to hold region of a wavetrack and a comparison function for sortability.
Definition: WaveTrack.h:52
Track::Copy
virtual Holder Copy(double WXUNUSED(t0), double WXUNUSED(t1), bool forClipboard=true) const =0
WaveTrackCache::Buffer::data
Floats data
Definition: WaveTrack.h:664
Track::PasteInto
virtual Holder PasteInto(AudacityProject &) const =0
Find or create the destination track for a paste, maybe in a different project.
WaveTrack::GetFloats
bool GetFloats(float *buffer, sampleCount start, size_t len, fillFormat fill=fillZero, bool mayThrow=true, sampleCount *pNumWithinClips=nullptr) const
Retrieve samples from a track in floating-point format, regardless of the storage format.
Definition: WaveTrack.h:265
WaveTrack::mLegacyProjectFileOffset
double mLegacyProjectFileOffset
Definition: WaveTrack.h:624
WaveTrack::mPan
float mPan
Definition: WaveTrack.h:590
ArrayOf< float >
WaveTrackCache::Buffer::start
sampleCount start
Definition: WaveTrack.h:665
WaveTrackCache::Buffer
Definition: WaveTrack.h:663
Track::SyncLockAdjust
virtual void SyncLockAdjust(double oldT1, double newT1)
Definition: Track.cpp:293
WaveTrack::mDisplayMin
float mDisplayMin
Definition: WaveTrack.h:599
WaveTrack::GetClips
const WaveClipConstHolders & GetClips() const
Definition: WaveTrack.h:371
WaveTrack::mAppendCriticalSection
wxCriticalSection mAppendCriticalSection
Definition: WaveTrack.h:623
WaveTrackCache::Buffer::Buffer
Buffer()
Definition: WaveTrack.h:668