Audacity 3.2.0
WaveTrack.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 WaveTrack.h
6
7 Dominic Mazzoni
8
9**********************************************************************/
10
11#ifndef __AUDACITY_WAVETRACK__
12#define __AUDACITY_WAVETRACK__
13
14#include "Prefs.h"
15#include "SampleCount.h"
16#include "SampleFormat.h"
17#include "SampleTrack.h"
18
19#include <vector>
20#include <functional>
21#include <wx/thread.h>
22#include <wx/longlong.h>
23
24class wxRect;
25
26#include "WaveTrackLocation.h"
27
28namespace BasicUI{ class ProgressDialog; }
29
31using SampleBlockFactoryPtr = std::shared_ptr<SampleBlockFactory>;
32
35class TimeWarper;
36
37class Sequence;
38class WaveClip;
39
40// Array of pointers that assume ownership
41using WaveClipHolder = std::shared_ptr< WaveClip >;
42using WaveClipHolders = std::vector < WaveClipHolder >;
43using WaveClipConstHolders = std::vector < std::shared_ptr< const WaveClip > >;
44
45// Temporary arrays of mere pointers
46using WaveClipPointers = std::vector < WaveClip* >;
47using WaveClipConstPointers = std::vector < const WaveClip* >;
48
49//
50// Tolerance for merging wave tracks (in seconds)
51//
52#define WAVETRACK_MERGE_POINT_TOLERANCE 0.01
53
54class Envelope;
55
56class AUDACITY_DLL_API WaveTrack final : public WritableSampleTrack
57{
58public:
61 struct Region
62 {
63 Region() : start(0), end(0) {}
64 Region(double start_, double end_) : start(start_), end(end_) {}
65
66 double start, end;
67
68 //used for sorting
69 bool operator < (const Region &b) const
70 {
71 return this->start < b.start;
72 }
73 };
74
75 using Regions = std::vector < Region >;
76
77 static wxString GetDefaultAudioTrackNamePreference();
78
79 //
80 // Constructor / Destructor / Duplicator
81 //
82
83 // Construct and also build all attachments
84 static WaveTrack *New( AudacityProject &project );
85
87 const SampleBlockFactoryPtr &pFactory, sampleFormat format, double rate);
90
91 // overwrite data excluding the sample sequence but including display
92 // settings
93 void Reinit(const WaveTrack &orig);
94private:
95 void Init(const WaveTrack &orig);
96
97 Track::Holder Clone() const override;
98
99 friend class WaveTrackFactory;
100
101 wxString MakeClipCopyName(const wxString& originalName) const;
102 wxString MakeNewClipName() const;
103 public:
104
106 using Holder = std::shared_ptr<WaveTrack>;
107
108 virtual ~WaveTrack();
109
110 double GetOffset() const override;
111 void SetOffset(double o) override;
112 ChannelType GetChannelIgnoringPan() const override;
113 ChannelType GetChannel() const override;
114 virtual void SetPanFromChannelType() override;
115
116 bool LinkConsistencyFix(bool doFix, bool completeList) override;
117
122 double GetStartTime() const override;
123
129 double GetEndTime() const override;
130
131 //
132 // Identifying the type of track
133 //
134
135 //
136 // WaveTrack parameters
137 //
138
139 double GetRate() const override;
140 void SetRate(double newRate);
141
142 // Multiplicative factor. Only converted to dB for display.
143 float GetGain() const;
144 void SetGain(float newGain);
145
146 // -1.0 (left) -> 1.0 (right)
147 float GetPan() const;
148 void SetPan(float newPan) override;
149
150 float GetChannelGain(int channel) const override;
151
152 float GetOldChannelGain(int channel) const override;
153 void SetOldChannelGain(int channel, float gain) override;
154
155 int GetWaveColorIndex() const { return mWaveColorIndex; };
156 void SetWaveColorIndex(int colorIndex);
157
158 sampleCount GetPlaySamplesCount() const;
159 sampleCount GetSequenceSamplesCount() const;
160
161 sampleFormat GetSampleFormat() const override { return mFormat; }
162
163 void ConvertToSampleFormat(sampleFormat format,
164 const std::function<void(size_t)> & progressReport = {});
165
166 const SpectrogramSettings &GetSpectrogramSettings() const;
167 SpectrogramSettings &GetSpectrogramSettings();
168 SpectrogramSettings &GetIndependentSpectrogramSettings();
169 void SetSpectrogramSettings(std::unique_ptr<SpectrogramSettings> &&pSettings);
170
171 const WaveformSettings &GetWaveformSettings() const;
172 WaveformSettings &GetWaveformSettings();
173 void SetWaveformSettings(std::unique_ptr<WaveformSettings> &&pSettings);
174 void UseSpectralPrefs( bool bUse=true );
175 //
176 // High-level editing
177 //
178
179 Track::Holder Cut(double t0, double t1) override;
180
183
192 Holder EmptyCopy(const SampleBlockFactoryPtr &pFactory = {},
193 bool keepLink = true) const;
194
195 // If forClipboard is true,
196 // and there is no clip at the end time of the selection, then the result
197 // will contain a "placeholder" clip whose only purpose is to make
198 // GetEndTime() correct. This clip is not re-copied when pasting.
199 Track::Holder Copy(double t0, double t1, bool forClipboard = true) const override;
200 Track::Holder CopyNonconst(double t0, double t1) /* not override */;
201
202 void Clear(double t0, double t1) override;
203 void Paste(double t0, const Track *src) override;
204 // May assume precondition: t0 <= t1
205 void ClearAndPaste(double t0, double t1,
206 const Track *src,
207 bool preserve = true,
208 bool merge = true,
209 const TimeWarper *effectWarper = NULL) /* not override */;
210
211 void Silence(double t0, double t1) override;
212 void InsertSilence(double t, double len) override;
213
214 void SplitAt(double t) /* not override */;
215 void Split(double t0, double t1) /* not override */;
216 // Track::Holder CutAndAddCutLine(double t0, double t1) /* not override */;
217 // May assume precondition: t0 <= t1
218 void ClearAndAddCutLine(double t0, double t1) /* not override */;
219
220 Track::Holder SplitCut(double t0, double t1) /* not override */;
221 // May assume precondition: t0 <= t1
222 void SplitDelete(double t0, double t1) /* not override */;
223 void Join(double t0, double t1) /* not override */;
224 // May assume precondition: t0 <= t1
225 void Disjoin(double t0, double t1) /* not override */;
226
227 // May assume precondition: t0 <= t1
228 void Trim(double t0, double t1) /* not override */;
229
230 // May assume precondition: t0 <= t1
231 void HandleClear(double t0, double t1, bool addCutLines, bool split);
232
233 void SyncLockAdjust(double oldT1, double newT1) override;
234
240 bool IsEmpty(double t0, double t1) const;
241
242 /*
243 * If there is an existing WaveClip in the WaveTrack then the data is
244 * appended to that clip. If there are no WaveClips in the track, then a NEW
245 * one is created.
246 *
247 */
249 size_t len, unsigned int stride=1) override;
250 void Flush() override;
251
262
263 bool Get(samplePtr buffer, sampleFormat format,
264 sampleCount start, size_t len,
265 fillFormat fill = fillZero,
266 bool mayThrow = true,
267 // Report how many samples were copied from within clips, rather than
268 // filled according to fillFormat; but these were not necessarily one
269 // contiguous range.
270 sampleCount * pNumWithinClips = nullptr) const override;
271 void Set(constSamplePtr buffer, sampleFormat format,
272 sampleCount start, size_t len);
273
274 void GetEnvelopeValues(double *buffer, size_t bufferLen,
275 double t0) const override;
276
277 // May assume precondition: t0 <= t1
278 std::pair<float, float> GetMinMax(
279 double t0, double t1, bool mayThrow = true) const;
280 // May assume precondition: t0 <= t1
281 float GetRMS(double t0, double t1, bool mayThrow = true) const;
282
283 //
284 // MM: We now have more than one sequence and envelope per track, so
285 // instead of GetSequence() and GetEnvelope() we have the following
286 // function which give the sequence and envelope which contains the given
287 // time.
288 //
289 Sequence* GetSequenceAtTime(double time);
290 Envelope* GetEnvelopeAtTime(double time);
291
292 WaveClip* GetClipAtSample(sampleCount sample);
293 WaveClip* GetClipAtTime(double time);
294
295 //
296 // Getting information about the track's internal block sizes
297 // and alignment for efficiency
298 //
299
300 sampleCount GetBlockStart(sampleCount t) const override;
301
302 // These return a nonnegative number of samples meant to size a memory buffer
303 size_t GetBestBlockSize(sampleCount t) const override;
304 size_t GetMaxBlockSize() const override;
305 size_t GetIdealBlockSize();
306
307 //
308 // XMLTagHandler callback methods for loading and saving
309 //
310
311 bool HandleXMLTag(const std::string_view& tag, const AttributesList& attrs) override;
312 void HandleXMLEndTag(const std::string_view& tag) override;
313 XMLTagHandler *HandleXMLChild(const std::string_view& tag) override;
314 void WriteXML(XMLWriter &xmlFile) const override;
315
316 // Returns true if an error occurred while reading from XML
317 bool GetErrorOpening() override;
318
319 //
320 // Lock and unlock the track: you must lock the track before
321 // doing a copy and paste between projects.
322 //
323
324 bool CloseLock(); //should be called when the project closes.
325 // not balanced by unlocking calls.
326
327 // Get access to the (visible) clips in the tracks, in unspecified order
328 // (not necessarily sequenced in time).
329 WaveClipHolders &GetClips() { return mClips; }
331 { return reinterpret_cast< const WaveClipConstHolders& >( mClips ); }
332
333 // Get mutative access to all clips (in some unspecified sequence),
334 // including those hidden in cutlines.
336 : public ValueIterator< WaveClip * >
337 {
338 public:
339 // Constructs an "end" iterator
341
342 // Construct a "begin" iterator
343 explicit AllClipsIterator( WaveTrack &track )
344 {
345 push( track.mClips );
346 }
347
349 {
350 if (mStack.empty())
351 return nullptr;
352 else
353 return mStack.back().first->get();
354 }
355
356 AllClipsIterator &operator ++ ();
357
358 // Define == well enough to serve for loop termination test
359 friend bool operator == (
360 const AllClipsIterator &a, const AllClipsIterator &b)
361 { return a.mStack.empty() == b.mStack.empty(); }
362
363 friend bool operator != (
364 const AllClipsIterator &a, const AllClipsIterator &b)
365 { return !( a == b ); }
366
367 private:
368
369 void push( WaveClipHolders &clips );
370
371 using Iterator = WaveClipHolders::iterator;
372 using Pair = std::pair< Iterator, Iterator >;
373 using Stack = std::vector< Pair >;
374
376 };
377
378 // Get const access to all clips (in some unspecified sequence),
379 // including those hidden in cutlines.
381 : public ValueIterator< const WaveClip * >
382 {
383 public:
384 // Constructs an "end" iterator
386
387 // Construct a "begin" iterator
388 explicit AllClipsConstIterator( const WaveTrack &track )
389 : mIter{ const_cast< WaveTrack& >( track ) }
390 {}
391
392 const WaveClip *operator * () const
393 { return *mIter; }
394
395 AllClipsConstIterator &operator ++ ()
396 { ++mIter; return *this; }
397
398 // Define == well enough to serve for loop termination test
399 friend bool operator == (
401 { return a.mIter == b.mIter; }
402
403 friend bool operator != (
405 { return !( a == b ); }
406
407 private:
409 };
410
412 {
413 return { AllClipsIterator{ *this }, AllClipsIterator{ } };
414 }
415
417 {
418 return { AllClipsConstIterator{ *this }, AllClipsConstIterator{ } };
419 }
420
421 // Create NEW clip and add it to this track. Returns a pointer
422 // to the newly created clip. Optionally initial offset and
423 // clip name may be provided
424 WaveClip* CreateClip(double offset = .0, const wxString& name = wxEmptyString);
425
431 WaveClip* NewestOrNewClip();
432
438 WaveClip* RightmostOrNewClip();
439
440 // Get the linear index of a given clip (-1 if the clip is not found)
441 int GetClipIndex(const WaveClip* clip) const;
442
443 // Get the nth clip in this WaveTrack (will return NULL if not found).
444 // Use this only in special cases (like getting the linked clip), because
445 // it is much slower than GetClipIterator().
446 WaveClip *GetClipByIndex(int index);
447 const WaveClip* GetClipByIndex(int index) const;
448
449 // Get number of clips in this WaveTrack
450 int GetNumClips() const;
451
452 // Add all wave clips to the given array 'clips' and sort the array by
453 // clip start time. The array is emptied prior to adding the clips.
454 WaveClipPointers SortedClipArray();
455 WaveClipConstPointers SortedClipArray() const;
456
458
461 bool CanOffsetClips(
462 const std::vector<WaveClip*> &clips,
463 double amount,
464 double *allowedAmount = nullptr
466 );
467
468 // Before moving a clip into a track (or inserting a clip), use this
469 // function to see if the times are valid (i.e. don't overlap with
470 // existing clips).
471 bool CanInsertClip(WaveClip* clip, double &slideBy, double &tolerance) const;
472
473 // Remove the clip from the track and return a SMART pointer to it.
474 // You assume responsibility for its memory!
475 std::shared_ptr<WaveClip> RemoveAndReturnClip(WaveClip* clip);
476
478 bool AddClip(const std::shared_ptr<WaveClip> &clip);
479
480 // Merge two clips, that is append data from clip2 to clip1,
481 // then remove clip2 from track.
482 // clipidx1 and clipidx2 are indices into the clip list.
483 void MergeClips(int clipidx1, int clipidx2);
484
485 // Cache special locations (e.g. cut lines) for later speedy access
486 void UpdateLocationsCache() const;
487
488 // Get cached locations
489 const std::vector<Location> &GetCachedLocations() const { return mDisplayLocationsCache; }
490
491 // Expand cut line (that is, re-insert audio, then DELETE audio saved in cut line)
492 void ExpandCutLine(double cutLinePosition, double* cutlineStart = NULL, double* cutlineEnd = NULL);
493
494 // Remove cut line, without expanding the audio in it
495 bool RemoveCutLine(double cutLinePosition);
496
497 // This track has been merged into a stereo track. Copy shared parameters
498 // from the NEW partner.
499 void Merge(const Track &orig) override;
500
501 // Resample track (i.e. all clips in the track)
502 void Resample(int rate, BasicUI::ProgressDialog *progress = NULL);
503
504 const TypeInfo &GetTypeInfo() const override;
505 static const TypeInfo &ClassTypeInfo();
506
507 int GetLastScaleType() const { return mLastScaleType; }
508 void SetLastScaleType() const;
509
510 int GetLastdBRange() const { return mLastdBRange; }
511 void SetLastdBRange() const;
512
513 void GetDisplayBounds(float *min, float *max) const;
514 void SetDisplayBounds(float min, float max) const;
515 void GetSpectrumBounds(float *min, float *max) const;
516 void SetSpectrumBounds(float min, float max) const;
517
518 // For display purposes, calculate the y coordinate where the midline of
519 // the wave should be drawn, if display minimum and maximum map to the
520 // bottom and top. Maybe that is out of bounds.
521 int ZeroLevelYCoordinate(wxRect rect) const;
522
523 class IntervalData final : public Track::IntervalData {
524 public:
525 explicit IntervalData( const std::shared_ptr<WaveClip> &pClip )
526 : pClip{ pClip }
527 {}
528 std::shared_ptr<const WaveClip> GetClip() const { return pClip; }
529 std::shared_ptr<WaveClip> &GetClip() { return pClip; }
530 private:
531 std::shared_ptr<WaveClip> pClip;
532 };
533
534 Track::Holder PasteInto( AudacityProject & ) const override;
535
536 ConstIntervals GetIntervals() const override;
537 Intervals GetIntervals() override;
538
540 const WaveClip* FindClipByName(const wxString& name) const;
541 protected:
542 //
543 // Protected variables
544 //
545
547
549 int mRate;
551 std::atomic<float> mGain{ 1.0f };
553 std::atomic<float> mPan{ 0.0f };
556 float mOldGain[2];
557
558
559 //
560 // Data that should be part of GUIWaveTrack
561 // and will be taken out of the WaveTrack class:
562 //
563 mutable float mDisplayMin;
564 mutable float mDisplayMax;
565 mutable float mSpectrumMin;
566 mutable float mSpectrumMax;
567
568 mutable int mLastScaleType; // last scale type choice
569 mutable int mLastdBRange;
570 mutable std::vector <Location> mDisplayLocationsCache;
571
572private:
573 void DoSetPan(float value);
574 void DoSetGain(float value);
575
576 void PasteWaveTrack(double t0, const WaveTrack* other);
577
579
580 wxCriticalSection mFlushCriticalSection;
581 wxCriticalSection mAppendCriticalSection;
583
584 std::unique_ptr<SpectrogramSettings> mpSpectrumSettings;
585 std::unique_ptr<WaveformSettings> mpWaveformSettings;
586};
587
589
590#include <unordered_set>
591class SampleBlock;
592using SampleBlockID = long long;
593using SampleBlockIDSet = std::unordered_set<SampleBlockID>;
594class TrackList;
595using BlockVisitor = std::function< void(SampleBlock&) >;
596using BlockInspector = std::function< void(const SampleBlock&) >;
597
598// Function to visit all sample blocks from a list of tracks.
599// If a set is supplied, then only visit once each unique block ID not already
600// in that set, and accumulate those into the set as a side-effect.
601// The visitor function may be null.
602void VisitBlocks(TrackList &tracks, BlockVisitor visitor,
603 SampleBlockIDSet *pIDs = nullptr);
604
605// Non-mutating version of the above
606void InspectBlocks(const TrackList &tracks,
607 BlockInspector inspector, SampleBlockIDSet *pIDs = nullptr);
608
609class ProjectRate;
610
611class AUDACITY_DLL_API WaveTrackFactory final
612 : public ClientData::Base
613{
614 public:
615 static WaveTrackFactory &Get( AudacityProject &project );
616 static const WaveTrackFactory &Get( const AudacityProject &project );
617 static WaveTrackFactory &Reset( AudacityProject &project );
618 static void Destroy( AudacityProject &project );
619
621 const ProjectRate& rate,
622 const SampleBlockFactoryPtr &pFactory)
623 : mRate{ rate }
624 , mpFactory(pFactory)
625 {
626 }
627 WaveTrackFactory( const WaveTrackFactory & ) PROHIBITED;
629
631 { return mpFactory; }
632
637 std::shared_ptr<WaveTrack> Create();
638
645 std::shared_ptr<WaveTrack> Create(sampleFormat format, double rate);
646
647 private:
650};
651
652extern AUDACITY_DLL_API BoolSetting
654;
655
656extern AUDACITY_DLL_API StringSetting AudioTrackNameSetting;
657
658AUDACITY_DLL_API bool GetEditClipsCanMove();
659
660// Generate a registry for serialized data
661#include "XMLMethodRegistry.h"
664
665#endif // __AUDACITY_WAVETRACK__
int min(int a, int b)
const TranslatableString name
Definition: Distortion.cpp:82
int format
Definition: ExportPCM.cpp:56
Vector operator*(const Vector &left, const Vector &right)
Definition: Matrix.cpp:153
long long SampleBlockID
Definition: ProjectFileIO.h:41
std::shared_ptr< SampleBlockFactory > SampleBlockFactoryPtr
Definition: SampleBlock.h:28
sampleFormat
Definition: SampleFormat.h:29
char * samplePtr
Definition: SampleFormat.h:49
const char * constSamplePtr
Definition: SampleFormat.h:50
fillFormat
Definition: SampleFormat.h:53
@ fillZero
Definition: SampleFormat.h:54
bool operator<(SnapPoint s1, SnapPoint s2)
Definition: Snap.cpp:23
bool operator==(const Tags &lhs, const Tags &rhs)
Definition: Tags.cpp:332
bool operator!=(const Tags &lhs, const Tags &rhs)
Definition: Tags.h:133
std::shared_ptr< WaveClip > WaveClipHolder
Definition: WaveClip.h:41
std::vector< WaveClipHolder > WaveClipHolders
Definition: WaveClip.h:42
std::vector< std::shared_ptr< const WaveClip > > WaveClipConstHolders
Definition: WaveClip.h:43
std::function< void(SampleBlock &) > BlockVisitor
Definition: WaveTrack.h:595
DECLARE_XML_METHOD_REGISTRY(AUDACITY_DLL_API, WaveTrackIORegistry)
AUDACITY_DLL_API StringSetting AudioTrackNameSetting
Definition: WaveTrack.cpp:2840
void VisitBlocks(TrackList &tracks, BlockVisitor visitor, SampleBlockIDSet *pIDs=nullptr)
Definition: WaveTrack.cpp:2760
AUDACITY_DLL_API BoolSetting EditClipsCanMove
Definition: WaveTrack.cpp:2860
void InspectBlocks(const TrackList &tracks, BlockInspector inspector, SampleBlockIDSet *pIDs=nullptr)
Definition: WaveTrack.cpp:2781
AUDACITY_DLL_API bool GetEditClipsCanMove()
Definition: WaveTrack.cpp:2850
std::unordered_set< SampleBlockID > SampleBlockIDSet
Definition: WaveTrack.h:593
ENUMERATE_TRACK_TYPE(WaveTrack)
std::function< void(const SampleBlock &) > BlockInspector
Definition: WaveTrack.h:596
std::vector< WaveClip * > WaveClipPointers
Definition: WaveTrack.h:46
std::vector< const WaveClip * > WaveClipConstPointers
Definition: WaveTrack.h:47
std::vector< Attribute > AttributesList
Definition: XMLTagHandler.h:40
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:89
Abstraction of a progress dialog with well defined time-to-completion estimate.
Definition: BasicUI.h:154
This specialization of Setting for bool adds a Toggle method to negate the saved value.
Definition: Prefs.h:339
Piecewise linear or piecewise exponential function from double to double.
Definition: Envelope.h:72
void Init(const PlayableTrack &init)
Definition: Track.cpp:322
void Merge(const Track &init) override
Definition: Track.cpp:329
ProgressDialog Class.
Holds project sample rate.
Definition: ProjectRate.h:24
Interface to libsoxr.
Definition: Resample.h:27
abstract base class with methods to produce SampleBlock objects
Definition: SampleBlock.h:110
Abstract class allows access to contents of a block of sound samples, serialization as XML,...
Definition: SampleBlock.h:44
virtual double GetRate() const =0
virtual float GetChannelGain(int channel) const =0
Takes gain and pan into account.
virtual bool Get(samplePtr buffer, sampleFormat format, sampleCount start, size_t len, fillFormat fill=fillZero, bool mayThrow=true, sampleCount *pNumWithinClips=nullptr) const =0
Retrieve samples from a track in a specified format.
virtual void GetEnvelopeValues(double *buffer, size_t bufferLen, double t0) const =0
Fetch envelope values corresponding to uniformly separated sample times starting at the given time.
virtual size_t GetMaxBlockSize() const =0
This returns a nonnegative number of samples meant to size a memory buffer.
virtual sampleCount GetBlockStart(sampleCount t) const =0
This returns a possibly large or negative value.
virtual float GetOldChannelGain(int channel) const =0
virtual size_t GetBestBlockSize(sampleCount t) const =0
This returns a nonnegative number of samples meant to size a memory buffer.
virtual ChannelType GetChannelIgnoringPan() const =0
A WaveTrack contains WaveClip(s). A WaveClip contains a Sequence. A Sequence is primarily an interfac...
Definition: Sequence.h:61
Spectrogram settings, either for one track or as defaults.
Specialization of Setting for strings.
Definition: Prefs.h:363
Transforms one point in time to another point. For example, a time stretching effect might use one to...
Definition: TimeWarper.h:62
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:225
virtual void SetPan(float)
Definition: Track.h:485
virtual void SetOffset(double o)
Definition: Track.h:483
virtual void Paste(double WXUNUSED(t), const Track *WXUNUSED(src))=0
virtual Holder Cut(double WXUNUSED(t0), double WXUNUSED(t1))=0
virtual Holder PasteInto(AudacityProject &) const =0
Find or create the destination track for a paste, maybe in a different project.
virtual void Clear(double WXUNUSED(t0), double WXUNUSED(t1))=0
ChannelType
Definition: Track.h:281
virtual double GetStartTime() const =0
virtual Holder Clone() const =0
virtual void SyncLockAdjust(double oldT1, double newT1)
Definition: Track.cpp:285
virtual Holder Copy(double WXUNUSED(t0), double WXUNUSED(t1), bool forClipboard=true) const =0
virtual bool LinkConsistencyFix(bool doFix=true, bool completeList=true)
Check consistency of channel groups, and maybe fix it.
Definition: Track.cpp:424
std::shared_ptr< Track > Holder
Definition: Track.h:368
virtual void SetPanFromChannelType()
Definition: Track.h:486
virtual ConstIntervals GetIntervals() const
Report times on the track where important intervals begin and end, for UI to snap to.
Definition: Track.cpp:1259
virtual void WriteXML(XMLWriter &xmlFile) const =0
virtual void Silence(double WXUNUSED(t0), double WXUNUSED(t1))=0
virtual ChannelType GetChannel() const
Definition: Track.h:479
virtual double GetOffset() const =0
virtual double GetEndTime() const =0
std::vector< Interval > Intervals
Definition: Track.h:335
virtual void InsertSilence(double WXUNUSED(t), double WXUNUSED(len))=0
virtual bool GetErrorOpening()
Definition: Track.h:864
std::vector< ConstInterval > ConstIntervals
Definition: Track.h:337
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition: Track.h:1336
This allows multiple clips to be a part of one WaveTrack.
Definition: WaveClip.h:101
AllClipsConstIterator(const WaveTrack &track)
Definition: WaveTrack.h:388
std::pair< Iterator, Iterator > Pair
Definition: WaveTrack.h:372
std::vector< Pair > Stack
Definition: WaveTrack.h:373
WaveClipHolders::iterator Iterator
Definition: WaveTrack.h:371
AllClipsIterator(WaveTrack &track)
Definition: WaveTrack.h:343
std::shared_ptr< WaveClip > pClip
Definition: WaveTrack.h:531
IntervalData(const std::shared_ptr< WaveClip > &pClip)
Definition: WaveTrack.h:525
std::shared_ptr< WaveClip > & GetClip()
Definition: WaveTrack.h:529
std::shared_ptr< const WaveClip > GetClip() const
Definition: WaveTrack.h:528
Used to create or clone a WaveTrack, with appropriate context from the project that will own the trac...
Definition: WaveTrack.h:613
WaveTrackFactory(const WaveTrackFactory &) PROHIBITED
const SampleBlockFactoryPtr & GetSampleBlockFactory() const
Definition: WaveTrack.h:630
SampleBlockFactoryPtr mpFactory
Definition: WaveTrack.h:649
WaveTrackFactory(const ProjectRate &rate, const SampleBlockFactoryPtr &pFactory)
Definition: WaveTrack.h:620
const ProjectRate & mRate
Definition: WaveTrack.h:648
WaveTrackFactory & operator=(const WaveTrackFactory &) PROHIBITED
A Track that contains audio waveform data.
Definition: WaveTrack.h:57
SampleBlockFactoryPtr mpFactory
Definition: WaveTrack.h:578
float mDisplayMin
Definition: WaveTrack.h:563
std::vector< Region > Regions
Definition: WaveTrack.h:75
sampleFormat mFormat
Definition: WaveTrack.h:548
wxCriticalSection mFlushCriticalSection
Definition: WaveTrack.h:580
int GetWaveColorIndex() const
Definition: WaveTrack.h:155
sampleFormat GetSampleFormat() const override
Definition: WaveTrack.h:161
IteratorRange< AllClipsConstIterator > GetAllClips() const
Definition: WaveTrack.h:416
float mSpectrumMin
Definition: WaveTrack.h:565
IteratorRange< AllClipsIterator > GetAllClips()
Definition: WaveTrack.h:411
int mLastScaleType
Definition: WaveTrack.h:568
WaveTrackLocation Location
Definition: WaveTrack.h:105
std::vector< Location > mDisplayLocationsCache
Definition: WaveTrack.h:570
const std::vector< Location > & GetCachedLocations() const
Definition: WaveTrack.h:489
float mDisplayMax
Definition: WaveTrack.h:564
int mLastdBRange
Definition: WaveTrack.h:569
const WaveClipConstHolders & GetClips() const
Definition: WaveTrack.h:330
float mSpectrumMax
Definition: WaveTrack.h:566
std::unique_ptr< SpectrogramSettings > mpSpectrumSettings
Definition: WaveTrack.h:584
WaveClipHolders & GetClips()
Definition: WaveTrack.h:329
int GetLastScaleType() const
Definition: WaveTrack.h:507
int mWaveColorIndex
Definition: WaveTrack.h:554
double mLegacyProjectFileOffset
Definition: WaveTrack.h:582
int mRate
Definition: WaveTrack.h:549
std::shared_ptr< WaveTrack > Holder
Definition: WaveTrack.h:106
wxCriticalSection mAppendCriticalSection
Definition: WaveTrack.h:581
WaveClipHolders mClips
Definition: WaveTrack.h:546
std::unique_ptr< WaveformSettings > mpWaveformSettings
Definition: WaveTrack.h:585
int GetLastdBRange() const
Definition: WaveTrack.h:510
Waveform settings, either for one track or as defaults.
virtual void Flush()=0
Flush must be called after last Append.
static const TypeInfo & ClassTypeInfo()
Definition: SampleTrack.cpp:70
virtual void SetOldChannelGain(int channel, float gain)=0
virtual bool Append(constSamplePtr buffer, sampleFormat format, size_t len, unsigned int stride=1)=0
Append the sample data to the track. You must call Flush() after the last Append.
const TypeInfo & GetTypeInfo() const override
Definition: SampleTrack.cpp:75
This class is an interface which should be implemented by classes which wish to be able to load and s...
Definition: XMLTagHandler.h:42
virtual XMLTagHandler * HandleXMLChild(const std::string_view &tag)=0
virtual void HandleXMLEndTag(const std::string_view &WXUNUSED(tag))
Definition: XMLTagHandler.h:59
virtual bool HandleXMLTag(const std::string_view &tag, const AttributesList &attrs)=0
Base class for XMLFileWriter and XMLStringWriter that provides the general functionality for creating...
Definition: XMLWriter.h:26
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:18
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Definition: PackedArray.h:159
std::vector< long > Split(const PluginRegistryVersion &regver)
A convenient default parameter for class template Site.
Definition: ClientData.h:28
A convenience for use with range-for.
Definition: MemoryX.h:252
Empty argument passed to some public constructors.
Definition: Track.h:232
Optional extra information about an interval, appropriate to a subtype of Track.
Definition: Track.h:172
A convenience for defining iterators that return rvalue types, so that they cooperate correctly with ...
Definition: MemoryX.h:238
Structure to hold region of a wavetrack and a comparison function for sortability.
Definition: WaveTrack.h:62
Region(double start_, double end_)
Definition: WaveTrack.h:64