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 366 of file WaveTrack.cpp.

367 : mOwner{ owner }
368{
369}
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 2221 of file WaveTrack.cpp.

2223{
2224 const size_t iChannel = GetChannelIndex();
2225 return GetTrack()
2226 .Append(iChannel, buffer, format, len, 1, widestSampleFormat);
2227}
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:2232

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 2210 of file WaveTrack.cpp.

2212{
2213 const size_t iChannel = GetChannelIndex();
2214 return GetTrack()
2215 .Append(iChannel, buffer, format, len, stride, effectiveFormat);
2216}

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 2600 of file WaveTrack.cpp.

2604{
2605 // These two assertions still remain after the great wide wave track and clip
2606 // refactoring!
2607 assert(iChannel == 0);
2608 assert(nBuffers <= 1);
2609 return GetTrack().DoGet(GetChannelIndex(), std::min<size_t>(nBuffers, 1),
2610 buffers, format, start, len, backwards, fill, mayThrow, pNumWithinClips);
2611}
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:2618

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 729 of file WaveTrack.cpp.

730{
731 return mOwner;
732}

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:2244

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 865 of file WaveTrack.cpp.

866{
867 return GetTrack().GetChannelGain(channel);
868}
float GetChannelGain(int channel) const override
Takes gain and pan into account.
Definition: WaveTrack.cpp:870

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 535 of file WaveTrack.cpp.

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

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 2590 of file WaveTrack.cpp.

2591{
2592 return GetTrack().GetEndTime();
2593}
double GetEndTime() const override
Implement WideSampleSequence.
Definition: WaveTrack.cpp:2595

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 2850 of file WaveTrack.cpp.

2852{
2853 return GetTrack().GetEnvelopeValues(buffer, bufferLen, t0, backwards);
2854}
void GetEnvelopeValues(double *buffer, size_t bufferLen, double t0, bool backwards) const override
Definition: WaveTrack.cpp:2856

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:2600

◆ 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:2284

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 735 of file WaveTrack.cpp.

735 { return
736 ::Channel::GetInterval<WaveClipChannel>(iInterval); }

◆ GetInterval() [2/2]

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

Definition at line 739 of file WaveTrack.cpp.

739 { return
740 ::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:2263

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 798 of file WaveTrack.cpp.

799{
800 return GetTrack().GetRate();
801}
double GetRate() const override
Definition: WaveTrack.cpp:803

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:900

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 2734 of file WaveTrack.cpp.

2735{
2736 std::vector<std::shared_ptr<const WaveClipChannel>>
2737 intersectingIntervals;
2738 for (const auto &interval : Intervals())
2739 if (interval->Intersects(t0, t1))
2740 intersectingIntervals.push_back(interval);
2741 if (intersectingIntervals.empty())
2742 return { AudioSegmentSampleView {
2743 (TimeToLongSamples(t1) - TimeToLongSamples(t0)).as_size_t() } };
2744 std::sort(
2745 intersectingIntervals.begin(), intersectingIntervals.end(),
2746 [](const auto& a, const auto& b) { return a->Start() < b->Start(); });
2747 std::vector<AudioSegmentSampleView> segments;
2748 segments.reserve(2 * intersectingIntervals.size() + 1);
2749 for (auto i = 0u; i < intersectingIntervals.size();++i)
2750 {
2751 const auto& interval = intersectingIntervals[i];
2752 const auto intervalStartTime = interval->Start();
2753 if (t0 < intervalStartTime)
2754 {
2755 const auto numSamples = TimeToLongSamples(intervalStartTime - t0);
2756 segments.push_back(AudioSegmentSampleView{numSamples.as_size_t()});
2757 t0 = intervalStartTime;
2758 }
2759 const auto intervalT0 = t0 - intervalStartTime;
2760 const auto intervalT1 = std::min(t1, interval->End()) - intervalStartTime;
2761 if(intervalT1 > intervalT0)
2762 {
2763 auto newSegment =
2764 interval->GetSampleView(intervalT0, intervalT1, mayThrow);
2765 t0 += intervalT1 - intervalT0;
2766 segments.push_back(std::move(newSegment));
2767 }
2768 if (t0 == t1)
2769 break;
2770 }
2771 if (t0 < t1)
2772 segments.push_back(AudioSegmentSampleView {
2773 (TimeToLongSamples(t1) - TimeToLongSamples(t0)).as_size_t() });
2774 return segments;
2775}
int min(int a, int b)
IteratorRange< IntervalIterator< WaveClipChannel > > Intervals()
Definition: WaveTrack.cpp:743
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 2580 of file WaveTrack.cpp.

2581{
2582 return GetTrack().GetStartTime();
2583}
double GetStartTime() const override
Implement WideSampleSequence.
Definition: WaveTrack.cpp:2585

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:729
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 2835 of file WaveTrack.cpp.

2836{
2837 return GetTrack().HasTrivialEnvelope();
2838}
bool HasTrivialEnvelope() const override
Definition: WaveTrack.cpp:2840

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 743 of file WaveTrack.cpp.

743{ 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 746 of file WaveTrack.cpp.

746 {
747 return ::Channel::Intervals<const WaveClipChannel>(); }

◆ NChannels()

size_t WaveChannel::NChannels ( ) const
overridevirtual

A constant property.

Postcondition
result: result > 0

Implements WideSampleSequence.

Definition at line 525 of file WaveTrack.cpp.

526{
527 return 1;
528}

◆ 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 2778 of file WaveTrack.cpp.

2780{
2781 for (const auto &clip: Intervals())
2782 {
2783 auto clipStart = clip->GetPlayStartSample();
2784 auto clipEnd = clip->GetPlayEndSample();
2785
2786 if (clipEnd > start && clipStart < start+len)
2787 {
2788 // Test as also in WaveTrack::GetOne()
2789 if (clip->HasPitchOrSpeed())
2790 return false;
2791
2792 // Clip sample region and Get/Put sample region overlap
2793 auto samplesToCopy =
2794 std::min( start+len - clipStart, clip->GetVisibleSampleCount() );
2795 auto startDelta = clipStart - start;
2796 decltype(startDelta) inclipDelta = 0;
2797 if (startDelta < 0)
2798 {
2799 inclipDelta = -startDelta; // make positive value
2800 samplesToCopy -= inclipDelta;
2801 // samplesToCopy is now either len or
2802 // (clipEnd - clipStart) - (start - clipStart)
2803 // == clipEnd - start > 0
2804 // samplesToCopy is not more than len
2805 //
2806 startDelta = 0;
2807 // startDelta is zero
2808 }
2809 else {
2810 // startDelta is nonnegative and less than len
2811 // samplesToCopy is positive and not more than len
2812 }
2813
2814 clip->SetSamples(
2815 buffer + startDelta.as_size_t() * SAMPLE_SIZE(format),
2816 format, inclipDelta, samplesToCopy.as_size_t(), effectiveFormat );
2817 }
2818 }
2819 return true;
2820}
#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:2778

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 2822 of file WaveTrack.cpp.

2823{
2825}
sampleFormat WidestEffectiveFormat() const override
Definition: WaveTrack.cpp:2827

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: