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

#include <WaveTrack.h>

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

Public Member Functions

 WaveChannel (WaveTrack &owner)
 
 ~WaveChannel () override
 
WaveTrackGetTrack ()
 
const WaveTrackGetTrack () const
 
AudioGraph::ChannelType GetChannelType () const override
 Classify this channel. More...
 
size_t NChannels () const override
 A constant property. More...
 
float GetChannelGain (int channel) const override
 Takes gain and pan into account. More...
 
bool DoGet (size_t iChannel, size_t nBuffers, const samplePtr buffers[], sampleFormat format, sampleCount start, size_t len, bool backwards, fillFormat fill=FillFormat::fillZero, bool mayThrow=true, sampleCount *pNumWithinClips=nullptr) const override
 This fails if any clip overlapping the range has non-unit stretch ratio! More...
 
double GetStartTime () const override
 
double GetEndTime () const override
 
double GetRate () const override
 
bool HasTrivialEnvelope () const override
 
void GetEnvelopeValues (double *buffer, size_t bufferLen, double t0, bool backwards) const override
 
sampleFormat WidestEffectiveFormat () const override
 
ChannelGroupDoGetChannelGroup () const override
 Subclass must override. More...
 
std::shared_ptr< WaveClipChannelGetInterval (size_t iInterval)
 
std::shared_ptr< const WaveClipChannelGetInterval (size_t iInterval) const
 
IteratorRange< IntervalIterator< WaveClipChannel > > Intervals ()
 
IteratorRange< IntervalIterator< const WaveClipChannel > > Intervals () const
 
bool GetFloats (float *buffer, sampleCount start, size_t len, fillFormat fill=FillFormat::fillZero, bool mayThrow=true, sampleCount *pNumWithinClips=nullptr) const
 "narrow" overload fetches from the unique channel More...
 
ChannelSampleView GetSampleView (double t0, double t1, bool mayThrow) const
 Request channel samples within [t0, t1), not knowing in advance how many this will be. More...
 
bool Set (constSamplePtr buffer, sampleFormat format, sampleCount start, size_t len, sampleFormat effectiveFormat=widestSampleFormat)
 Random-access assignment of a range of samples. More...
 
bool SetFloats (const float *buffer, sampleCount start, size_t len, sampleFormat effectiveFormat=widestSampleFormat)
 Random-access assignment of a range of samples. More...
 
bool AppendBuffer (constSamplePtr buffer, sampleFormat format, size_t len, unsigned stride, sampleFormat effectiveFormat)
 
bool Append (constSamplePtr buffer, sampleFormat format, size_t len)
 
size_t GetBestBlockSize (sampleCount t) const
 A hint for sizing of well aligned fetches. More...
 
size_t GetIdealBlockSize ()
 A hint for sizing of well aligned fetches. More...
 
size_t GetMaxBlockSize () const
 
sampleFormat GetSampleFormat () const
 
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
 
- Public Member Functions inherited from Channel
virtual ~Channel ()
 
ChannelGroupGetChannelGroup ()
 Channel object's lifetime is assumed to be nested in its Track's. More...
 
const ChannelGroupGetChannelGroup () const
 Channel object's lifetime is assumed to be nested in its Track's. More...
 
size_t GetChannelIndex () const
 
size_t NIntervals () const
 Report the number of intervals. More...
 
template<typename IntervalType = Interval>
std::shared_ptr< IntervalType > GetInterval (size_t iInterval)
 Retrieve an interval, cast to the given type. More...
 
template<typename IntervalType = const Interval>
auto GetInterval (size_t iInterval) const -> std::enable_if_t< std::is_const_v< IntervalType >, std::shared_ptr< IntervalType > >
 
template<typename IntervalType = Interval>
IteratorRange< IntervalIterator< IntervalType > > Intervals ()
 Get range of intervals with mutative access. More...
 
