![]() |
Audacity 3.2.0
|
#include <WaveTrack.h>
Public Member Functions | |
| WaveChannel (WaveTrack &owner) | |
| ~WaveChannel () override | |
| WaveTrack & | GetTrack () |
| const WaveTrack & | GetTrack () 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 |
| ChannelGroup & | DoGetChannelGroup () const override |
| Subclass must override. More... | |
| std::shared_ptr< WaveClipChannel > | GetInterval (size_t iInterval) |
| std::shared_ptr< const WaveClipChannel > | GetInterval (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 () |
| ChannelGroup & | GetChannelGroup () |
| Channel object's lifetime is assumed to be nested in its Track's. More... | |
| const ChannelGroup & | GetChannelGroup () 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 | |
| WaveTrack & | mOwner |
Additional Inherited Members | |
Public Types inherited from Channel | |
| using | Interval = ChannelInterval |
| virtual ChannelGroup & | DoGetChannelGroup () const =0 |
| Subclass must override. More... | |
Definition at line 81 of file WaveTrack.h.
|
explicit |
Definition at line 366 of file WaveTrack.cpp.
|
overridedefault |
| 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.
Definition at line 2237 of file WaveTrack.cpp.
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().
| bool WaveChannel::AppendBuffer | ( | constSamplePtr | buffer, |
| sampleFormat | format, | ||
| size_t | len, | ||
| unsigned | stride, | ||
| sampleFormat | effectiveFormat | ||
| ) |
Definition at line 2226 of file WaveTrack.cpp.
References WaveTrack::Append(), anonymous_namespace{ExportPCM.cpp}::format, Channel::GetChannelIndex(), GetTrack(), and anonymous_namespace{StretchingSequenceIntegrationTest.cpp}::iChannel.
|
overridevirtual |
This fails if any clip overlapping the range has non-unit stretch ratio!
Implements WideSampleSequence.
Definition at line 2618 of file WaveTrack.cpp.
References WaveTrack::DoGet(), anonymous_namespace{ExportPCM.cpp}::format, Channel::GetChannelIndex(), GetTrack(), and anonymous_namespace{StretchingSequenceIntegrationTest.cpp}::iChannel.
|
overridevirtual |
Subclass must override.
ii less than result.NChannels(), this == result.GetChannel(ii).get() Implements Channel.
Definition at line 748 of file WaveTrack.cpp.
References mOwner.
Referenced by GetTrack().
|
inline |
A hint for sizing of well aligned fetches.
Definition at line 851 of file WaveTrack.h.
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().
|
overridevirtual |
Classify this channel.
Implements AudioGraph::Channel.
Definition at line 535 of file WaveTrack.cpp.
References Channel::GetChannelIndex(), GetTrack(), AudioGraph::LeftChannel, AudioGraph::MonoChannel, AudioGraph::RightChannel, and size.
|
overridevirtual |
Takes volume and pan into account.
Implements WideSampleSequence.
Definition at line 883 of file WaveTrack.cpp.
References WaveTrack::GetChannelVolume(), and GetTrack().
|
overridevirtual |
Implements WideSampleSequence.
Definition at line 2608 of file WaveTrack.cpp.
References WaveTrack::GetEndTime(), and GetTrack().
|
overridevirtual |
Fetch envelope values corresponding to uniformly separated sample times starting at the given time
| backwards | if true, fetch values in reverse order, from t0 to t0 - bufferLen / rate |
Implements WideSampleSequence.
Definition at line 2868 of file WaveTrack.cpp.
References WaveTrack::GetEnvelopeValues(), and GetTrack().
|
inline |
"narrow" overload fetches from the unique channel
Definition at line 129 of file WaveTrack.h.
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().
| 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
| iChannel | index of first channel to fetch | |
| nBuffers | counts buffers | |
| buffers | receive the samples | |
| start | starting sample, relative to absolute time zero | |
| len | how many samples to get. buffers are assumed sufficiently large | |
| fill | how to assign values for sample positions between clips | |
| mayThrow | if false, fill buffer with zeros when there is failure to retrieve samples; else throw | |
| [out] | pNumWithinClips | Report how many samples were copied from within clips, rather than filled according to fillFormat; but these were not necessarily one contiguous range. |
iChannel + nBuffers <= NChannels() mayThrow is false and not all samples could be retrieved Definition at line 58 of file WideSampleSequence.cpp.
|
inline |
A hint for sizing of well aligned fetches.
Definition at line 855 of file WaveTrack.h.
References WaveTrack::GetIdealBlockSize(), and GetTrack().
| std::shared_ptr< WaveClipChannel > WaveChannel::GetInterval | ( | size_t | iInterval | ) |
Definition at line 754 of file WaveTrack.cpp.
| std::shared_ptr< const WaveClipChannel > WaveChannel::GetInterval | ( | size_t | iInterval | ) | const |
Definition at line 758 of file WaveTrack.cpp.
|
inline |
A hint for maximum returned by either of GetBestBlockSize, GetIdealBlockSize
Definition at line 859 of file WaveTrack.h.
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().
|
overridevirtual |
Implements WideSampleSequence.
Definition at line 816 of file WaveTrack.cpp.
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().
|
inline |
Definition at line 863 of file WaveTrack.h.
References WaveTrack::GetSampleFormat(), and GetTrack().
| 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.
size_t Definition at line 2752 of file WaveTrack.cpp.
References Intervals(), min(), and WideSampleSequence::TimeToLongSamples().
|
overridevirtual |
Implements WideSampleSequence.
Definition at line 2598 of file WaveTrack.cpp.
References WaveTrack::GetStartTime(), and GetTrack().
|
inline |
Definition at line 841 of file WaveTrack.h.
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().
|
inline |
Definition at line 846 of file WaveTrack.h.
References DoGetChannelGroup().
|
overridevirtual |
Implements WideSampleSequence.
Definition at line 2853 of file WaveTrack.cpp.
References GetTrack(), and WaveTrack::HasTrivialEnvelope().
| IteratorRange< Channel::IntervalIterator< WaveClipChannel > > WaveChannel::Intervals | ( | ) |
Definition at line 762 of file WaveTrack.cpp.
Referenced by SpectrumView::DoDraw(), WaveformView::DoDraw(), WaveChannelUtilities::GetIntervalAtTime(), WaveChannelUtilities::GetMinMax(), WaveChannelUtilities::GetRMS(), GetSampleView(), Set(), WaveChannelUtilities::SortedClipArray(), and WaveTrack::WriteOneXML().
| IteratorRange< Channel::IntervalIterator< const WaveClipChannel > > WaveChannel::Intervals | ( | ) | const |
Definition at line 765 of file WaveTrack.cpp.
|
overridevirtual |
A constant property.
result > 0 Implements WideSampleSequence.
Definition at line 525 of file WaveTrack.cpp.
| bool WaveChannel::Set | ( | constSamplePtr | buffer, |
| sampleFormat | format, | ||
| sampleCount | start, | ||
| size_t | len, | ||
| sampleFormat | effectiveFormat = widestSampleFormat |
||
| ) |
Random-access assignment of a range of samples.
| effectiveFormat | Make 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.
References anonymous_namespace{ExportPCM.cpp}::format, Intervals(), min(), and SAMPLE_SIZE.
Referenced by WaveTrackSink::DoConsume().
|
inline |
Random-access assignment of a range of samples.
| effectiveFormat | Make 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.
References floatSample.
Referenced by AutoDuckBase::ApplyDuckFade(), ClickRemovalBase::ProcessOne(), Repair::ProcessOne(), EffectTwoPassSimpleMono::ProcessOne(), and NormalizeBase::ProcessOne().
|
overridevirtual |
Implements WideSampleSequence.
Definition at line 2840 of file WaveTrack.cpp.
References GetTrack(), and WaveTrack::WidestEffectiveFormat().
|
private |
Definition at line 197 of file WaveTrack.h.
Referenced by DoGetChannelGroup().