Audacity 3.2.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
WaveChannelInterval Class Referencefinal

#include <WaveTrack.h>

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

Public Member Functions

 WaveChannelInterval (WaveClip &wideClip, WaveClip &narrowClip, size_t iChannel)
 Assume lifetime of this object nests in those of arguments. More...
 
 ~WaveChannelInterval () override
 
const WaveClipGetClip () const
 
const EnvelopeGetEnvelope () const
 
size_t GetChannelIndex () 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...
 
sampleCount GetVisibleSampleCount () const override
 
int GetRate () const override
 
double GetPlayStartTime () const override
 
double GetPlayEndTime () const override
 
sampleCount TimeToSamples (double time) const override
 
double GetStretchRatio () const override
 
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
 
int GetColourIndex () const
 
- 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 Member Functions

const WaveClipGetNarrowClip () const
 

Private Attributes

WaveClipmWideClip
 
WaveClipmNarrowClip
 
const size_t miChannel
 

Detailed Description

Definition at line 66 of file WaveTrack.h.

Constructor & Destructor Documentation

◆ WaveChannelInterval()

WaveChannelInterval::WaveChannelInterval ( WaveClip wideClip,
WaveClip narrowClip,
size_t  iChannel 
)
inline

Assume lifetime of this object nests in those of arguments.

Definition at line 72 of file WaveTrack.h.

73 : mWideClip{ wideClip }
74 , mNarrowClip{ narrowClip }
76 {}
WaveClip & mWideClip
Definition: WaveTrack.h:126
WaveClip & mNarrowClip
Definition: WaveTrack.h:127
const size_t miChannel
Definition: WaveTrack.h:128

◆ ~WaveChannelInterval()

WaveChannelInterval::~WaveChannelInterval ( )
overridedefault

Member Function Documentation

◆ End()

double WaveChannelInterval::End ( ) const

Definition at line 84 of file WaveTrack.cpp.

85{
87}
const WaveClip & GetNarrowClip() const
Definition: WaveTrack.h:124
double GetPlayEndTime() const override
Definition: WaveClip.cpp:1315

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

Here is the call graph for this function:

◆ GetAppendBuffer()

constSamplePtr WaveChannelInterval::GetAppendBuffer ( ) const

Definition at line 168 of file WaveTrack.cpp.

169{
170 // TODO wide wave tracks -- use miChannel
171 return GetNarrowClip().GetAppendBuffer(0);
172}
constSamplePtr GetAppendBuffer(size_t ii) const
Get one channel of the append buffer.
Definition: WaveClip.cpp:413

References WaveClip::GetAppendBuffer(), and GetNarrowClip().

Referenced by WaveClipWaveformCache::GetWaveDisplay().

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

◆ GetAppendBufferLen()

size_t WaveChannelInterval::GetAppendBufferLen ( ) const

Definition at line 174 of file WaveTrack.cpp.

175{
177}
size_t GetAppendBufferLen() const
Definition: WaveClip.cpp:268

References WaveClip::GetAppendBufferLen(), and GetNarrowClip().

Referenced by WaveClipWaveformCache::GetWaveDisplay().

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

◆ GetChannelIndex()

size_t WaveChannelInterval::GetChannelIndex ( ) const
inline

Definition at line 81 of file WaveTrack.h.

81{ return miChannel; }

Referenced by anonymous_namespace{SpectrumView.cpp}::DrawClipSpectrum(), WaveClipSpectrumCache::GetSpectrogram(), and WaveClipWaveformCache::GetWaveDisplay().

Here is the caller graph for this function:

◆ GetClip()

const WaveClip & WaveChannelInterval::GetClip ( ) const
inline

Definition at line 79 of file WaveTrack.h.

79{ return mWideClip; }

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

Here is the caller graph for this function:

◆ GetColourIndex()

int WaveChannelInterval::GetColourIndex ( ) const

Definition at line 179 of file WaveTrack.cpp.

180{
181 return GetNarrowClip().GetColourIndex();
182}
int GetColourIndex() const
Definition: WaveClip.h:203

References WaveClip::GetColourIndex(), and GetNarrowClip().

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

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

◆ GetEnvelope()

const Envelope & WaveChannelInterval::GetEnvelope ( ) const

Definition at line 97 of file WaveTrack.cpp.

98{
99 // Always the left clip's envelope
100 return *mWideClip.GetEnvelope();
101}
Envelope * GetEnvelope()
Definition: WaveClip.h:411

References WaveClip::GetEnvelope(), and mWideClip.

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:

◆ GetNarrowClip()

const WaveClip & WaveChannelInterval::GetNarrowClip ( ) const
inlineprivate

Definition at line 124 of file WaveTrack.h.

124{ return mNarrowClip; }

Referenced by End(), GetAppendBuffer(), GetAppendBufferLen(), GetColourIndex(), GetPlayEndTime(), GetPlayStartTime(), GetRate(), GetSamples(), GetSampleView(), GetSequence(), GetStretchRatio(), GetTrimLeft(), GetTrimRight(), GetVisibleSampleCount(), Intersects(), Start(), and TimeToSamples().

Here is the caller graph for this function:

◆ GetPlayEndTime()

double WaveChannelInterval::GetPlayEndTime ( ) const
overridevirtual

Implements ClipTimes.

Definition at line 118 of file WaveTrack.cpp.

119{
120 return GetNarrowClip().GetPlayEndTime();
121}

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

Here is the call graph for this function:

◆ GetPlayStartTime()

double WaveChannelInterval::GetPlayStartTime ( ) const
overridevirtual

Implements ClipTimes.

Definition at line 113 of file WaveTrack.cpp.

114{
116}
double GetPlayStartTime() const noexcept override
Definition: WaveClip.cpp:1305

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

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

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