template<typename IntervalType = const Interval>
auto Intervals () const -> std::enable_if_t< std::is_const_v< IntervalType >, IteratorRange< IntervalIterator< IntervalType > > >
 Get range of intervals with read-only access. More...
 
- Public Member Functions inherited from WideSampleSequence
virtual ~WideSampleSequence ()
 
virtual size_t NChannels () const =0
 A constant property. More...
 
virtual float GetChannelGain (int channel) const =0
 
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
 
virtual bool DoGet (size_t iChannel, size_t nBuffers, const samplePtr buffers[], sampleFormat format, sampleCount start, size_t len, bool backward, fillFormat fill=FillFormat::fillZero, bool mayThrow=true, sampleCount *pNumWithinClips=nullptr) const =0
 
virtual double GetStartTime () const =0
 
virtual double GetEndTime () const =0
 
virtual double GetRate () const =0
 
sampleCount TimeToLongSamples (double t0) const
 
double LongSamplesToTime (sampleCount pos) const
 
double SnapToSample (double t) const
 
virtual sampleFormat WidestEffectiveFormat () const =0
 
virtual bool HasTrivialEnvelope () const =0
 
virtual void GetEnvelopeValues (double *buffer, size_t bufferLen, double t0, bool backwards) const =0
 
- Public Member Functions inherited from AudioGraph::Channel
virtual ~Channel ()
 
virtual ChannelType GetChannelType () const =0
 Classify this channel. More...
 

Private Attributes

WaveTrackmOwner
 

Additional Inherited Members

- Public Types inherited from Channel
using Interval = ChannelInterval
 
virtual ChannelGroupDoGetChannelGroup () const =0
 Subclass must override. More...
 

Detailed Description

Definition at line 81 of file WaveTrack.h.

Constructor & Destructor Documentation

◆ WaveChannel()

WaveChannel::WaveChannel ( WaveTrack owner)
explicit

Definition at line 368 of file WaveTrack.cpp.

369 : mOwner{ owner }
370{
371}
WaveTrack & mOwner
Definition: WaveTrack.h:197

◆ ~WaveChannel()

WaveChannel::~WaveChannel ( )
overridedefault

Member Function Documentation

◆ Append()

bool WaveChannel::Append ( constSamplePtr  buffer,
sampleFormat  format,
size_t  len 
)

If there is an existing WaveClip in the WaveTrack that owns the channel, then the data are appended to that clip. If there are no WaveClips in the track, then a new one is created.

Returns
true if at least one complete block was created
Exception safety guarantee:
Partial – Some prefix (maybe none) of the buffer is appended, and no content already flushed to disk is lost.

Definition at line 2216 of file WaveTrack.cpp.

2218{
2219 const size_t iChannel = GetChannelIndex();
2220 return GetTrack()
2221 .Append(iChannel, buffer, format, len, 1, widestSampleFormat);
2222}
size_t GetChannelIndex() const
Definition: Channel.cpp:25
WaveTrack & GetTrack()
Definition: WaveTrack.h:840
bool Append(size_t iChannel, constSamplePtr buffer, sampleFormat format, size_t len, unsigned int stride=1, sampleFormat effectiveFormat=widestSampleFormat) override
Definition: WaveTrack.cpp:2227

References WaveTrack::Append(), anonymous_namespace{ExportPCM.cpp}::format, Channel::GetChannelIndex(), GetTrack(), anonymous_namespace{StretchingSequenceIntegrationTest.cpp}::iChannel, and widestSampleFormat.

Referenced by EffectEqualization::Task::AccumulateSamples(), WaveTrackSink::DoConsume(), TrackSpectrumTransformer::DoOutput(), EffectSBSMS::Process(), EffectPaulstretch::ProcessOne(), EffectChangeSpeed::ProcessOne(), and EffectTwoPassSimpleMono::ProcessOne().

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

◆ AppendBuffer()

bool WaveChannel::AppendBuffer ( constSamplePtr  buffer,
sampleFormat  format,
size_t  len,
unsigned  stride,
sampleFormat  effectiveFormat 
)
Exception safety guarantee:
Partial – Some prefix (maybe none) of the buffer is appended, and no content already flushed to disk is lost.

Definition at line 2205 of file WaveTrack.cpp.

2207{
2208 const size_t iChannel = GetChannelIndex();
2209 return GetTrack()
2210 .Append(iChannel, buffer, format, len, stride, effectiveFormat);
2211}

References WaveTrack::Append(), anonymous_namespace{ExportPCM.cpp}::format, Channel::GetChannelIndex(), GetTrack(), and anonymous_namespace{StretchingSequenceIntegrationTest.cpp}::iChannel.

Here is the call graph for this function:

◆ DoGet()

bool WaveChannel::DoGet ( size_t  iChannel,
size_t  nBuffers,
const samplePtr  buffers[],
sampleFormat  format,
sampleCount  start,
size_t  len,
bool  backwards,
fillFormat  fill = FillFormat::fillZero,
bool  mayThrow = true,
sampleCount pNumWithinClips = nullptr 
) const
overridevirtual

This fails if any clip overlapping the range has non-unit stretch ratio!

Implements WideSampleSequence.

Definition at line 2591 of file WaveTrack.cpp.

2595{
2596 // These two assertions still remain after the great wide wave track and clip
2597 // refactoring!
2598 assert(iChannel == 0);
2599 assert(nBuffers <= 1);
2600 return GetTrack().DoGet(GetChannelIndex(), std::min<size_t>(nBuffers, 1),
2601 buffers, format, start, len, backwards, fill, mayThrow, pNumWithinClips);
2602}
bool DoGet(size_t iChannel, size_t nBuffers, const samplePtr buffers[], sampleFormat format, sampleCount start, size_t len, bool backwards, fillFormat fill=FillFormat::fillZero, bool mayThrow=true, sampleCount *pNumWithinClips=nullptr) const override
This fails if any clip overlapping the range has non-unit stretch ratio!
Definition: WaveTrack.cpp:2609

References WaveTrack::DoGet(), anonymous_namespace{ExportPCM.cpp}::format, Channel::GetChannelIndex(), GetTrack(), and anonymous_namespace{StretchingSequenceIntegrationTest.cpp}::iChannel.

Here is the call graph for this function:

◆ DoGetChannelGroup()

ChannelGroup & WaveChannel::DoGetChannelGroup ( ) const
overridevirtual

Subclass must override.

Postcondition
result: for some ii less than result.NChannels(), this == result.GetChannel(ii).get()

Implements Channel.

Definition at line 731 of file WaveTrack.cpp.

732{
733 return mOwner;
734}

References mOwner.

Referenced by GetTrack().

Here is the caller graph for this function:

◆ GetBestBlockSize()

size_t WaveChannel::GetBestBlockSize ( sampleCount  t) const
inline

A hint for sizing of well aligned fetches.

Definition at line 850 of file WaveTrack.h.

850 {
851 return GetTrack().GetBestBlockSize(t);
852}
size_t GetBestBlockSize(sampleCount t) const
Definition: WaveTrack.cpp:2239

References WaveTrack::GetBestBlockSize(), and GetTrack().

Referenced by EffectNormalize::AnalyseTrackData(), TrackSpectrumTransformer::Process(), EffectChangeSpeed::ProcessOne(), EffectTwoPassSimpleMono::ProcessOne(), EffectNormalize::ProcessOne(), EffectLoudness::ProcessOne(), resampleCB(), VoiceKey::TestDirectionChanges(), VoiceKey::TestEnergy(), and VoiceKey::TestSignChanges().

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

◆ GetChannelGain()

float WaveChannel::GetChannelGain ( int  channel) const
overridevirtual

Takes gain and pan into account.

Implements WideSampleSequence.

Definition at line 860 of file WaveTrack.cpp.

861{
862 return GetTrack().GetChannelGain(channel);
863}
float GetChannelGain(int channel) const override
Takes gain and pan into account.
Definition: WaveTrack.cpp:865

References WaveTrack::GetChannelGain(), and GetTrack().

Here is the call graph for this function:

◆ GetChannelType()

AudioGraph::ChannelType WaveChannel::GetChannelType ( ) const
overridevirtual

Classify this channel.

Implements AudioGraph::Channel.

Definition at line 537 of file WaveTrack.cpp.

538{
539 if (GetTrack().Channels().size() == 1)
541 else if (GetChannelIndex() == 0)
543 else
544 // TODO: more-than-two-channels
546}

References Channel::GetChannelIndex(), GetTrack(), AudioGraph::LeftChannel, AudioGraph::MonoChannel, AudioGraph::RightChannel, and size.

Here is the call graph for this function:

◆ GetEndTime()

double WaveChannel::GetEndTime ( ) const
overridevirtual

Implements WideSampleSequence.

Definition at line 2581 of file WaveTrack.cpp.

2582{
2583 return GetTrack().GetEndTime();
2584}
double GetEndTime() const override
Implement WideSampleSequence.
Definition: WaveTrack.cpp:2586

References WaveTrack::GetEndTime(), and GetTrack().

Here is the call graph for this function:

◆ GetEnvelopeValues()

void WaveChannel::GetEnvelopeValues ( double *  buffer,
size_t  bufferLen,
double  t0,
bool  backwards 
) const
overridevirtual

Fetch envelope values corresponding to uniformly separated sample times starting at the given time

Parameters
backwardsif true, fetch values in reverse order, from t0 to t0 - bufferLen / rate

Implements WideSampleSequence.

Definition at line 2841 of file WaveTrack.cpp.

2843{
2844 return GetTrack().GetEnvelopeValues(buffer, bufferLen, t0, backwards);
2845}
void GetEnvelopeValues(double *buffer, size_t bufferLen, double t0, bool backwards) const override
Definition: WaveTrack.cpp:2847

References WaveTrack::GetEnvelopeValues(), and GetTrack().

Here is the call graph for this function:

◆ GetFloats() [1/2]

bool WaveChannel::GetFloats ( float *  buffer,
sampleCount  start,
size_t  len,
fillFormat  fill = FillFormat::fillZero,
bool  mayThrow = true,
sampleCount pNumWithinClips = nullptr 
) const
inline

"narrow" overload fetches from the unique channel

Definition at line 129 of file WaveTrack.h.

132 {
133 constexpr auto backwards = false;
134 return GetFloats(
135 0, 1, &buffer, start, len, backwards, fill, mayThrow, pNumWithinClips);
136 }
bool GetFloats(float *buffer, sampleCount start, size_t len, fillFormat fill=FillFormat::fillZero, bool mayThrow=true, sampleCount *pNumWithinClips=nullptr) const
"narrow" overload fetches from the unique channel
Definition: WaveTrack.h:129

References WideSampleSequence::GetFloats().

Referenced by EffectNormalize::AnalyseTrackData(), EffectAutoDuck::ApplyDuckFade(), VoiceKey::OffBackward(), VoiceKey::OffForward(), VoiceKey::OnBackward(), VoiceKey::OnForward(), TrackSpectrumTransformer::Process(), EffectPaulstretch::ProcessOne(), EffectChangeSpeed::ProcessOne(), EffectClickRemoval::ProcessOne(), EffectRepair::ProcessOne(), EffectFindClipping::ProcessOne(), EffectEqualization::ProcessOne(), EffectTwoPassSimpleMono::ProcessOne(), EffectNormalize::ProcessOne(), resampleCB(), SelectHandle::StartSnappingFreqSelection(), VoiceKey::TestDirectionChanges(), VoiceKey::TestEnergy(), and VoiceKey::TestSignChanges().

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

◆ GetFloats() [2/2]

bool WideSampleSequence::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

Retrieve samples from a sequence in floating-point format, regardless of the storage format

