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 GetChannelVolume (int channel) const override
 Takes volume 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 GetChannelVolume (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 2237 of file WaveTrack.cpp.

2239{
2240 const size_t iChannel = GetChannelIndex();
2241 return GetTrack()
2242 .Append(iChannel, buffer, format, len, 1, widestSampleFormat);
2243}
size_t GetChannelIndex() const
Definition: Channel.cpp:25
WaveTrack & GetTrack()
Definition: WaveTrack.h:841
bool Append(size_t iChannel, constSamplePtr buffer, sampleFormat format, size_t len, unsigned int stride=1, sampleFormat effectiveFormat=widestSampleFormat) override
Definition: WaveTrack.cpp:2248

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

Referenced by WaveTrackSink::DoConsume(), TrackSpectrumTransformer::DoOutput(), SBSMSBase::Process(), PaulstretchBase::ProcessOne(), ChangeSpeedBase::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 2226 of file WaveTrack.cpp.

2228{
2229 const size_t iChannel = GetChannelIndex();
2230 return GetTrack()
2231 .Append(iChannel, buffer, format, len, stride, effectiveFormat);
2232}

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

2622{
2623 // These two assertions still remain after the great wide wave track and clip
2624 // refactoring!
2625 assert(iChannel == 0);
2626 assert(nBuffers <= 1);
2627 return GetTrack().DoGet(GetChannelIndex(), std::min<size_t>(nBuffers, 1),
2628 buffers, format, start, len, backwards, fill, mayThrow, pNumWithinClips);
2629}
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:2636

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

749{
750 return mOwner;
751}

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

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

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

Referenced by NormalizeBase::AnalyseTrackData(), TrackSpectrumTransformer::Process(), ChangeSpeedBase::ProcessOne(), EffectTwoPassSimpleMono::ProcessOne(), NormalizeBase::ProcessOne(), LoudnessBase::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:

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

◆ GetChannelVolume()

float WaveChannel::GetChannelVolume ( int  channel) const
overridevirtual

Takes volume and pan into account.

Implements WideSampleSequence.

Definition at line 883 of file WaveTrack.cpp.

884{
885 return GetTrack().GetChannelVolume(channel);
886}
float GetChannelVolume(int channel) const override
Takes volume and pan into account.
Definition: WaveTrack.cpp:888

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

Here is the call graph for this function:

◆ GetEndTime()

double WaveChannel::GetEndTime ( ) const
overridevirtual

Implements WideSampleSequence.

Definition at line 2608 of file WaveTrack.cpp.

2609{
2610 return GetTrack().GetEndTime();
2611}
double GetEndTime() const override
Implement WideSampleSequence.
Definition: WaveTrack.cpp:2613

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

2870{
2871 return GetTrack().GetEnvelopeValues(buffer, bufferLen, t0, backwards);
2872}
void GetEnvelopeValues(double *buffer, size_t bufferLen, double t0, bool backwards) const override
Definition: WaveTrack.cpp:2874

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 NormalizeBase::AnalyseTrackData(), AutoDuckBase::ApplyDuckFade(), VoiceKey::OffBackward(), VoiceKey::OffForward(), VoiceKey::OnBackward(), VoiceKey::OnForward(), TrackSpectrumTransformer::Process(), PaulstretchBase::ProcessOne(), ChangeSpeedBase::ProcessOne(), ClickRemovalBase::ProcessOne(), Repair::ProcessOne(), FindClippingBase::ProcessOne(), EqualizationBase::ProcessOne(), EffectTwoPassSimpleMono::ProcessOne(), NormalizeBase::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:2618

◆ GetIdealBlockSize()

size_t WaveChannel::GetIdealBlockSize ( )
inline

A hint for sizing of well aligned fetches.

Definition at line 855 of file WaveTrack.h.

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

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

754 { return
755 ::Channel::GetInterval<WaveClipChannel>(iInterval); }

◆ GetInterval() [2/2]

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

Definition at line 758 of file WaveTrack.cpp.

758 { return
759 ::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 859 of file WaveTrack.h.

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

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

Referenced by NormalizeBase::AnalyseTrackData(), TrackSpectrumTransformer::Process(), ChangeSpeedBase::ProcessOne(), ClickRemovalBase::ProcessOne(), EffectTwoPassSimpleMono::ProcessOne(), NormalizeBase::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 816 of file WaveTrack.cpp.

817{
818 return GetTrack().GetRate();
819}
double GetRate() const override
Definition: WaveTrack.cpp:821

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

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

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

2753{
2754 std::vector<std::shared_ptr<const WaveClipChannel>>
2755 intersectingIntervals;
2756 for (const auto &interval : Intervals())
2757 if (interval->Intersects(t0, t1))
2758 intersectingIntervals.push_back(interval);
2759 if (intersectingIntervals.empty())
2760 return { AudioSegmentSampleView {
2761 (TimeToLongSamples(t1) - TimeToLongSamples(t0)).as_size_t() } };
2762 std::sort(
2763 intersectingIntervals.begin(), intersectingIntervals.end(),
2764 [](const auto& a, const auto& b) { return a->Start() < b->Start(); });
2765 std::vector<AudioSegmentSampleView> segments;
2766 segments.reserve(2 * intersectingIntervals.size() + 1);
2767 for (auto i = 0u; i < intersectingIntervals.size();++i)
2768 {
2769 const auto& interval = intersectingIntervals[i];
2770 const auto intervalStartTime = interval->Start();
2771 if (t0 < intervalStartTime)
2772 {
2773 const auto numSamples = TimeToLongSamples(intervalStartTime - t0);
2774 segments.push_back(AudioSegmentSampleView{numSamples.as_size_t()});
2775 t0 = intervalStartTime;
2776 }
2777 const auto intervalT0 = t0 - intervalStartTime;
2778 const auto intervalT1 = std::min(t1, interval->End()) - intervalStartTime;
2779 if(intervalT1 > intervalT0)
2780 {
2781 auto newSegment =
2782 interval->GetSampleView(intervalT0, intervalT1, mayThrow);
2783 t0 += intervalT1 - intervalT0;
2784 segments.push_back(std::move(newSegment));
2785 }
2786 if (t0 == t1)
2787 break;
2788 }
2789 if (t0 < t1)
2790 segments.push_back(AudioSegmentSampleView {
2791 (TimeToLongSamples(t1) - TimeToLongSamples(t0)).as_size_t() });
2792 return segments;
2793}
int min(int a, int b)
IteratorRange< IntervalIterator< WaveClipChannel > > Intervals()
Definition: WaveTrack.cpp:762
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 2598 of file WaveTrack.cpp.

2599{
2600 return GetTrack().GetStartTime();
2601}
double GetStartTime() const override
Implement WideSampleSequence.
Definition: WaveTrack.cpp:2603

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

Here is the call graph for this function:

◆ GetTrack() [1/2]

WaveTrack & WaveChannel::GetTrack ( )
inline

Definition at line 841 of file WaveTrack.h.

841 {
842 auto &result = static_cast<WaveTrack&>(DoGetChannelGroup());
843 return result;
844}
ChannelGroup & DoGetChannelGroup() const override
Subclass must override.
Definition: WaveTrack.cpp:748
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(), GetChannelType(), GetChannelVolume(), GetEndTime(), WaveChannelUtilities::GetEnvelopeAtTime(), GetEnvelopeValues(), GetIdealBlockSize(), GetMaxBlockSize(), GetRate(), GetSampleFormat(), GetStartTime(), HasTrivialEnvelope(), LoudnessBase::LoadBufferBlock(), SpectrogramSettings::Own(), PaulstretchBase::ProcessOne(), SpectralDataManager::Worker::ProcessOvertones(), SpectralDataManager::Worker::ProcessSnapping(), SpectrogramSettings::Reset(), WaveformSettings::Set(), LoudnessBase::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 846 of file WaveTrack.h.

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

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

2854{
2855 return GetTrack().HasTrivialEnvelope();
2856}
bool HasTrivialEnvelope() const override
Definition: WaveTrack.cpp:2858

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

762{ 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 765 of file WaveTrack.cpp.

765 {
766 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 2796 of file WaveTrack.cpp.

2798{
2799 for (const auto &clip: Intervals())
2800 {
2801 auto clipStart = clip->GetPlayStartSample();
2802 auto clipEnd = clip->GetPlayEndSample();
2803
2804 if (clipEnd > start && clipStart < start+len)
2805 {
2806 // Test as also in WaveTrack::GetOne()
2807 if (clip->HasPitchOrSpeed())
2808 return false;
2809
2810 // Clip sample region and Get/Put sample region overlap
2811 auto samplesToCopy =
2812 std::min( start+len - clipStart, clip->GetVisibleSampleCount() );
2813 auto startDelta = clipStart - start;
2814 decltype(startDelta) inclipDelta = 0;
2815 if (startDelta < 0)
2816 {
2817 inclipDelta = -startDelta; // make positive value
2818 samplesToCopy -= inclipDelta;
2819 // samplesToCopy is now either len or
2820 // (clipEnd - clipStart) - (start - clipStart)
2821 // == clipEnd - start > 0
2822 // samplesToCopy is not more than len
2823 //
2824 startDelta = 0;
2825 // startDelta is zero
2826 }
2827 else {
2828 // startDelta is nonnegative and less than len
2829 // samplesToCopy is positive and not more than len
2830 }
2831
2832 clip->SetSamples(
2833 buffer + startDelta.as_size_t() * SAMPLE_SIZE(format),
2834 format, inclipDelta, samplesToCopy.as_size_t(), effectiveFormat );
2835 }
2836 }
2837 return true;
2838}
#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:2796

References floatSample.

Referenced by AutoDuckBase::ApplyDuckFade(), ClickRemovalBase::ProcessOne(), Repair::ProcessOne(), EffectTwoPassSimpleMono::ProcessOne(), and NormalizeBase::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 2840 of file WaveTrack.cpp.

2841{
2843}
sampleFormat WidestEffectiveFormat() const override
Definition: WaveTrack.cpp:2845

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: