Audacity 3.2.0
SampleTrack.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3Audacity: A Digital Audio Editor
4
5SampleTrack.cpp
6
7Paul Licameli split from WaveTrack.cpp
8
9**********************************************************************/
10
11#include "SampleTrack.h"
12
13#include <cmath>
14
15SampleTrack::SampleTrack() = default;
16
18 : PlayableTrack(other, std::move(a))
19{
20}
21
23
25{
26 static const Track::TypeInfo info{
27 { "sample", "sample", XO("Sample Track") },
29 return info;
30}
31
33{
34 return typeInfo();
35}
36
37auto SampleTrack::GetTypeInfo() const -> const TypeInfo &
38{
39 return typeInfo();
40}
41
43{
44 return sampleCount( floor(t0 * GetRate() + 0.5) );
45}
46
48{
49 return pos.as_double() / GetRate();
50}
51
53
56) : SampleTrack(other, std::move(a))
57{
58}
59
61
63{
64 static const Track::TypeInfo info{
65 { "writable-sample", "writable-sample", XO("Writable Sample Track") },
67 return info;
68}
69
71{
72 return typeInfo2();
73}
74
76{
77 return typeInfo2();
78}
#define XO(s)
Definition: Internat.h:31
static const Track::TypeInfo & typeInfo2()
Definition: SampleTrack.cpp:62
static const Track::TypeInfo & typeInfo()
Definition: SampleTrack.cpp:24
AudioTrack subclass that can also be audibly replayed by the program.
Definition: Track.h:916
static const TypeInfo & ClassTypeInfo()
Definition: Track.cpp:1322
virtual double GetRate() const =0
~SampleTrack() override
const TypeInfo & GetTypeInfo() const override
Definition: SampleTrack.cpp:37
static const TypeInfo & ClassTypeInfo()
Definition: SampleTrack.cpp:32
double LongSamplesToTime(sampleCount pos) const
Convert correctly between a number of samples and an (absolute) time in seconds.
Definition: SampleTrack.cpp:47
sampleCount TimeToLongSamples(double t0) const
Convert correctly between an (absolute) time in seconds and a number of samples.
Definition: SampleTrack.cpp:42
static const TypeInfo & ClassTypeInfo()
Definition: SampleTrack.cpp:70
const TypeInfo & GetTypeInfo() const override
Definition: SampleTrack.cpp:75
~WritableSampleTrack() override
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:18
double as_double() const
Definition: SampleCount.h:45
STL namespace.
Empty argument passed to some public constructors.
Definition: Track.h:232