Audacity 3.2.0
SampleTrack.h
Go to the documentation of this file.
1/**********************************************************************
2
3Audacity: A Digital Audio Editor
4
5SampleTrack.h
6@brief abstract Track sub-type that maps times to sample values
7
8Paul Licameli split from WaveTrack.h
9
10**********************************************************************/
11
12#ifndef __AUDACITY_SAMPLE_TRACK__
13#define __AUDACITY_SAMPLE_TRACK__
14
15#include "AudioIOSequences.h"
16#include "PlayableTrack.h"
17#include "SampleCount.h"
18#include "SampleFormat.h"
19
20enum class sampleFormat : unsigned;
21
22class SampleTrack;
23
24class SAMPLE_TRACK_API SampleTrack /* not final */
25 : public PlayableTrack
26 , public PlayableSequence
27{
28public:
31 ~SampleTrack() override;
32
33 // Fix the otherwise ambiguous lookup of these virtual function names
36 using Track::IsLeader;
37
38 const TypeInfo &GetTypeInfo() const override;
39 static const TypeInfo &ClassTypeInfo();
40
41 virtual sampleFormat GetSampleFormat() const = 0;
42
44
46 bool GetFloats(float *buffer, sampleCount start, size_t len,
47 fillFormat fill = FillFormat::fillZero, bool mayThrow = true,
48 sampleCount * pNumWithinClips = nullptr) const
49 {
50 constexpr auto backwards = false;
51 return GetFloats(
52 0, 1, &buffer, start, len, backwards, fill, mayThrow, pNumWithinClips);
53 }
54};
55
57
58class SAMPLE_TRACK_API WritableSampleTrack /* not final */
59 : public SampleTrack
60 , public virtual RecordableSequence
61{
62public:
67
68 // Resolve lookup ambiguity
69 using Track::IsLeader;
70
71 // Needed to resolve ambiguity with WideSampleSequence::GetRate, when this
72 // abstract interface is used directly.
73 // Expect the concrete subclass to define a common override for them.
75
76 const TypeInfo &GetTypeInfo() const override;
77 static const TypeInfo &ClassTypeInfo();
78};
79
81
82#endif
Extends Track with notions of mute and solo setting.
sampleFormat
The ordering of these values with operator < agrees with the order of increasing bit width.
Definition: SampleFormat.h:30
enum FillFormat fillFormat
#define ENUMERATE_TRACK_TYPE(T)
Empty class which will have subclasses.
Definition: Track.h:68
double GetEndTime() const
Get the maximum of End() values of intervals, or 0 when none.
Definition: Channel.cpp:135
double GetStartTime() const
Get the minimum of Start() values of intervals, or 0 when none.
Definition: Channel.cpp:124
AudioTrack subclass that can also be audibly replayed by the program.
Definition: PlayableTrack.h:40
static const TypeInfo & ClassTypeInfo()
~SampleTrack() override
virtual sampleFormat GetSampleFormat() const =0
bool GetFloats(float *buffer, sampleCount start, size_t len, fillFormat fill=FillFormat::fillZero, bool mayThrow=true, sampleCount *pNumWithinClips=nullptr) const
"narrow" overload fetches first channel only
Definition: SampleTrack.h:46
virtual const TypeInfo & GetTypeInfo() const =0
bool IsLeader() const override
Definition: Track.cpp:298
bool GetFloats(size_t iChannel, size_t nBuffers, float *const buffers[], sampleCount start, size_t len, bool backwards=false, fillFormat fill=FillFormat::fillZero, bool mayThrow=true, sampleCount *pNumWithinClips=nullptr) const
~WritableSampleTrack() override
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:19
virtual double GetRate() const =0
Empty argument passed to some public constructors.
Definition: Track.h:130