![]() |
Audacity 3.2.0
|
#include <SampleTrack.h>
Public Types | |
using | Attachments = SampleTrackAttachments |
![]() | |
enum class | LinkType : int { None = 0 , Group = 2 , Aligned } |
For two tracks describes the type of the linkage. More... | |
enum | ChannelType { LeftChannel = 0 , RightChannel = 1 , MonoChannel = 2 } |
using | ChannelGroupAttachments = ClientData::Site< ChannelGroupData, ClientData::Cloneable<>, ClientData::DeepCopying > |
Hosting of objects attached by higher level code. More... | |
using | AttachedObjects = ::AttachedTrackObjects |
Alias for my base type. More... | |
using | IntervalData = TrackIntervalData |
using | Interval = TrackInterval |
using | Intervals = std::vector< Interval > |
using | ConstInterval = ConstTrackInterval |
using | ConstIntervals = std::vector< ConstInterval > |
using | Holder = std::shared_ptr< Track > |
template<typename R = void> | |
using | Continuation = std::function< R() > |
Type of arguments passed as optional second parameter to TypeSwitch() cases. More... | |
using | Fallthrough = Continuation<> |
Type of arguments passed as optional second parameter to TypeSwitch<void>() cases. More... | |
![]() | |
using | DataType = ClientData |
using | DataPointer = Pointer< ClientData > |
using | DataFactory = std::function< DataPointer(Host &) > |
Type of function from which RegisteredFactory is constructed; it builds attachments. More... | |
Public Member Functions | |
SampleTrack () | |
SampleTrack (const SampleTrack &other, ProtectedCreationArg &&) | |
~SampleTrack () override | |
const TypeInfo & | GetTypeInfo () const override |
virtual sampleFormat | GetSampleFormat () const =0 |
virtual ChannelType | GetChannelIgnoringPan () const =0 |
virtual double | GetRate () const =0 |
virtual sampleFormat | WidestEffectiveFormat () const =0 |
virtual bool | HasTrivialEnvelope () const =0 |
virtual void | GetEnvelopeValues (double *buffer, size_t bufferLen, double t0) const =0 |
Fetch envelope values corresponding to uniformly separated sample times starting at the given time. More... | |
virtual float | GetChannelGain (int channel) const =0 |
Takes gain and pan into account. More... | |
virtual size_t | GetBestBlockSize (sampleCount t) const =0 |
This returns a nonnegative number of samples meant to size a memory buffer. More... | |
virtual size_t | GetMaxBlockSize () const =0 |
This returns a nonnegative number of samples meant to size a memory buffer. More... | |
virtual sampleCount | GetBlockStart (sampleCount t) const =0 |
This returns a possibly large or negative value. More... | |
bool | GetFloats (float *buffer, sampleCount start, size_t len, fillFormat fill=fillZero, bool mayThrow=true, sampleCount *pNumWithinClips=nullptr) const |
Retrieve samples from a track in floating-point format, regardless of the storage format. More... | |
virtual bool | Get (samplePtr buffer, sampleFormat format, sampleCount start, size_t len, fillFormat fill=fillZero, bool mayThrow=true, sampleCount *pNumWithinClips=nullptr) const =0 |
Retrieve samples from a track in a specified format. More... | |
sampleCount | TimeToLongSamples (double t0) const |
Convert correctly between an (absolute) time in seconds and a number of samples. More... | |
double | LongSamplesToTime (sampleCount pos) const |
Convert correctly between a number of samples and an (absolute) time in seconds. More... | |
![]() | |
PlayableTrack () | |
PlayableTrack (const PlayableTrack &orig, ProtectedCreationArg &&) | |
bool | GetMute () const |
bool | GetSolo () const |
bool | GetNotMute () const |
bool | GetNotSolo () const |
void | SetMute (bool m) |
void | SetSolo (bool s) |
void | Init (const PlayableTrack &init) |
void | Merge (const Track &init) override |
void | WriteXMLAttributes (XMLWriter &xmlFile) const |
bool | HandleXMLAttribute (const std::string_view &attr, const XMLAttributeValueView &value) |
![]() | |
AudioTrack () | |
AudioTrack (const Track &orig, ProtectedCreationArg &&a) | |
void | WriteXMLAttributes (XMLWriter &WXUNUSED(xmlFile)) const |
bool | HandleXMLAttribute (const std::string_view &, const XMLAttributeValueView &) |
![]() | |
TrackId | GetId () const |
template<typename Subclass = Track> | |
std::shared_ptr< Subclass > | SharedPointer () |
template<typename Subclass = const Track> | |
auto | SharedPointer () const -> std::enable_if_t< std::is_const_v< Subclass >, std::shared_ptr< Subclass > > |
std::shared_ptr< Track > | SubstitutePendingChangedTrack () |
std::shared_ptr< const Track > | SubstitutePendingChangedTrack () const |
std::shared_ptr< const Track > | SubstituteOriginalTrack () const |
virtual const TypeInfo & | GetTypeInfo () const =0 |
virtual const TypeNames & | GetTypeNames () const |
virtual bool | SupportsBasicEditing () const |
Whether this track type implements cut-copy-paste; by default, true. More... | |
virtual Holder | PasteInto (AudacityProject &) const =0 |
Find or create the destination track for a paste, maybe in a different project. More... | |
virtual ConstIntervals | GetIntervals () const |
Report times on the track where important intervals begin and end, for UI to snap to. More... | |
virtual Intervals | GetIntervals () |
int | GetIndex () const |
void | SetIndex (int index) |
virtual bool | LinkConsistencyFix (bool doFix=true, bool completeList=true) |
Check consistency of channel groups, and maybe fix it. More... | |
bool | LinkConsistencyCheck (bool completeList) |
Do the non-mutating part of consistency fix only and return status. More... | |
bool | HasOwner () const |
std::shared_ptr< TrackList > | GetOwner () const |
LinkType | GetLinkType () const noexcept |
bool | IsAlignedWithLeader () const |
Returns true if the leader track has link type LinkType::Aligned. More... | |
ChannelGroupData & | GetGroupData () |
const ChannelGroupData & | GetGroupData () const |
Track () | |
Track (const Track &orig, ProtectedCreationArg &&) | |
Track & | operator= (const Track &orig)=delete |
virtual | ~Track () |
void | Init (const Track &orig) |
virtual Holder | Duplicate () const |
virtual void | Merge (const Track &orig) |
wxString | GetName () const |
void | SetName (const wxString &n) |
bool | GetSelected () const |
virtual void | SetSelected (bool s) |
void | EnsureVisible (bool modifyState=false) |
virtual ChannelType | GetChannel () const |
virtual double | GetOffset () const =0 |
void | Offset (double t) |
virtual void | SetOffset (double o) |
virtual void | SetPan (float) |
virtual void | SetPanFromChannelType () |
virtual Holder | Cut (double WXUNUSED(t0), double WXUNUSED(t1))=0 |
virtual Holder | Copy (double WXUNUSED(t0), double WXUNUSED(t1), bool forClipboard=true) const =0 |
virtual void | Clear (double WXUNUSED(t0), double WXUNUSED(t1))=0 |
virtual void | Paste (double WXUNUSED(t), const Track *WXUNUSED(src))=0 |
virtual void | SyncLockAdjust (double oldT1, double newT1) |
virtual void | Silence (double WXUNUSED(t0), double WXUNUSED(t1))=0 |
virtual void | InsertSilence (double WXUNUSED(t), double WXUNUSED(len))=0 |
bool | SameKindAs (const Track &track) const |
template<typename R = void, typename ... Functions> | |
R | TypeSwitch (const Functions &...functions) |
Use this function rather than testing track type explicitly and making down-casts. More... | |
template<typename R = void, typename ... Functions> | |
R | TypeSwitch (const Functions &...functions) const |
Use this function rather than testing track type explicitly and making down-casts. More... | |
virtual void | WriteXML (XMLWriter &xmlFile) const =0 |
virtual bool | GetErrorOpening () |
virtual double | GetStartTime () const =0 |
virtual double | GetEndTime () const =0 |
void | Notify (int code=-1) |
bool | Any () const |
bool | IsSelected () const |
bool | IsLeader () const |
bool | IsSelectedLeader () const |
void | AdjustPositions () |
void | WriteCommonXMLAttributes (XMLWriter &xmlFile, bool includeNameAndSelected=true) const |
bool | HandleCommonXMLAttribute (const std::string_view &attr, const XMLAttributeValueView &valueView) |
![]() | |
XMLTagHandler () | |
virtual | ~XMLTagHandler () |
virtual bool | HandleXMLTag (const std::string_view &tag, const AttributesList &attrs)=0 |
virtual void | HandleXMLEndTag (const std::string_view &WXUNUSED(tag)) |
virtual void | HandleXMLContent (const std::string_view &WXUNUSED(content)) |
virtual XMLTagHandler * | HandleXMLChild (const std::string_view &tag)=0 |
void | ReadXMLEndTag (const char *tag) |
void | ReadXMLContent (const char *s, int len) |
XMLTagHandler * | ReadXMLChild (const char *tag) |
![]() | |
~Site () | |
Site () | |
Site (const Site &other) | |
Site & | operator= (const Site &other) |
Site (Site &&other) | |
Site & | operator= (Site &&other) |
size_t | size () const |
How many attachment pointers are in the Site. More... | |
template<typename Subclass = ClientData> | |
Subclass & | Get (const RegisteredFactory &key) |
Get reference to an attachment, creating on demand if not present, down-cast it to Subclass. More... | |
template<typename Subclass = const ClientData> | |
auto | Get (const RegisteredFactory &key) const -> std::enable_if_t< std::is_const< Subclass >::value, Subclass & > |
Get reference to an attachment, creating on demand if not present, down-cast it to Subclass. More... | |
template<typename Subclass = ClientData> | |
Subclass * | Find (const RegisteredFactory &key) |
Get a (bare) pointer to an attachment, or null, down-cast it to Subclass *; will not create on demand. More... | |
template<typename Subclass = const ClientData> | |
auto | Find (const RegisteredFactory &key) const -> std::enable_if_t< std::is_const< Subclass >::value, Subclass * > |
Get a (bare) pointer to an attachment, or null, down-cast it to Subclass *; will not create on demand. More... | |
template<typename ReplacementPointer > | |
void | Assign (const RegisteredFactory &key, ReplacementPointer &&replacement) |
Reassign Site's pointer to ClientData. More... | |
Static Public Member Functions | |
static const TypeInfo & | ClassTypeInfo () |
![]() | |
static const TypeInfo & | ClassTypeInfo () |
![]() | |
static const TypeInfo & | ClassTypeInfo () |
![]() | |
template<typename Subclass = Track> | |
static std::shared_ptr< Subclass > | SharedPointer (Track *pTrack) |
template<typename Subclass = const Track> | |
static std::shared_ptr< Subclass > | SharedPointer (const Track *pTrack) |
static const TypeInfo & | ClassTypeInfo () |
static void | FinishCopy (const Track *n, Track *dest) |
template<typename TrackType > | |
static void | checkTrackType () |
template<typename R , typename TrackType , typename... Functions> | |
static R | CallExecutor (R *, std::tuple<> *, TrackType &, const Functions &...) |
template<typename R , typename TrackType , typename... Functions, typename Executor , typename... Executors> | |
static R | CallExecutor (R *, std::tuple< Executor, Executors... > *, TrackType &track, const Functions &...functions) |
template<typename ... Executors> | |
static constexpr unsigned | UsedCases (std::tuple< Executors... > *) |
template<typename Tag , bool IsConst, typename R , typename ... TrackTypes, typename ... Functions> | |
static R | DoTypeSwitch (std::conditional_t< IsConst, const Track, Track > &track, std::tuple< TrackTypes... > *, const Functions &...functions) |
![]() | |
static size_t | slots () |
How many static factories have been registered with this specialization of Site. More... | |
Additional Inherited Members | |
![]() | |
std::pair< int, int > | vrulerSize |
![]() | |
bool | DoGetMute () const |
void | DoSetMute (bool value) |
bool | DoGetSolo () const |
void | DoSetSolo (bool value) |
![]() | |
void | SetLinkType (LinkType linkType, bool completeList=true) |
void | SetChannel (ChannelType c) noexcept |
![]() | |
template<typename Function > | |
void | ForEach (const Function &function) |
Invoke function on each ClientData object that has been created in this . More... | |
template<typename Function > | |
void | ForEach (const Function &function) const |
Invoke function on each ClientData object that has been created in this . More... | |
template<typename Function > | |
ClientData * | FindIf (const Function &function) |
Return pointer to first attachment in this that is not null and satisfies a predicate, or nullptr. More... | |
template<typename Function > | |
const ClientData * | FindIf (const Function &function) const |
Return pointer to first attachment in this that is not null and satisfies a predicate, or nullptr. More... | |
void | BuildAll () |
For each RegisteredFactory, if the corresponding attachment is absent in this , build and store it. More... | |
![]() | |
std::atomic< bool > | mMute { false } |
Atomic because it may be read by worker threads in playback. More... | |
std::atomic< bool > | mSolo { false } |
Atomic because it may be read by worker threads in playback. More... | |
![]() | |
std::weak_ptr< TrackList > | mList |
TrackNodePointer | mNode {} |
Holds iterator to self, so that TrackList::Find can be constant-time. More... | |
int | mIndex |
0-based position of this track in its TrackList More... | |
wxString | mName |
ChannelType | mChannel |
double | mOffset |
Definition at line 29 of file SampleTrack.h.
Definition at line 34 of file SampleTrack.h.
|
default |
SampleTrack::SampleTrack | ( | const SampleTrack & | other, |
ProtectedCreationArg && | a | ||
) |
Definition at line 17 of file SampleTrack.cpp.
|
overridedefault |
|
static |
Definition at line 33 of file SampleTrack.cpp.
References typeInfo().
Referenced by typeInfo2().
|
pure virtual |
Retrieve samples from a track in a specified format.
buffer | receives the samples | |
start | starting sample, relative to absolute time zero (not to the track's offset value) | |
len | how many samples to get. buffer is 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. |
format | sample format of the destination buffer |
Implemented in WaveTrack.
|
pure virtual |
This returns a nonnegative number of samples meant to size a memory buffer.
Implemented in WaveTrack.
|
pure virtual |
This returns a possibly large or negative value.
Implemented in WaveTrack.
|
pure virtual |
Takes gain and pan into account.
Implemented in WaveTrack.
Referenced by AudioIoCallback::AddToOutputChannel().
|
pure virtual |
May be called from a worker thread
Implemented in WaveTrack.
Referenced by AudioIoCallback::TrackHasBeenFadedOut().
|
pure virtual |
Fetch envelope values corresponding to uniformly separated sample times starting at the given time.
Implemented in WaveTrack.
|
inline |
Retrieve samples from a track in floating-point format, regardless of the storage format.
buffer | receives the samples | |
start | starting sample, relative to absolute time zero (not to the track's offset value) | |
len | how many samples to get. buffer is 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. |
Cast the pointer to pass it to Get() which handles multiple destination formats
Definition at line 82 of file SampleTrack.h.
References floatSample, and ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get().
Referenced by SampleTrackSource::Acquire(), EffectNormalize::AnalyseTrackData(), EffectTruncSilence::Analyze(), CompareAudioCommand::Apply(), EffectAutoDuck::ApplyDuckFade(), EffectTruncSilence::DoRemoval(), NyquistEffect::GetCallback(), VoiceKey::OffBackward(), VoiceKey::OffForward(), VoiceKey::OnBackward(), VoiceKey::OnForward(), TrackSpectrumTransformer::Process(), EffectAutoDuck::Process(), VampEffect::Process(), EffectEqualization::ProcessOne(), EffectClickRemoval::ProcessOne(), EffectRepair::ProcessOne(), EffectFindClipping::ProcessOne(), EffectNormalize::ProcessOne(), EffectChangeSpeed::ProcessOne(), EffectSimpleMono::ProcessOne(), EffectTwoPassSimpleMono::ProcessOne(), EffectPaulstretch::ProcessOne(), EffectReverse::ProcessOneClip(), resampleCB(), SelectHandle::StartSnappingFreqSelection(), VoiceKey::TestDirectionChanges(), VoiceKey::TestEnergy(), VoiceKey::TestSignChanges(), and MixerTrackCluster::UpdateMeter().
|
pure virtual |
This returns a nonnegative number of samples meant to size a memory buffer.
Implemented in WaveTrack.
|
pure virtual |
Implemented in WaveTrack.
Referenced by LongSamplesToTime(), and TimeToLongSamples().
|
pure virtual |
Implemented in WaveTrack.
|
overridevirtual |
Implements Track.
Reimplemented in WritableSampleTrack, and WaveTrack.
Definition at line 38 of file SampleTrack.cpp.
References typeInfo().
|
pure virtual |
Implemented in WaveTrack.
double SampleTrack::LongSamplesToTime | ( | sampleCount | pos | ) | const |
Convert correctly between a number of samples and an (absolute) time in seconds.
pos | The time number of samples from the start of the track to convert. |
Definition at line 48 of file SampleTrack.cpp.
References sampleCount::as_double(), and GetRate().
Referenced by AUPImportFileHandle::AddSilence(), anonymous_namespace{SampleHandle.cpp}::adjustTime(), EffectTruncSilence::Analyze(), CompareAudioCommand::Apply(), EffectAutoDuck::ApplyDuckFade(), WaveTrack::ClearAndPaste(), EffectTruncSilence::DoRemoval(), anonymous_namespace{WaveformView.cpp}::DrawClipWaveform(), EffectSBSMS::Finalize(), anonymous_namespace{EditMenus.cpp}::OnSplitNew(), PasteOverPreservingClips(), WaveTrack::PasteWaveTrack(), EffectAutoDuck::Process(), EffectFindClipping::ProcessOne(), EffectChangeSpeed::ProcessOne(), EffectReverse::ProcessOneWave(), and WaveTrack::SplitAt().
sampleCount SampleTrack::TimeToLongSamples | ( | double | t0 | ) | const |
Convert correctly between an (absolute) time in seconds and a number of samples.
This method will not give the correct results if used on a relative time (difference of two times). Each absolute time must be converted and the numbers of samples differenced: sampleCount start = track->TimeToLongSamples(t0); sampleCount end = track->TimeToLongSamples(t1); sampleCount len = (sampleCount)(end - start); NOT the likes of: sampleCount len = track->TimeToLongSamples(t1 - t0); See also SampleTrack::TimeToLongSamples().
t0 | The time (floating point seconds) to convert |
Definition at line 43 of file SampleTrack.cpp.
References GetRate().
Referenced by anonymous_namespace{SampleHandle.cpp}::adjustTime(), EffectNormalize::AnalyseTrackData(), EffectTruncSilence::Analyze(), CompareAudioCommand::Apply(), EffectAutoDuck::ApplyDuckFade(), WaveTrack::ClearAndPaste(), ClipParameters::ClipParameters(), WaveTrack::Disjoin(), EffectTruncSilence::DoRemoval(), BrushHandle::Drag(), anonymous_namespace{WaveformView.cpp}::DrawClipWaveform(), EffectSBSMS::Finalize(), BlockGenerator::GenerateTrack(), Effect::GetBounds(), MixerSource::MixerSource(), anonymous_namespace{EditMenus.cpp}::OnSplitNew(), WaveTrack::PasteWaveTrack(), anonymous_namespace{BrushHandle.cpp}::PositionToLongSample(), EffectAutoDuck::Process(), EffectChangeSpeed::Process(), NyquistEffect::Process(), EffectReverse::Process(), EffectSBSMS::Process(), NyquistEffect::ProcessOne(), EffectLoudness::ProcessOne(), EffectNormalize::ProcessOne(), EffectChangeSpeed::ProcessOne(), EffectPaulstretch::ProcessOne(), EffectReverse::ProcessOneWave(), MixerSource::Reposition(), WaveTrack::Silence(), WaveTrack::SplitAt(), and SelectHandle::StartSnappingFreqSelection().
|
pure virtual |
Implemented in WaveTrack.