Parameters
iChannelindex of first channel to fetch
nBufferscounts buffers
buffersreceive the samples
startstarting sample, relative to absolute time zero
lenhow many samples to get. buffers are assumed sufficiently large
fillhow to assign values for sample positions between clips
mayThrowif false, fill buffer with zeros when there is failure to retrieve samples; else throw
[out]pNumWithinClipsReport how many samples were copied from within clips, rather than filled according to fillFormat; but these were not necessarily one contiguous range.
Precondition
iChannel + nBuffers <= NChannels()
Returns
false when mayThrow is false and not all samples could be retrieved
Postcondition
if return value is false, buffers are zero-filled

Definition at line 58 of file WideSampleSequence.cpp.

34{
35 // Cast the pointers to pass them to DoGet() which handles multiple
36 // destination formats
37 const auto castBuffers = reinterpret_cast<const samplePtr*>(buffers);
38 const auto result = DoGet(
39 iChannel, nBuffers, castBuffers,
40 floatSample, start, len, backwards, fill, mayThrow, pNumWithinClips);
41 if (!result)
42 while (nBuffers--)
43 ClearSamples(castBuffers[nBuffers], floatSample, 0, len);
44 return result;
45}
void ClearSamples(samplePtr dst, sampleFormat format, size_t start, size_t len)
char * samplePtr
Definition: SampleFormat.h:57
bool DoGet(size_t iChannel, size_t nBuffers, const samplePtr buffers[], sampleFormat format, sampleCount start, size_t len, bool backwards, fillFormat fill=FillFormat::fillZero, bool mayThrow=true, sampleCount *pNumWithinClips=nullptr) const override
This fails if any clip overlapping the range has non-unit stretch ratio!
Definition: WaveTrack.cpp:2591

◆ GetIdealBlockSize()

size_t WaveChannel::GetIdealBlockSize ( )
inline

A hint for sizing of well aligned fetches.

Definition at line 854 of file WaveTrack.h.

854 {
855 return GetTrack().GetIdealBlockSize();
856}
size_t GetIdealBlockSize()
Definition: WaveTrack.cpp:2279

References WaveTrack::GetIdealBlockSize(), and GetTrack().

Here is the call graph for this function:

◆ GetInterval() [1/2]

std::shared_ptr< WaveClipChannel > WaveChannel::GetInterval ( size_t  iInterval)

Definition at line 737 of file WaveTrack.cpp.

737 { return
738 ::Channel::GetInterval<WaveClipChannel>(iInterval); }

◆ GetInterval() [2/2]

std::shared_ptr< const WaveClipChannel > WaveChannel::GetInterval ( size_t  iInterval) const

Definition at line 741 of file WaveTrack.cpp.

741 { return
742 ::Channel::GetInterval<const WaveClipChannel>(iInterval); }

◆ GetMaxBlockSize()

size_t WaveChannel::GetMaxBlockSize ( ) const
inline

A hint for maximum returned by either of GetBestBlockSize, GetIdealBlockSize

Definition at line 858 of file WaveTrack.h.

858 {
859 return GetTrack().GetMaxBlockSize();
860}
size_t GetMaxBlockSize() const
Definition: WaveTrack.cpp:2258

References WaveTrack::GetMaxBlockSize(), and GetTrack().

Referenced by EffectNormalize::AnalyseTrackData(), TrackSpectrumTransformer::Process(), EffectChangeSpeed::ProcessOne(), EffectClickRemoval::ProcessOne(), EffectTwoPassSimpleMono::ProcessOne(), EffectNormalize::ProcessOne(), VoiceKey::TestDirectionChanges(), VoiceKey::TestEnergy(), and VoiceKey::TestSignChanges().

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

◆ GetRate()

double WaveChannel::GetRate ( ) const
overridevirtual

Implements WideSampleSequence.

Definition at line 793 of file WaveTrack.cpp.

794{
795 return GetTrack().GetRate();
796}
double GetRate() const override
Definition: WaveTrack.cpp:798

References WaveTrack::GetRate(), and GetTrack().

Referenced by SelectHandle::AdjustFreqSelection(), VoiceKey::CalibrateNoise(), SpectrumVRulerControls::DoHandleWheelRotation(), SpectrumVZoomHandle::DoZoom(), WaveformVZoomHandle::DoZoom(), VoiceKey::OffBackward(), VoiceKey::OffForward(), VoiceKey::OnBackward(), VoiceKey::OnForward(), anonymous_namespace{BrushHandle.cpp}::PositionToFrequency(), anonymous_namespace{SelectHandle.cpp}::PositionToFrequency(), SelectHandle::SnapCenterOnce(), and SelectHandle::StartSnappingFreqSelection().

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

◆ GetSampleFormat()

sampleFormat WaveChannel::GetSampleFormat ( ) const
inline

Definition at line 862 of file WaveTrack.h.

862 {
863 return GetTrack().GetSampleFormat();
864}
sampleFormat GetSampleFormat() const override
Definition: WaveTrack.cpp:895

References WaveTrack::GetSampleFormat(), and GetTrack().

Here is the call graph for this function:

◆ GetSampleView()

ChannelSampleView WaveChannel::GetSampleView ( double  t0,
double  t1,
bool  mayThrow 
) const

Request channel samples within [t0, t1), not knowing in advance how many this will be.

The stretching of intersecting intervals 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.

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

Definition at line 2725 of file WaveTrack.cpp.

2726{
2727 std::vector<std::shared_ptr<const WaveClipChannel>>
2728 intersectingIntervals;
2729 for (const auto &interval : Intervals())
2730 if (interval->Intersects(t0, t1))
2731 intersectingIntervals.push_back(interval);
2732 if (intersectingIntervals.empty())
2733 return { AudioSegmentSampleView {
2734 (TimeToLongSamples(t1) - TimeToLongSamples(t0)).as_size_t() } };
2735 std::sort(
2736 intersectingIntervals.begin(), intersectingIntervals.end(),
2737 [](const auto& a, const auto& b) { return a->Start() < b->Start(); });
2738 std::vector<AudioSegmentSampleView> segments;
2739 segments.reserve(2 * intersectingIntervals.size() + 1);
2740 for (auto i = 0u; i < intersectingIntervals.size();++i)
2741 {
2742 const auto& interval = intersectingIntervals[i];
2743 const auto intervalStartTime = interval->Start();
2744 if (t0 < intervalStartTime)
2745 {
2746 const auto numSamples = TimeToLongSamples(intervalStartTime - t0);
2747 segments.push_back(AudioSegmentSampleView{numSamples.as_size_t()});
2748 t0 = intervalStartTime;
2749 }
2750 const auto intervalT0 = t0 - intervalStartTime;
2751 const auto intervalT1 = std::min(t1, interval->End()) - intervalStartTime;
2752 if(intervalT1 > intervalT0)
2753 {
2754 auto newSegment =
2755 interval->GetSampleView(intervalT0, intervalT1, mayThrow);
2756 t0 += intervalT1 - intervalT0;
2757 segments.push_back(std::move(newSegment));
2758 }
2759 if (t0 == t1)
2760 break;
2761 }
2762 if (t0 < t1)
2763 segments.push_back(AudioSegmentSampleView {
2764 (TimeToLongSamples(t1) - TimeToLongSamples(t0)).as_size_t() });
2765 return segments;
2766}
int min(int a, int b)
IteratorRange< IntervalIterator< WaveClipChannel > > Intervals()
Definition: WaveTrack.cpp:745
sampleCount TimeToLongSamples(double t0) const

References Intervals(), min(), and WideSampleSequence::TimeToLongSamples().

Here is the call graph for this function:

◆ GetStartTime()

double WaveChannel::GetStartTime ( ) const
overridevirtual

Implements WideSampleSequence.

Definition at line 2571 of file WaveTrack.cpp.

