Audacity 3.2.0
Public Member Functions | Private Attributes | Friends | List of all members
WaveClipChannel Class Reference

#include <WaveClip.h>

Inheritance diagram for WaveClipChannel:
[legend]
Collaboration diagram for WaveClipChannel:
[legend]

Public Member Functions

 WaveClipChannel (WaveClip &clip, size_t iChannel)
 
 ~WaveClipChannel () override
 
WaveClipGetClip ()
 
const WaveClipGetClip () const
 
size_t GetChannelIndex () const
 
EnvelopeGetEnvelope ()
 
const EnvelopeGetEnvelope () const
 
bool Intersects (double t0, double t1) const
 
double Start () const
 
double End () const
 
AudioSegmentSampleView GetSampleView (double t0, double t1, bool mayThrow) const
 Request interval samples within [t0, t1). t0 and t1 are truncated to the interval start and end. Stretching influences the number of samples fitting into [t0, t1), i.e., half as many for twice as large a stretch ratio, due to a larger spacing of the raw samples. The actual number of samples available from the returned view is queried through AudioSegmentSampleView::GetSampleCount(). More...
 
bool WithinPlayRegion (double t) const
 t ∈ [...) More...
 
double SamplesToTime (sampleCount s) const noexcept
 
bool HasPitchOrSpeed () const
 
double GetTrimLeft () const
 
double GetTrimRight () const
 
bool GetSamples (samplePtr buffer, sampleFormat format, sampleCount start, size_t len, bool mayThrow=true) const
 
AudioSegmentSampleView GetSampleView (sampleCount start, size_t length, bool mayThrow) const
 
const SequenceGetSequence () const
 
constSamplePtr GetAppendBuffer () const
 
size_t GetAppendBufferLen () const
 
const BlockArrayGetSequenceBlockArray () const
 
std::pair< float, float > GetMinMax (double t0, double t1, bool mayThrow) const
 
float GetRMS (double t0, double t1, bool mayThrow) const
 