◆ GetRate()

int WaveChannelInterval::GetRate ( ) const
overridevirtual

Implements ClipTimes.

Definition at line 108 of file WaveTrack.cpp.

109{
110 return GetNarrowClip().GetRate();
111}
int GetRate() const override
Definition: WaveClip.h:166

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

Referenced by SpecCache::CalculateOneSpectrum(), anonymous_namespace{SpectrumView.cpp}::DrawClipSpectrum(), anonymous_namespace{WaveformView.cpp}::DrawClipWaveform(), anonymous_namespace{WaveformView.cpp}::DrawIndividualSamples(), WaveClipSpectrumCache::GetSpectrogram(), WaveClipWaveformCache::GetWaveDisplay(), and SpecCache::Populate().

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

◆ GetSamples()

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

Definition at line 143 of file WaveTrack.cpp.

145{
146 // Not just a pass-through, but supply the first argument
147 // TODO wide wave tracks -- pass miChannel not 0
148 return GetNarrowClip().GetSamples(0, buffer, format, start, len, mayThrow);
149}
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:170

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

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 WaveChannelInterval::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 WaveTrack.cpp.

91{
92 constexpr auto iChannel = 0u;
93 // TODO wide wave tracks: use the real channel number.
94 return GetNarrowClip().GetSampleView(iChannel, t0, t1, mayThrow);
95}
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:147

References GetNarrowClip(), WaveClip::GetSampleView(), and anonymous_namespace{StretchingSequenceIntegrationTest.cpp}::iChannel.

Referenced by SpecCache::CalculateOneSpectrum().

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

◆ GetSampleView() [2/2]

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

Definition at line 151 of file WaveTrack.cpp.

153{
154 // Not just a pass-through, but supply the first argument
155 // TODO wide wave tracks -- pass miChannel not 0
156 return GetNarrowClip().GetSampleView(0, start, length, mayThrow);
157}

References GetNarrowClip(), and WaveClip::GetSampleView().

Here is the call graph for this function:

◆ GetSequence()

const Sequence & WaveChannelInterval::GetSequence ( ) const

Definition at line 159 of file WaveTrack.cpp.

160{
161 // TODO wide wave tracks -- use miChannel
162 const auto pSequence = GetNarrowClip().GetSequence(0);
163 // Assume sufficiently wide clip
164 assert(pSequence);
165 return *pSequence;
166}
Sequence * GetSequence(size_t ii)
Definition: WaveClip.h:431

References GetNarrowClip(), and WaveClip::GetSequence().

Referenced by SpecCache::CalculateOneSpectrum(), and WaveClipWaveformCache::GetWaveDisplay().

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

◆ GetStretchRatio()

double WaveChannelInterval::GetStretchRatio ( ) const
overridevirtual

Implements ClipTimes.

Definition at line 128 of file WaveTrack.cpp.

129{
131}
double GetStretchRatio() const override
Definition: WaveClip.cpp:348

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

Referenced by SpecCache::CalculateOneSpectrum(), anonymous_namespace{SpectrumView.cpp}::DrawClipSpectrum(), anonymous_namespace{WaveformView.cpp}::DrawClipWaveform(), anonymous_namespace{WaveformView.cpp}::DrawIndividualSamples(), WaveClipSpectrumCache::GetSpectrogram(), WaveClipWaveformCache::GetWaveDisplay(), and SpecCache::Populate().

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

◆ GetTrimLeft()

double WaveChannelInterval::GetTrimLeft ( ) const

Definition at line 133 of file WaveTrack.cpp.

134{
135 return GetNarrowClip().GetTrimLeft();
136}
double GetTrimLeft() const noexcept
Returns the play start offset in seconds from the beginning of the underlying sequence.
Definition: WaveClip.cpp:1358

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

Referenced by WaveClipSpectrumCache::GetSpectrogram(), and WaveClipWaveformCache::GetWaveDisplay().

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

◆ GetTrimRight()

double WaveChannelInterval::GetTrimRight ( ) const

Definition at line 138 of file WaveTrack.cpp.

139{
140 return GetNarrowClip().GetTrimRight();
141}
double GetTrimRight() const noexcept
Returns the play end offset in seconds from the ending of the underlying sequence.
Definition: WaveClip.cpp:1368

References GetNarrowClip(), 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 WaveChannelInterval::GetVisibleSampleCount ( ) const
overridevirtual

The number of raw audio samples not hidden by trimming.

Implements ClipTimes.

Definition at line 103 of file WaveTrack.cpp.

104{
106}
sampleCount GetVisibleSampleCount() const override
Definition: WaveClip.cpp:1347

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

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

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

◆ Intersects()

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

Definition at line 74 of file WaveTrack.cpp.

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

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

Here is the call graph for this function:

◆ Start()

double WaveChannelInterval::Start ( ) const

Definition at line 79 of file WaveTrack.cpp.

80{
82}

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

Here is the call graph for this function:

◆ TimeToSamples()

sampleCount WaveChannelInterval::TimeToSamples ( double  time) const
overridevirtual

Implements ClipTimes.

Definition at line 123 of file WaveTrack.cpp.

124{
125 return GetNarrowClip().TimeToSamples(time);
126}
sampleCount TimeToSamples(double time) const override
Definition: WaveClip.cpp:1275

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

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

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

Member Data Documentation

◆ miChannel

const size_t WaveChannelInterval::miChannel
private

Definition at line 128 of file WaveTrack.h.

◆ mNarrowClip

WaveClip& WaveChannelInterval::mNarrowClip
private

Definition at line 127 of file WaveTrack.h.

◆ mWideClip

WaveClip& WaveChannelInterval::mWideClip
private

Definition at line 126 of file WaveTrack.h.

Referenced by GetEnvelope().


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