2572{
2573 return GetTrack().GetStartTime();
2574}
double GetStartTime() const override
Implement WideSampleSequence.
Definition: WaveTrack.cpp:2576

References WaveTrack::GetStartTime(), and GetTrack().

Here is the call graph for this function:

◆ GetTrack() [1/2]

WaveTrack & WaveChannel::GetTrack ( )
inline

Definition at line 840 of file WaveTrack.h.

840 {
841 auto &result = static_cast<WaveTrack&>(DoGetChannelGroup());
842 return result;
843}
ChannelGroup & DoGetChannelGroup() const override
Subclass must override.
Definition: WaveTrack.cpp:731
A Track that contains audio waveform data.
Definition: WaveTrack.h:203

References DoGetChannelGroup().

Referenced by Append(), AppendBuffer(), DoGet(), WaveformView::Draw(), WaveChannelSubView::DrawBoldBoundaries(), anonymous_namespace{SpectrumView.cpp}::DrawClipSpectrum(), anonymous_namespace{WaveformView.cpp}::DrawClipWaveform(), SpectrogramSettings::Get(), WaveformSettings::Get(), WaveformScale::Get(), SpectrogramBounds::Get(), WaveformAppearance::Get(), GetBestBlockSize(), SpectrogramBounds::GetBounds(), GetChannelGain(), GetChannelType(), GetEndTime(), WaveChannelUtilities::GetEnvelopeAtTime(), GetEnvelopeValues(), GetIdealBlockSize(), GetMaxBlockSize(), GetRate(), GetSampleFormat(), GetStartTime(), HasTrivialEnvelope(), EffectLoudness::LoadBufferBlock(), SpectrogramSettings::Own(), EffectPaulstretch::ProcessOne(), SpectralDataManager::Worker::ProcessOvertones(), SpectralDataManager::Worker::ProcessSnapping(), SpectrogramSettings::Reset(), WaveformSettings::Set(), EffectLoudness::StoreBufferBlock(), WidestEffectiveFormat(), and WaveTrack::WriteOneXML().

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

◆ GetTrack() [2/2]

const WaveTrack & WaveChannel::GetTrack ( ) const
inline

Definition at line 845 of file WaveTrack.h.

845 {
846 auto &result = static_cast<const WaveTrack&>(DoGetChannelGroup());
847 return result;
848}

References DoGetChannelGroup().

Here is the call graph for this function:

◆ HasTrivialEnvelope()

bool WaveChannel::HasTrivialEnvelope ( ) const
overridevirtual
Returns
whether envelope values are all unit

Implements WideSampleSequence.

Definition at line 2826 of file WaveTrack.cpp.

2827{
2828 return GetTrack().HasTrivialEnvelope();
2829}
bool HasTrivialEnvelope() const override
Definition: WaveTrack.cpp:2831

References GetTrack(), and WaveTrack::HasTrivialEnvelope().

Here is the call graph for this function:

◆ Intervals() [1/2]

IteratorRange< Channel::IntervalIterator< WaveClipChannel > > WaveChannel::Intervals ( )

Definition at line 745 of file WaveTrack.cpp.

745{ return ::Channel::Intervals<WaveClipChannel>(); }

Referenced by SpectrumView::DoDraw(), WaveformView::DoDraw(), WaveChannelUtilities::GetIntervalAtTime(), WaveChannelUtilities::GetMinMax(), WaveChannelUtilities::GetRMS(), GetSampleView(), Set(), WaveChannelUtilities::SortedClipArray(), and WaveTrack::WriteOneXML().

Here is the caller graph for this function:

◆ Intervals() [2/2]

IteratorRange< Channel::IntervalIterator< const WaveClipChannel > > WaveChannel::Intervals ( ) const

Definition at line 748 of file WaveTrack.cpp.

748 {
749 return ::Channel::Intervals<const WaveClipChannel>(); }

◆ NChannels()

size_t WaveChannel::NChannels ( ) const
overridevirtual

A constant property.

Postcondition
result: result > 0