sampleCount GetPlayStartSample () const
 Real start time of the clip, quantized to raw sample rate (track's rate) More...
 
sampleCount GetPlayEndSample () const
 Real end time of the clip, quantized to raw sample rate (track's rate) More...
 
void SetSamples (constSamplePtr buffer, sampleFormat format, sampleCount start, size_t len, sampleFormat effectiveFormat)
 
void WriteXML (XMLWriter &xmlFile) const
 
sampleCount GetVisibleSampleCount () const override
 
int GetRate () const override
 
double GetPlayStartTime () const override
 
double GetPlayEndTime () const override
 
double GetPlayDuration () const
 
sampleCount TimeToSamples (double time) const override
 
double GetStretchRatio () const override
 
- Public Member Functions inherited from ChannelInterval
virtual ~ChannelInterval ()
 
- Public Member Functions inherited from ClipTimes
virtual ~ClipTimes ()
 
virtual sampleCount GetVisibleSampleCount () const =0
 
virtual int GetRate () const =0
 
virtual double GetPlayStartTime () const =0
 
virtual double GetPlayEndTime () const =0
 
virtual sampleCount TimeToSamples (double time) const =0
 
virtual double GetStretchRatio () const =0
 

Private Attributes

WaveClipmClip
 
const size_t miChannel
 

Friends

bool operator== (const WaveClipChannel &a, const WaveClipChannel &b)
 
bool operator!= (const WaveClipChannel &a, const WaveClipChannel &b)
 

Detailed Description

Definition at line 85 of file WaveClip.h.

Constructor & Destructor Documentation

◆ WaveClipChannel()

WaveClipChannel::WaveClipChannel ( WaveClip clip,
size_t  iChannel 
)
inline

Definition at line 90 of file WaveClip.h.

◆ ~WaveClipChannel()

WaveClipChannel::~WaveClipChannel ( )
overridedefault

Member Function Documentation

◆ End()

double WaveClipChannel::End ( ) const

Definition at line 84 of file WaveClip.cpp.

85{
86 return GetClip().GetPlayEndTime();
87}
WaveClip & GetClip()
Definition: WaveClip.h:96
double GetPlayEndTime() const override
Definition: WaveClip.cpp:1772

References GetClip(), and WaveClip::GetPlayEndTime().

Here is the call graph for this function:

◆ GetAppendBuffer()

constSamplePtr WaveClipChannel::GetAppendBuffer ( ) const

Definition at line 135 of file WaveClip.cpp.

136{
138}
constSamplePtr GetAppendBuffer(size_t ii) const
Get one channel of the append buffer.
Definition: WaveClip.cpp:729

References WaveClip::GetAppendBuffer(), GetClip(), and miChannel.

Here is the call graph for this function:

◆ GetAppendBufferLen()

size_t WaveClipChannel::GetAppendBufferLen ( ) const

Definition at line 140 of file WaveClip.cpp.

141{
143}
size_t GetAppendBufferLen(size_t ii) const
Definition: WaveClip.cpp:423

References WaveClip::GetAppendBufferLen(), GetClip(), and miChannel.

Here is the call graph for this function:

◆ GetChannelIndex()

size_t WaveClipChannel::GetChannelIndex ( ) const
inline

Definition at line 99 of file WaveClip.h.

99{ return miChannel; }

Referenced by anonymous_namespace{SpectrumView.cpp}::DrawClipSpectrum(), anonymous_namespace{WaveformView.cpp}::DrawWaveform(), WaveChannelUtilities::GetFloatAtTime(), and WaveClipSpectrumCache::GetSpectrogram().

Here is the caller graph for this function:

◆ GetClip() [1/2]

WaveClip & WaveClipChannel::GetClip ( )
inline

◆ GetClip() [2/2]

const WaveClip & WaveClipChannel::GetClip ( ) const
inline

Definition at line 97 of file WaveClip.h.

97{ return mClip; }

◆ GetEnvelope() [1/2]

Envelope & WaveClipChannel::GetEnvelope ( )

Definition at line 64 of file WaveClip.cpp.

65{
66 return GetClip().GetEnvelope();
67}
Envelope & GetEnvelope() noexcept
Definition: WaveClip.h:553

References GetClip(), and WaveClip::GetEnvelope().

Referenced by anonymous_namespace{WaveformView.cpp}::DrawClipWaveform(), and anonymous_namespace{WaveformView.cpp}::DrawIndividualSamples().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetEnvelope() [2/2]

const Envelope & WaveClipChannel::GetEnvelope ( ) const

Definition at line 69 of file WaveClip.cpp.

70{
71 return GetClip().GetEnvelope();
72}

References GetClip(), and WaveClip::GetEnvelope().

Here is the call graph for this function:

◆ GetMinMax()

std::pair< float, float > WaveClipChannel::GetMinMax ( double  t0,
double  t1,
bool  mayThrow 
) const

Getting high-level data for one channel for screen display and clipping calculations and Contrast

Definition at line 151 of file WaveClip.cpp.

152{
153 return GetClip().GetMinMax(miChannel, t0, t1, mayThrow);
154}
std::pair< float, float > GetMinMax(size_t ii, double t0, double t1, bool mayThrow) const
Definition: WaveClip.cpp:740

References GetClip(), WaveClip::GetMinMax(), and miChannel.

Here is the call graph for this function:

◆ GetPlayDuration()

double WaveClipChannel::GetPlayDuration ( ) const

Definition at line 208 of file WaveClip.cpp.

209{
210 return GetPlayEndTime() - GetPlayStartTime();
211}
double GetPlayEndTime() const override
Definition: WaveClip.cpp:203
double GetPlayStartTime() const override
Definition: WaveClip.cpp:198

References GetPlayEndTime(), and GetPlayStartTime().

Referenced by anonymous_namespace{WaveChannelUtilities.cpp}::GetSampleAccessArgs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetPlayEndSample()

sampleCount WaveClipChannel::GetPlayEndSample ( ) const

Real end time of the clip, quantized to raw sample rate (track's rate)

Definition at line 166 of file WaveClip.cpp.

167{
168 return GetClip().GetPlayEndSample();
169}
sampleCount GetPlayEndSample() const
Real end time of the clip, quantized to raw sample rate (track's rate)
Definition: WaveClip.cpp:1799

References GetClip(), and WaveClip::GetPlayEndSample().

Here is the call graph for this function:

◆ GetPlayEndTime()

double WaveClipChannel::GetPlayEndTime ( ) const
overridevirtual

Implements ClipTimes.

Definition at line 203 of file WaveClip.cpp.

204{
205 return GetClip().GetPlayEndTime();
206}

References GetClip(), and WaveClip::GetPlayEndTime().

Referenced by GetPlayDuration().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetPlayStartSample()

sampleCount WaveClipChannel::GetPlayStartSample ( ) const

Real start time of the clip, quantized to raw sample rate (track's rate)

Definition at line 161 of file WaveClip.cpp.

162{
163 return GetClip().GetPlayStartSample();
164}
sampleCount GetPlayStartSample() const
Real start time of the clip, quantized to raw sample rate (track's rate)
Definition: WaveClip.cpp:1794

References GetClip(), and WaveClip::GetPlayStartSample().

Here is the call graph for this function:

◆ GetPlayStartTime()

double WaveClipChannel::GetPlayStartTime ( ) const
overridevirtual

Implements ClipTimes.

Definition at line 198 of file WaveClip.cpp.

199{
200 return GetClip().GetPlayStartTime();
201}
double GetPlayStartTime() const noexcept override
Definition: WaveClip.cpp:1762

References GetClip(), and WaveClip::GetPlayStartTime().

Referenced by WaveChannelUtilities::CompareClipsByPlayStartTime(), anonymous_namespace{SpectrumView.cpp}::DrawClipSpectrum(), anonymous_namespace{WaveformView.cpp}::DrawClipWaveform(), anonymous_namespace{WaveformView.cpp}::DrawIndividualSamples(), WaveChannelUtilities::GetFloatAtTime(), GetPlayDuration(), anonymous_namespace{WaveChannelUtilities.cpp}::GetSampleAccessArgs(), anonymous_namespace{SpectrumView.cpp}::GetSelectedSampleIndices(), and anonymous_namespace{SampleHandle.cpp}::SampleResolutionTest().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetRate()

int WaveClipChannel::GetRate ( ) const
overridevirtual

Implements ClipTimes.

Definition at line 193 of file WaveClip.cpp.

194{
195 return GetClip().GetRate();
196}
int GetRate() const override
Definition: WaveClip.h:337

References GetClip(), and WaveClip::GetRate().

Referenced by SpecCache::CalculateOneSpectrum(), anonymous_namespace{SpectrumView.cpp}::DrawClipSpectrum(), anonymous_namespace{WaveformView.cpp}::DrawClipWaveform(), anonymous_namespace{WaveformView.cpp}::DrawIndividualSamples(), anonymous_namespace{WaveChannelUtilities.cpp}::GetSampleAccessArgs(), WaveClipSpectrumCache::GetSpectrogram(), SpecCache::Populate(), and anonymous_namespace{SampleHandle.cpp}::SampleResolutionTest().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetRMS()

float WaveClipChannel::GetRMS ( double  t0,
double  t1,
bool  mayThrow 
) const

Getting high-level data for one channel for screen display and clipping calculations and Contrast

Definition at line 156 of file WaveClip.cpp.

157{
158 return GetClip().GetRMS(miChannel, t0, t1, mayThrow);
159}
float GetRMS(size_t ii, double t0, double t1, bool mayThrow) const
Definition: WaveClip.cpp:764

References GetClip(), WaveClip::GetRMS(), and miChannel.

Here is the call graph for this function:

◆ GetSamples()

bool WaveClipChannel::GetSamples ( samplePtr  buffer,
sampleFormat  format,
sampleCount  start,
size_t  len,
bool  mayThrow = true 
) const

Definition at line 115 of file WaveClip.cpp.

117{
118 return GetClip().GetSamples(miChannel, buffer, format, start, len, mayThrow);
119}
bool GetSamples(size_t ii, samplePtr buffer, sampleFormat format, sampleCount start, size_t len, bool mayThrow=true) const
Get samples from one channel.
Definition: WaveClip.cpp:378

References anonymous_namespace{ExportPCM.cpp}::format, GetClip(), WaveClip::GetSamples(), and miChannel.

Referenced by anonymous_namespace{WaveformView.cpp}::DrawIndividualSamples().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSampleView() [1/2]

AudioSegmentSampleView WaveClipChannel::GetSampleView ( double  t0,
double  t1,
bool  mayThrow 
) const

Request interval samples within [t0, t1). t0 and t1 are truncated to the interval start and end. Stretching influences the number of samples fitting into [t0, t1), i.e., half as many for twice as large a stretch ratio, due to a larger spacing of the raw samples. The actual number of samples available from the returned view is queried through AudioSegmentSampleView::GetSampleCount().

Precondition
samples in [t0, t1) can be counted with size_t

Definition at line 90 of file WaveClip.cpp.

91{
92 return GetClip().GetSampleView(miChannel, t0, t1, mayThrow);
93}
AudioSegmentSampleView GetSampleView(size_t iChannel, sampleCount start, size_t length, bool mayThrow=true) const override
Request up to length samples. The actual number of samples available from the returned view is querie...
Definition: WaveClip.cpp:355

References GetClip(), WaveClip::GetSampleView(), and miChannel.

Referenced by SpecCache::CalculateOneSpectrum().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSampleView() [2/2]

AudioSegmentSampleView WaveClipChannel::GetSampleView ( sampleCount  start,
size_t  length,
bool  mayThrow 
) const

Definition at line 121 of file WaveClip.cpp.

123{
124 return GetClip().GetSampleView(miChannel, start, length, mayThrow);
125}

References GetClip(), WaveClip::GetSampleView(), and miChannel.

Here is the call graph for this function:

◆ GetSequence()

const Sequence & WaveClipChannel::GetSequence ( ) const

Definition at line 127 of file WaveClip.cpp.

128{
129 const auto pSequence = GetClip().GetSequence(miChannel);
130 // Assume sufficiently wide clip
131 assert(pSequence);
132 return *pSequence;
133}
Sequence * GetSequence(size_t ii)
Definition: WaveClip.h:571

References GetClip(), WaveClip::GetSequence(), and miChannel.

Referenced by SpecCache::CalculateOneSpectrum().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSequenceBlockArray()

const BlockArray * WaveClipChannel::GetSequenceBlockArray ( ) const

Definition at line 145 of file WaveClip.cpp.

146{
148}
const BlockArray * GetSequenceBlockArray(size_t ii) const
Definition: WaveClip.cpp:417

References GetClip(), WaveClip::GetSequenceBlockArray(), and miChannel.

Here is the call graph for this function:

◆ GetStretchRatio()

double WaveClipChannel::GetStretchRatio ( ) const
overridevirtual

Implements ClipTimes.

Definition at line 218 of file WaveClip.cpp.

219{
220 return GetClip().GetStretchRatio();
221}
double GetStretchRatio() const override
Definition: WaveClip.cpp:625

References GetClip(), and WaveClip::GetStretchRatio().

Referenced by SpecCache::CalculateOneSpectrum(), anonymous_namespace{SpectrumView.cpp}::DrawClipSpectrum(), anonymous_namespace{WaveformView.cpp}::DrawClipWaveform(), anonymous_namespace{WaveformView.cpp}::DrawIndividualSamples(), anonymous_namespace{WaveChannelUtilities.cpp}::GetSampleAccessArgs(), WaveClipSpectrumCache::GetSpectrogram(), SpecCache::Populate(), and anonymous_namespace{SampleHandle.cpp}::SampleResolutionTest().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetTrimLeft()

double WaveClipChannel::GetTrimLeft ( ) const

Definition at line 110 of file WaveClip.cpp.

111{
112 return GetClip().GetTrimLeft();
113}
double GetTrimLeft() const noexcept
Returns the play start offset in seconds from the beginning of the underlying sequence.
Definition: WaveClip.cpp:1815

References GetClip(), and WaveClip::GetTrimLeft().

Referenced by WaveClipSpectrumCache::GetSpectrogram().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetTrimRight()

double WaveClipChannel::GetTrimRight ( ) const

Definition at line 183 of file WaveClip.cpp.

184{
185 return GetClip().GetTrimRight();
186}
double GetTrimRight() const noexcept
Returns the play end offset in seconds from the ending of the underlying sequence.
Definition: WaveClip.cpp:1825

References GetClip(), and WaveClip::GetTrimRight().

Referenced by WaveClipSpectrumCache::GetSpectrogram().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetVisibleSampleCount()

sampleCount WaveClipChannel::GetVisibleSampleCount ( ) const
overridevirtual

The number of raw audio samples not hidden by trimming.

Implements ClipTimes.

Definition at line 188 of file WaveClip.cpp.

189{
191}
sampleCount GetVisibleSampleCount() const override
Definition: WaveClip.cpp:1804

References GetClip(), and WaveClip::GetVisibleSampleCount().

Referenced by anonymous_namespace{WaveformView.cpp}::DrawIndividualSamples(), anonymous_namespace{WaveChannelUtilities.cpp}::GetSampleAccessArgs(), and anonymous_namespace{SpectrumView.cpp}::GetSelectedSampleIndices().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HasPitchOrSpeed()

bool WaveClipChannel::HasPitchOrSpeed ( ) const

Definition at line 105 of file WaveClip.cpp.

106{
107 return GetClip().HasPitchOrSpeed();
108}
bool HasPitchOrSpeed() const
Definition: WaveClip.cpp:667

References GetClip(), and WaveClip::HasPitchOrSpeed().

Here is the call graph for this function:

◆ Intersects()

bool WaveClipChannel::Intersects ( double  t0,
double  t1 
) const

Definition at line 74 of file WaveClip.cpp.

75{
76 return GetClip().IntersectsPlayRegion(t0, t1);
77}
bool IntersectsPlayRegion(double t0, double t1) const
[t0, t1) ∩ [...) != ∅
Definition: WaveClip.cpp:1928

References GetClip(), and WaveClip::IntersectsPlayRegion().

Here is the call graph for this function:

◆ SamplesToTime()

double WaveClipChannel::SamplesToTime ( sampleCount  s) const
noexcept

Definition at line 100 of file WaveClip.cpp.

101{
102 return GetClip().SamplesToTime(s);
103}
double SamplesToTime(sampleCount s) const noexcept
Definition: WaveClip.cpp:1736

◆ SetSamples()

void WaveClipChannel::SetSamples ( constSamplePtr  buffer,
sampleFormat  format,
sampleCount  start,
size_t  len,
sampleFormat  effectiveFormat 
)
Parameters
startrelative to clip play start sample
Parameters
effectiveFormatMake the effective format of the data at least the minumum of this value and `format`. (Maybe wider, if merging with preexistent data.) If the data are later narrowed from stored format, but not narrower than the effective, then no dithering will occur.

Definition at line 171 of file WaveClip.cpp.

173{
175 buffer, format, start, len, effectiveFormat);
176}
void SetSamples(size_t ii, constSamplePtr buffer, sampleFormat format, sampleCount start, size_t len, sampleFormat effectiveFormat)
Definition: WaveClip.cpp:397

References anonymous_namespace{ExportPCM.cpp}::format, GetClip(), miChannel, and WaveClip::SetSamples().

Here is the call graph for this function:

◆ Start()

double WaveClipChannel::Start ( ) const

Definition at line 79 of file WaveClip.cpp.

80{
81 return GetClip().GetPlayStartTime();
82}

References GetClip(), and WaveClip::GetPlayStartTime().

Here is the call graph for this function:

◆ TimeToSamples()

sampleCount WaveClipChannel::TimeToSamples ( double  time) const
overridevirtual

Implements ClipTimes.

Definition at line 213 of file WaveClip.cpp.

214{
215 return GetClip().TimeToSamples(time);
216}
sampleCount TimeToSamples(double time) const override
Definition: WaveClip.cpp:1731

References GetClip(), and WaveClip::TimeToSamples().

Referenced by anonymous_namespace{SpectrumView.cpp}::GetSelectedSampleIndices().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ WithinPlayRegion()

bool WaveClipChannel::WithinPlayRegion ( double  t) const

t ∈ [...)

Definition at line 95 of file WaveClip.cpp.

96{
97 return GetClip().WithinPlayRegion(t);
98}
bool WithinPlayRegion(double t) const
t ∈ [...)
Definition: WaveClip.cpp:1909

References GetClip(), and WaveClip::WithinPlayRegion().

Here is the call graph for this function:

◆ WriteXML()

void WaveClipChannel::WriteXML ( XMLWriter xmlFile) const

Definition at line 178 of file WaveClip.cpp.

179{
180 GetClip().WriteXML(miChannel, xmlFile);
181}
void WriteXML(size_t ii, XMLWriter &xmlFile) const
Definition: WaveClip.cpp:1066

References GetClip(), miChannel, and WaveClip::WriteXML().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const WaveClipChannel a,
const WaveClipChannel b 
)
friend

Definition at line 188 of file WaveClip.h.

190 { return !(a == b); }

◆ operator==

bool operator== ( const WaveClipChannel a,
const WaveClipChannel b 
)
friend

Definition at line 185 of file WaveClip.h.

187 { return &a.mClip == &b.mClip && a.miChannel == b.miChannel; }

Member Data Documentation

◆ mClip

WaveClip& WaveClipChannel::mClip
private

Definition at line 193 of file WaveClip.h.

◆ miChannel

const size_t WaveClipChannel::miChannel
private

The documentation for this class was generated from the following files: