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 
16 #include <vector>
17 #include <functional>
18 #include <wx/longlong.h>
19 
20 #include "WaveTrackLocation.h"
21 
22 class ProgressDialog;
23 
24 class SampleBlockFactory;
25 using SampleBlockFactoryPtr = std::shared_ptr<SampleBlockFactory>;
26 
28 class WaveformSettings;
29 class TimeWarper;
30 
31 class Sequence;
32 class WaveClip;
33 
34 // Array of pointers that assume ownership
35 using WaveClipHolder = std::shared_ptr< WaveClip >;
36 using WaveClipHolders = std::vector < WaveClipHolder >;
37 using WaveClipConstHolders = std::vector < std::shared_ptr< const WaveClip > >;
38 
39 // Temporary arrays of mere pointers
40 using WaveClipPointers = std::vector < WaveClip* >;
41 using WaveClipConstPointers = std::vector < const WaveClip* >;
42 
43 //
44 // Tolerance for merging wave tracks (in seconds)
45 //
46 #define WAVETRACK_MERGE_POINT_TOLERANCE 0.01
47 
50 struct Region
51 {
52  Region() : start(0), end(0) {}
53  Region(double start_, double end_) : start(start_), end(end_) {}
54 
55  double start, end;
56 
57  //used for sorting
58  bool operator < (const Region &b) const
59  {
60  return this->start < b.start;
61  }
62 };
63 
64 using Regions = std::vector < Region >;
65 
66 class Envelope;
67 
68 class AUDACITY_DLL_API WaveTrack final : public PlayableTrack {
69 public:
70 
71  //
72  // Constructor / Destructor / Duplicator
73  //
74 
75  WaveTrack(
76  const SampleBlockFactoryPtr &pFactory, sampleFormat format, double rate);
77  WaveTrack(const WaveTrack &orig);
78 
79  // overwrite data excluding the sample sequence but including display
80  // settings
81  void Reinit(const WaveTrack &orig);
82 
83 private:
84  void Init(const WaveTrack &orig);
85 
86  Track::Holder Clone() const override;
87 
88  friend class WaveTrackFactory;
89 
90  public:
91 
93  using Holder = std::shared_ptr<WaveTrack>;
94 
95  virtual ~WaveTrack();
96 
97  double GetOffset() const override;
98  void SetOffset(double o) override;
99  virtual ChannelType GetChannelIgnoringPan() const;
100  ChannelType GetChannel() const override;
101  virtual void SetPanFromChannelType() override;
102 
107  double GetStartTime() const override;
108 
114  double GetEndTime() const override;
115 
116  //
117  // Identifying the type of track
118  //
119 
120  //
121  // WaveTrack parameters
122  //
123 
124  double GetRate() const;
125  void SetRate(double newRate);
126 
127  // Multiplicative factor. Only converted to dB for display.
128  float GetGain() const;
129  void SetGain(float newGain);
130 
131  // -1.0 (left) -> 1.0 (right)
132  float GetPan() const;
133  void SetPan(float newPan) override;
134 
135  // Takes gain and pan into account
136  float GetChannelGain(int channel) const;
137 
138  // Old gain is used in playback in linearly interpolating
139  // the gain.
140  float GetOldChannelGain(int channel) const;
141  void SetOldChannelGain(int channel, float gain);
142 
143  int GetWaveColorIndex() const { return mWaveColorIndex; };
144  void SetWaveColorIndex(int colorIndex);
145 
146  sampleCount GetNumSamples() const;
147 
148  sampleFormat GetSampleFormat() const { return mFormat; }
149  void ConvertToSampleFormat(sampleFormat format,
150  const std::function<void(size_t)> & progressReport = {});
151 
152  const SpectrogramSettings &GetSpectrogramSettings() const;
153  SpectrogramSettings &GetSpectrogramSettings();
154  SpectrogramSettings &GetIndependentSpectrogramSettings();
155  void SetSpectrogramSettings(std::unique_ptr<SpectrogramSettings> &&pSettings);
156 
157  const WaveformSettings &GetWaveformSettings() const;
158  WaveformSettings &GetWaveformSettings();
159  void SetWaveformSettings(std::unique_ptr<WaveformSettings> &&pSettings);
160  void UseSpectralPrefs( bool bUse=true );
161  //
162  // High-level editing
163  //
164 
165  Track::Holder Cut(double t0, double t1) override;
166 
167  // Make another track copying format, rate, color, etc. but containing no
168  // clips
169  // It is important to pass the correct factory (that for the project
170  // which will own the copy) in the unusual case that a track is copied from
171  // another project or the clipboard. For copies within one project, the
172  // default will do.
173  Holder EmptyCopy(const SampleBlockFactoryPtr &pFactory = {} ) const;
174 
175  // If forClipboard is true,
176  // and there is no clip at the end time of the selection, then the result
177  // will contain a "placeholder" clip whose only purpose is to make
178  // GetEndTime() correct. This clip is not re-copied when pasting.
179  Track::Holder Copy(double t0, double t1, bool forClipboard = true) const override;
180  Track::Holder CopyNonconst(double t0, double t1) /* not override */;
181 
182  void Clear(double t0, double t1) override;
183  void Paste(double t0, const Track *src) override;
184  // May assume precondition: t0 <= t1
185  void ClearAndPaste(double t0, double t1,
186  const Track *src,
187  bool preserve = true,
188  bool merge = true,
189  const TimeWarper *effectWarper = NULL) /* not override */;
190 
191  void Silence(double t0, double t1) override;
192  void InsertSilence(double t, double len) override;
193 
194  void SplitAt(double t) /* not override */;
195  void Split(double t0, double t1) /* not override */;
196  // Track::Holder CutAndAddCutLine(double t0, double t1) /* not override */;
197  // May assume precondition: t0 <= t1
198  void ClearAndAddCutLine(double t0, double t1) /* not override */;
199 
200  Track::Holder SplitCut(double t0, double t1) /* not override */;
201  // May assume precondition: t0 <= t1
202  void SplitDelete(double t0, double t1) /* not override */;
203  void Join(double t0, double t1) /* not override */;
204  // May assume precondition: t0 <= t1
205  void Disjoin(double t0, double t1) /* not override */;
206 
207  // May assume precondition: t0 <= t1
208  void Trim(double t0, double t1) /* not override */;
209 
210  // May assume precondition: t0 <= t1
211  void HandleClear(double t0, double t1, bool addCutLines, bool split);
212 
213  void SyncLockAdjust(double oldT1, double newT1) override;
214 
220  bool IsEmpty(double t0, double t1) const;
221 
232  size_t len, unsigned int stride=1);
234  void Flush();
235 
237  void ClearWaveCaches();
238 
249 
251 
260  bool GetFloats(float *buffer, sampleCount start, size_t len,
261  fillFormat fill = fillZero, bool mayThrow = true,
262  sampleCount * pNumWithinClips = nullptr) const
263  {
265  return Get(reinterpret_cast<samplePtr>(buffer),
266  floatSample, start, len, fill, mayThrow, pNumWithinClips);
267  }
268 
270 
274  bool Get(samplePtr buffer, sampleFormat format,
275  sampleCount start, size_t len,
276  fillFormat fill = fillZero,
277  bool mayThrow = true,
278  // Report how many samples were copied from within clips, rather than
279  // filled according to fillFormat; but these were not necessarily one
280  // contiguous range.
281  sampleCount * pNumWithinClips = nullptr) const;
282 
283  void Set(constSamplePtr buffer, sampleFormat format,
284  sampleCount start, size_t len);
285 
286  // Fetch envelope values corresponding to uniformly separated sample times
287  // starting at the given time.
288  void GetEnvelopeValues(double *buffer, size_t bufferLen,
289  double t0) const;
290 
291  // May assume precondition: t0 <= t1
292  std::pair<float, float> GetMinMax(
293  double t0, double t1, bool mayThrow = true) const;
294  // May assume precondition: t0 <= t1
295  float GetRMS(double t0, double t1, bool mayThrow = true) const;
296 
297  //
298  // MM: We now have more than one sequence and envelope per track, so
299  // instead of GetSequence() and GetEnvelope() we have the following
300  // function which give the sequence and envelope which contains the given
301  // time.
302  //
303  Sequence* GetSequenceAtTime(double time);
304  Envelope* GetEnvelopeAtTime(double time);
305 
306  WaveClip* GetClipAtSample(sampleCount sample);
307  WaveClip* GetClipAtTime(double time);
308 
309  //
310  // Getting information about the track's internal block sizes
311  // and alignment for efficiency
312  //
313 
314  // This returns a possibly large or negative value
315  sampleCount GetBlockStart(sampleCount t) const;
316 
317  // These return a nonnegative number of samples meant to size a memory buffer
318  size_t GetBestBlockSize(sampleCount t) const;
319  size_t GetMaxBlockSize() const;
320  size_t GetIdealBlockSize();
321 
322  //
323  // XMLTagHandler callback methods for loading and saving
324  //
325 
326  bool HandleXMLTag(const wxChar *tag, const wxChar **attrs) override;
327  void HandleXMLEndTag(const wxChar *tag) override;
328  XMLTagHandler *HandleXMLChild(const wxChar *tag) override;
329  void WriteXML(XMLWriter &xmlFile) const override;
330 
331  // Returns true if an error occurred while reading from XML
332  bool GetErrorOpening() override;
333 
334  //
335  // Lock and unlock the track: you must lock the track before
336  // doing a copy and paste between projects.
337  //
338 
339  bool CloseLock(); //should be called when the project closes.
340  // not balanced by unlocking calls.
341 
355  sampleCount TimeToLongSamples(double t0) const;
361  double LongSamplesToTime(sampleCount pos) const;
362 
363  // Get access to the (visible) clips in the tracks, in unspecified order
364  // (not necessarily sequenced in time).
365  WaveClipHolders &GetClips() { return mClips; }
367  { return reinterpret_cast< const WaveClipConstHolders& >( mClips ); }
368 
369  // Get mutative access to all clips (in some unspecified sequence),
370  // including those hidden in cutlines.
372  : public ValueIterator< WaveClip * >
373  {
374  public:
375  // Constructs an "end" iterator
377 
378  // Construct a "begin" iterator
379  explicit AllClipsIterator( WaveTrack &track )
380  {
381  push( track.mClips );
382  }
383 
385  {
386  if (mStack.empty())
387  return nullptr;
388  else
389  return mStack.back().first->get();
390  }
391 
392  AllClipsIterator &operator ++ ();
393 
394  // Define == well enough to serve for loop termination test
395  friend bool operator == (
396  const AllClipsIterator &a, const AllClipsIterator &b)
397  { return a.mStack.empty() == b.mStack.empty(); }
398 
399  friend bool operator != (
400  const AllClipsIterator &a, const AllClipsIterator &b)
401  { return !( a == b ); }
402 
403  private:
404 
405  void push( WaveClipHolders &clips );
406 
407  using Iterator = WaveClipHolders::iterator;
408  using Pair = std::pair< Iterator, Iterator >;
409  using Stack = std::vector< Pair >;
410 
412  };
413 
414  // Get const access to all clips (in some unspecified sequence),
415  // including those hidden in cutlines.
417  : public ValueIterator< const WaveClip * >
418  {
419  public:
420  // Constructs an "end" iterator
422 
423  // Construct a "begin" iterator
424  explicit AllClipsConstIterator( const WaveTrack &track )
425  : mIter{ const_cast< WaveTrack& >( track ) }
426  {}
427 
428  const WaveClip *operator * () const
429  { return *mIter; }
430 
431  AllClipsConstIterator &operator ++ ()
432  { ++mIter; return *this; }
433 
434  // Define == well enough to serve for loop termination test
435  friend bool operator == (
436  const AllClipsConstIterator &a, const AllClipsConstIterator &b)
437  { return a.mIter == b.mIter; }
438 
439  friend bool operator != (
440  const AllClipsConstIterator &a, const AllClipsConstIterator &b)
441  { return !( a == b ); }
442 
443  private:
445  };
446 
448  {
449  return { AllClipsIterator{ *this }, AllClipsIterator{ } };
450  }
451 
453  {
454  return { AllClipsConstIterator{ *this }, AllClipsConstIterator{ } };
455  }
456 
457  // Create NEW clip and add it to this track. Returns a pointer
458  // to the newly created clip.
459  WaveClip* CreateClip();
460 
466  WaveClip* NewestOrNewClip();
467 
473  WaveClip* RightmostOrNewClip();
474 
475  // Get the linear index of a given clip (-1 if the clip is not found)
476  int GetClipIndex(const WaveClip* clip) const;
477 
478  // Get the nth clip in this WaveTrack (will return NULL if not found).
479  // Use this only in special cases (like getting the linked clip), because
480  // it is much slower than GetClipIterator().
481  WaveClip *GetClipByIndex(int index);
482  const WaveClip* GetClipByIndex(int index) const;
483 
484  // Get number of clips in this WaveTrack
485  int GetNumClips() const;
486 
487  // Add all wave clips to the given array 'clips' and sort the array by
488  // clip start time. The array is emptied prior to adding the clips.
489  WaveClipPointers SortedClipArray();
490  WaveClipConstPointers SortedClipArray() const;
491 
493 
496  bool CanOffsetClips(
497  const std::vector<WaveClip*> &clips,
498  double amount,
499  double *allowedAmount = nullptr
501  );
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) const;
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 
513  bool AddClip(const std::shared_ptr<WaveClip> &clip);
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  int GetLastScaleType() const { return mLastScaleType; }
540  void SetLastScaleType() const;
541 
542  int GetLastdBRange() const { return mLastdBRange; }
543  void SetLastdBRange() const;
544 
545  void GetDisplayBounds(float *min, float *max) const;
546  void SetDisplayBounds(float min, float max) const;
547  void GetSpectrumBounds(float *min, float *max) const;
548  void SetSpectrumBounds(float min, float max) const;
549 
550  // For display purposes, calculate the y coordinate where the midline of
551  // the wave should be drawn, if display minimum and maximum map to the
552  // bottom and top. Maybe that is out of bounds.
553  int ZeroLevelYCoordinate(wxRect rect) const;
554 
555  class IntervalData final : public Track::IntervalData {
556  public:
557  explicit IntervalData( const std::shared_ptr<WaveClip> &pClip )
558  : pClip{ pClip }
559  {}
560  std::shared_ptr<const WaveClip> GetClip() const { return pClip; }
561  std::shared_ptr<WaveClip> &GetClip() { return pClip; }
562  private:
563  std::shared_ptr<WaveClip> pClip;
564  };
565 
566  Track::Holder PasteInto( AudacityProject & ) const override;
567 
568  ConstIntervals GetIntervals() const override;
569  Intervals GetIntervals() override;
570 
571  protected:
572  //
573  // Protected variables
574  //
575 
577 
579  int mRate;
580  float mGain;
581  float mPan;
583  float mOldGain[2];
584 
585 
586  //
587  // Data that should be part of GUIWaveTrack
588  // and will be taken out of the WaveTrack class:
589  //
590  mutable float mDisplayMin;
591  mutable float mDisplayMax;
592  mutable float mSpectrumMin;
593  mutable float mSpectrumMax;
594 
595  mutable int mLastScaleType; // last scale type choice
596  mutable int mLastdBRange;
597  mutable std::vector <Location> mDisplayLocationsCache;
598 
599  //
600  // Protected methods
601  //
602 
603 private:
604 
605  TrackKind GetKind() const override { return TrackKind::Wave; }
606 
607  //
608  // Private variables
609  //
610 
612 
613  wxCriticalSection mFlushCriticalSection;
614  wxCriticalSection mAppendCriticalSection;
616 
617  std::unique_ptr<SpectrogramSettings> mpSpectrumSettings;
618  std::unique_ptr<WaveformSettings> mpWaveformSettings;
619 };
620 
622 
624 class AUDACITY_DLL_API WaveTrackCache {
625 public:
627  : mBufferSize(0)
628  , mOverlapBuffer()
629  , mNValidBuffers(0)
630  {
631  }
632 
633  explicit WaveTrackCache(const std::shared_ptr<const WaveTrack> &pTrack)
634  : mBufferSize(0)
635  , mOverlapBuffer()
636  , mNValidBuffers(0)
637  {
638  SetTrack(pTrack);
639  }
640  ~WaveTrackCache();
641 
642  const std::shared_ptr<const WaveTrack>& GetTrack() const { return mPTrack; }
643  void SetTrack(const std::shared_ptr<const WaveTrack> &pTrack);
644 
646 
649  const float *GetFloats(sampleCount start, size_t len, bool mayThrow);
650 
651 private:
652  void Free();
653 
654  struct Buffer {
658 
659  Buffer() : start(0), len(0) {}
660  void Free() { data.reset(); start = 0; len = 0; }
661  sampleCount end() const { return start + len; }
662 
663  void swap ( Buffer &other )
664  {
665  data .swap ( other.data );
666  std::swap( start, other.start );
667  std::swap( len, other.len );
668  }
669  };
670 
671  std::shared_ptr<const WaveTrack> mPTrack;
672  size_t mBufferSize;
673  Buffer mBuffers[2];
676 };
677 
678 #include <unordered_set>
679 class SampleBlock;
680 using SampleBlockID = long long;
681 using SampleBlockIDSet = std::unordered_set<SampleBlockID>;
682 class TrackList;
683 using BlockVisitor = std::function< void(SampleBlock&) >;
684 using BlockInspector = std::function< void(const SampleBlock&) >;
685 
686 // Function to visit all sample blocks from a list of tracks.
687 // If a set is supplied, then only visit once each unique block ID not already
688 // in that set, and accumulate those into the set as a side-effect.
689 // The visitor function may be null.
690 void VisitBlocks(TrackList &tracks, BlockVisitor visitor,
691  SampleBlockIDSet *pIDs = nullptr);
692 
693 // Non-mutating version of the above
694 void InspectBlocks(const TrackList &tracks, BlockInspector inspector,
695  SampleBlockIDSet *pIDs = nullptr);
696 
697 class AUDACITY_DLL_API WaveTrackFactory final
698  : public ClientData::Base
699 {
700  public:
701  static WaveTrackFactory &Get( AudacityProject &project );
702  static const WaveTrackFactory &Get( const AudacityProject &project );
703  static WaveTrackFactory &Reset( AudacityProject &project );
704  static void Destroy( AudacityProject &project );
705 
707  const SampleBlockFactoryPtr &pFactory)
708  : mSettings{ settings }
709  , mpFactory(pFactory)
710  {
711  }
712  WaveTrackFactory( const WaveTrackFactory & ) PROHIBITED;
714 
716  { return mpFactory; }
717 
718  private:
721  public:
722  std::shared_ptr<WaveTrack> DuplicateWaveTrack(const WaveTrack &orig);
723  std::shared_ptr<WaveTrack> NewWaveTrack(
725  double rate = 0);
726 };
727 
728 #endif // __AUDACITY_WAVETRACK__
WaveTrackCache
A short-lived object, during whose lifetime, the contents of the WaveTrack are assumed not to change.
Definition: WaveTrack.h:624
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:41
WaveTrack::AllClipsIterator::AllClipsIterator
AllClipsIterator(WaveTrack &track)
Definition: WaveTrack.h:379
WaveTrack::IntervalData::IntervalData
IntervalData(const std::shared_ptr< WaveClip > &pClip)
Definition: WaveTrack.h:557
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:68
VisitBlocks
void VisitBlocks(TrackList &tracks, BlockVisitor visitor, SampleBlockIDSet *pIDs=nullptr)
Definition: WaveTrack.cpp:2763
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:421
SampleBlockIDSet
std::unordered_set< SampleBlockID > SampleBlockIDSet
Definition: WaveTrack.h:681
operator*
Vector operator*(const Vector &left, const Vector &right)
Definition: Matrix.cpp:153
WaveTrackCache::Buffer::swap
void swap(Buffer &other)
Definition: WaveTrack.h:663
WaveTrack::AllClipsIterator::Pair
std::pair< Iterator, Iterator > Pair
Definition: WaveTrack.h:408
WaveTrackCache::mNValidBuffers
int mNValidBuffers
Definition: WaveTrack.h:675
WaveTrack::GetAllClips
IteratorRange< AllClipsIterator > GetAllClips()
Definition: WaveTrack.h:447
WaveTrack::AllClipsConstIterator::mIter
AllClipsIterator mIter
Definition: WaveTrack.h:444
Track::GetEndTime
virtual double GetEndTime() const =0
constSamplePtr
const char * constSamplePtr
Definition: Types.h:215
WaveTrack::mWaveColorIndex
int mWaveColorIndex
Definition: WaveTrack.h:582
Track::ConstIntervals
std::vector< ConstInterval > ConstIntervals
Definition: Track.h:319
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
ValueIterator
std::iterator< Category, const Value, ptrdiff_t, void, const Value > ValueIterator
A convenience for defining iterators that return rvalue types, so that they cooperate correctly with ...
Definition: MemoryX.h:371
WaveTrackLocation.h
fillFormat
fillFormat
Definition: SampleFormat.h:42
WaveTrack::mLastdBRange
int mLastdBRange
Definition: WaveTrack.h:596
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:1232
PlayableTrack::Merge
void Merge(const Track &init) override
Definition: Track.cpp:309
TrackList
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition: Track.h:1263
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:185
WaveTrack::mpSpectrumSettings
std::unique_ptr< SpectrogramSettings > mpSpectrumSettings
Definition: WaveTrack.h:617
Track::Cut
virtual Holder Cut(double WXUNUSED(t0), double WXUNUSED(t1))=0
WaveTrack::AllClipsIterator::mStack
Stack mStack
Definition: WaveTrack.h:411
IteratorRange
A convenience for use with range-for.
Definition: MemoryX.h:377
XMLTagHandler::HandleXMLEndTag
virtual void HandleXMLEndTag(const wxChar *WXUNUSED(tag))
Definition: XMLTagHandler.h:97
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:55
WaveTrack::GetWaveColorIndex
int GetWaveColorIndex() const
Definition: WaveTrack.h:143
WaveTrack::IntervalData
Definition: WaveTrack.h:555
Track::SetPanFromChannelType
virtual void SetPanFromChannelType()
Definition: Track.h:431
PlayableTrack::Init
void Init(const PlayableTrack &init)
Definition: Track.cpp:302
Track::Paste
virtual void Paste(double WXUNUSED(t), const Track *WXUNUSED(src))=0
WaveTrack::mSpectrumMax
float mSpectrumMax
Definition: WaveTrack.h:593
floatSample
@ floatSample
Definition: Types.h:199
WaveTrackLocation
Definition: WaveTrackLocation.h:14
Track::SetOffset
virtual void SetOffset(double o)
Definition: Track.h:428
WaveClipPointers
std::vector< WaveClip * > WaveClipPointers
Definition: WaveTrack.h:40
WaveTrackFactory::WaveTrackFactory
WaveTrackFactory(const WaveTrackFactory &) PROHIBITED
WaveTrackCache::Buffer::end
sampleCount end() const
Definition: WaveTrack.h:661
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:618
WaveClipHolders
std::vector< WaveClipHolder > WaveClipHolders
Definition: WaveClip.h:121
Regions
std::vector< Region > Regions
Definition: WaveTrack.h:64
fillZero
@ fillZero
Definition: SampleFormat.h:43
InspectBlocks
void InspectBlocks(const TrackList &tracks, BlockInspector inspector, SampleBlockIDSet *pIDs=nullptr)
Definition: WaveTrack.cpp:2784
WaveTrack::IntervalData::GetClip
std::shared_ptr< WaveClip > & GetClip()
Definition: WaveTrack.h:561
WaveTrack::GetCachedLocations
const std::vector< Location > & GetCachedLocations() const
Definition: WaveTrack.h:524
SampleBlockID
long long SampleBlockID
Definition: ProjectFileIO.h:37
WaveTrack::mSpectrumMin
float mSpectrumMin
Definition: WaveTrack.h:592
operator==
bool operator==(const Tags &lhs, const Tags &rhs)
Definition: Tags.cpp:360
WaveTrack::AllClipsIterator::AllClipsIterator
AllClipsIterator()
Definition: WaveTrack.h:376
WaveTrackFactory::mpFactory
SampleBlockFactoryPtr mpFactory
Definition: WaveTrack.h:720
WaveTrackCache::WaveTrackCache
WaveTrackCache()
Definition: WaveTrack.h:626
WaveTrackFactory::operator=
WaveTrackFactory & operator=(const WaveTrackFactory &) PROHIBITED
WaveTrack::AllClipsConstIterator::AllClipsConstIterator
AllClipsConstIterator(const WaveTrack &track)
Definition: WaveTrack.h:424
BlockVisitor
std::function< void(SampleBlock &) > BlockVisitor
Definition: WaveTrack.h:683
WaveTrack::mLastScaleType
int mLastScaleType
Definition: WaveTrack.h:595
Track::GetStartTime
virtual double GetStartTime() const =0
WaveTrack::IntervalData::pClip
std::shared_ptr< WaveClip > pClip
Definition: WaveTrack.h:563
Track::GetErrorOpening
virtual bool GetErrorOpening()
Definition: Track.h:782
WaveClip
This allows multiple clips to be a part of one WaveTrack.
Definition: WaveClip.h:172
samplePtr
char * samplePtr
Definition: Types.h:214
sampleFormat
sampleFormat
Definition: Types.h:194
Region::Region
Region(double start_, double end_)
Definition: WaveTrack.h:53
ProgressDialog
ProgressDialog Class.
Definition: ProgressDialog.h:56
WaveTrack::GetKind
TrackKind GetKind() const override
Definition: WaveTrack.h:605
Track::Holder
std::shared_ptr< Track > Holder
Definition: Track.h:324
WaveTrackFactory::WaveTrackFactory
WaveTrackFactory(const ProjectSettings &settings, const SampleBlockFactoryPtr &pFactory)
Definition: WaveTrack.h:706
Track::WaveTrack
friend WaveTrack
Definition: Track.h:373
WaveTrackCache::Buffer::len
sampleCount len
Definition: WaveTrack.h:657
WaveTrack::mRate
int mRate
Definition: WaveTrack.h:579
WaveTrackCache::Buffer::Free
void Free()
Definition: WaveTrack.h:660
WaveTrackCache::mPTrack
std::shared_ptr< const WaveTrack > mPTrack
Definition: WaveTrack.h:671
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:52
WaveTrackCache::mOverlapBuffer
GrowableSampleBuffer mOverlapBuffer
Definition: WaveTrack.h:674
WaveTrack::GetClips
WaveClipHolders & GetClips()
Definition: WaveTrack.h:365
Track::GetOffset
virtual double GetOffset() const =0
WaveTrackCache::mBufferSize
size_t mBufferSize
Definition: WaveTrack.h:672
WaveTrack::mGain
float mGain
Definition: WaveTrack.h:580
Track::Clone
virtual Holder Clone() const =0
GrowableSampleBuffer
Definition: SampleFormat.h:94
WaveTrack::mDisplayLocationsCache
std::vector< Location > mDisplayLocationsCache
Definition: WaveTrack.h:597
WaveTrack::AllClipsConstIterator
Definition: WaveTrack.h:418
format
int format
Definition: ExportPCM.cpp:54
WaveTrack::mpFactory
SampleBlockFactoryPtr mpFactory
Definition: WaveTrack.h:611
WaveTrack::mClips
WaveClipHolders mClips
Definition: WaveTrack.h:576
Region::operator<
bool operator<(const Region &b) const
Definition: WaveTrack.h:58
WaveTrackFactory::mSettings
const ProjectSettings & mSettings
Definition: WaveTrack.h:719
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:633
Resample
Interface to libsoxr.
Definition: Resample.h:29
Track::SetPan
virtual void SetPan(float)
Definition: Track.h:430
WaveTrack::GetSampleFormat
sampleFormat GetSampleFormat() const
Definition: WaveTrack.h:148
WaveClipHolder
std::shared_ptr< WaveClip > WaveClipHolder
Definition: WaveClip.h:120
Region::end
double end
Definition: WaveTrack.h:55
PlayableTrack
AudioTrack subclass that can also be audibly replayed by the program.
Definition: Track.h:837
WaveTrack::GetLastdBRange
int GetLastdBRange() const
Definition: WaveTrack.h:542
WaveTrack::AllClipsIterator::Iterator
WaveClipHolders::iterator Iterator
Definition: WaveTrack.h:407
WaveTrackFactory
Used to create or clone a WaveTrack, with appropriate context from the project that will own the trac...
Definition: WaveTrack.h:699
XMLTagHandler
This class is an interface which should be implemented by classes which wish to be able to load and s...
Definition: XMLTagHandler.h:80
Track::Intervals
std::vector< Interval > Intervals
Definition: Track.h:317
WaveTrack::mFlushCriticalSection
wxCriticalSection mFlushCriticalSection
Definition: WaveTrack.h:613
WaveTrack::mFormat
sampleFormat mFormat
Definition: WaveTrack.h:578
BlockInspector
std::function< void(const SampleBlock &) > BlockInspector
Definition: WaveTrack.h:684
TrackKind
TrackKind
Enumerates all subclasses of Track (not just the leaf classes) and the None value.
Definition: Track.h:68
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:642
Track
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:238
XMLValueChecker::ChannelType
ChannelType
Definition: XMLTagHandler.h:67
sampleCount
Definition: Types.h:66
WaveTrack::Location
WaveTrackLocation Location
Definition: WaveTrack.h:92
WaveTrackFactory::GetSampleBlockFactory
const SampleBlockFactoryPtr & GetSampleBlockFactory() const
Definition: WaveTrack.h:715
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:112
WaveTrack::AllClipsIterator
Definition: WaveTrack.h:373
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:452
WaveClipConstHolders
std::vector< std::shared_ptr< const WaveClip > > WaveClipConstHolders
Definition: WaveClip.h:122
WaveTrack::GetLastScaleType
int GetLastScaleType() const
Definition: WaveTrack.h:539
WaveTrack::AllClipsIterator::Stack
std::vector< Pair > Stack
Definition: WaveTrack.h:409
Track::GetChannel
virtual ChannelType GetChannel() const
Definition: Track.h:424
WaveTrack::IntervalData::GetClip
std::shared_ptr< const WaveClip > GetClip() const
Definition: WaveTrack.h:560
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
operator!=
bool operator!=(const SelectedRegion &lhs, const SelectedRegion &rhs)
Definition: SelectedRegion.h:283
WaveTrack::mDisplayMax
float mDisplayMax
Definition: WaveTrack.h:591
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:51
settings
static Settings & settings()
Definition: TrackInfo.cpp:87
Track::Copy
virtual Holder Copy(double WXUNUSED(t0), double WXUNUSED(t1), bool forClipboard=true) const =0
WaveTrackCache::Buffer::data
Floats data
Definition: WaveTrack.h:655
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:260
WaveTrack::mLegacyProjectFileOffset
double mLegacyProjectFileOffset
Definition: WaveTrack.h:615
WaveTrack::mPan
float mPan
Definition: WaveTrack.h:581
ArrayOf< float >
WaveTrackCache::Buffer::start
sampleCount start
Definition: WaveTrack.h:656
WaveTrackCache::Buffer
Definition: WaveTrack.h:654
Track::SyncLockAdjust
virtual void SyncLockAdjust(double oldT1, double newT1)
Definition: Track.cpp:284
WaveTrack::mDisplayMin
float mDisplayMin
Definition: WaveTrack.h:590
WaveTrack::GetClips
const WaveClipConstHolders & GetClips() const
Definition: WaveTrack.h:366
WaveTrack::mAppendCriticalSection
wxCriticalSection mAppendCriticalSection
Definition: WaveTrack.h:614
ProjectSettings
Holds various per-project settings values, including the sample rate, and sends events to the project...
Definition: ProjectSettings.h:53
WaveTrackCache::Buffer::Buffer
Buffer()
Definition: WaveTrack.h:659