Implements WideSampleSequence.

Definition at line 527 of file WaveTrack.cpp.

528{
529 return 1;
530}

◆ Set()

bool WaveChannel::Set ( constSamplePtr  buffer,
sampleFormat  format,
sampleCount  start,
size_t  len,
sampleFormat  effectiveFormat = widestSampleFormat 
)

Random-access assignment of a range of samples.

Exception safety guarantee:
Weak
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 2769 of file WaveTrack.cpp.

2771{
2772 for (const auto &clip: Intervals())
2773 {
2774 auto clipStart = clip->GetPlayStartSample();
2775 auto clipEnd = clip->GetPlayEndSample();
2776
2777 if (clipEnd > start && clipStart < start+len)
2778 {
2779 // Test as also in WaveTrack::GetOne()
2780 if (clip->HasPitchOrSpeed())
2781 return false;
2782
2783 // Clip sample region and Get/Put sample region overlap
2784 auto samplesToCopy =
2785 std::min( start+len - clipStart, clip->GetVisibleSampleCount() );
2786 auto startDelta = clipStart - start;
2787 decltype(startDelta) inclipDelta = 0;
2788 if (startDelta < 0)
2789 {
2790 inclipDelta = -startDelta; // make positive value
2791 samplesToCopy -= inclipDelta;
2792 // samplesToCopy is now either len or
2793 // (clipEnd - clipStart) - (start - clipStart)
2794 // == clipEnd - start > 0
2795 // samplesToCopy is not more than len
2796 //
2797 startDelta = 0;
2798 // startDelta is zero
2799 }
2800 else {
2801 // startDelta is nonnegative and less than len
2802 // samplesToCopy is positive and not more than len
2803 }
2804
2805 clip->SetSamples(
2806 buffer + startDelta.as_size_t() * SAMPLE_SIZE(format),
2807 format, inclipDelta, samplesToCopy.as_size_t(), effectiveFormat );
2808 }
2809 }
2810 return true;
2811}
#define SAMPLE_SIZE(SampleFormat)
Definition: SampleFormat.h:52

References anonymous_namespace{ExportPCM.cpp}::format, Intervals(), min(), and SAMPLE_SIZE.

Referenced by WaveTrackSink::DoConsume().

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

◆ SetFloats()

bool WaveChannel::SetFloats ( const float *  buffer,
sampleCount  start,
size_t  len,
sampleFormat  effectiveFormat = widestSampleFormat 
)
inline

Random-access assignment of a range of samples.

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 162 of file WaveTrack.h.

171 {
172 return Set(reinterpret_cast<constSamplePtr>(buffer), floatSample,
173 start, len, effectiveFormat);
174 }
const char * constSamplePtr
Definition: SampleFormat.h:58
bool Set(constSamplePtr buffer, sampleFormat format, sampleCount start, size_t len, sampleFormat effectiveFormat=widestSampleFormat)
Random-access assignment of a range of samples.
Definition: WaveTrack.cpp:2769

References floatSample.

Referenced by EffectAutoDuck::ApplyDuckFade(), EffectClickRemoval::ProcessOne(), EffectRepair::ProcessOne(), EffectTwoPassSimpleMono::ProcessOne(), and EffectNormalize::ProcessOne().

Here is the caller graph for this function:

◆ WidestEffectiveFormat()

sampleFormat WaveChannel::WidestEffectiveFormat ( ) const
overridevirtual
Returns
widest effective SampleFormat in any part of the track

Implements WideSampleSequence.

Definition at line 2813 of file WaveTrack.cpp.

2814{
2816}
sampleFormat WidestEffectiveFormat() const override
Definition: WaveTrack.cpp:2818

References GetTrack(), and WaveTrack::WidestEffectiveFormat().

Here is the call graph for this function:

Member Data Documentation

◆ mOwner

WaveTrack& WaveChannel::mOwner
private

Definition at line 197 of file WaveTrack.h.

Referenced by DoGetChannelGroup().


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