Audacity 3.2.0
Classes | Functions
anonymous_namespace{WaveTrack.cpp} Namespace Reference

Classes

struct  SplitInfo
 

Functions

bool AreAligned (const WaveClipPointers &a, const WaveClipPointers &b)
 
Track::LinkType ToLinkType (int value)
 
WaveClipHolders::const_iterator FindClip (const WaveClipHolders &list, const WaveClip *clip, int *distance=nullptr)
 
WaveClipHolders::iterator FindClip (WaveClipHolders &list, const WaveClip *clip, int *distance=nullptr)
 
bool IsValidChannel (const int nValue)
 
template<typename Cont1 , typename Cont2 >
Cont1 FillSortedClipArray (const Cont2 &mClips)
 

Function Documentation

◆ AreAligned()

bool anonymous_namespace{WaveTrack.cpp}::AreAligned ( const WaveClipPointers a,
const WaveClipPointers b 
)

Definition at line 66 of file WaveTrack.cpp.

67{
68 if (a.size() != b.size())
69 return false;
70
71 const auto compare = [](const WaveClip* a, const WaveClip* b) {
72 // clips are aligned if both sequence start/end
73 // points and play start/end points of the first clip match
74 // the corresponding points of the other clip
75 return a->GetPlayStartTime() == b->GetPlayStartTime() &&
76 a->GetSequenceStartTime() == b->GetSequenceStartTime() &&
77 a->GetPlayEndTime() == b->GetPlayEndTime() &&
78 a->GetSequenceEndTime() == b->GetSequenceEndTime();
79 };
80
81 return std::mismatch(a.begin(), a.end(), b.begin(), compare).first == a.end();
82}
This allows multiple clips to be a part of one WaveTrack.
Definition: WaveClip.h:101
double GetSequenceStartTime() const noexcept
Definition: WaveClip.cpp:956
double GetPlayStartTime() const noexcept
Definition: WaveClip.cpp:878
double GetPlayEndTime() const
Definition: WaveClip.cpp:888
double GetSequenceEndTime() const
Definition: WaveClip.cpp:968

Referenced by WaveTrack::LinkConsistencyFix().

Here is the caller graph for this function:

◆ FillSortedClipArray()

template<typename Cont1 , typename Cont2 >
Cont1 anonymous_namespace{WaveTrack.cpp}::FillSortedClipArray ( const Cont2 &  mClips)

Definition at line 2447 of file WaveTrack.cpp.

2448 {
2449 Cont1 clips;
2450 for (const auto &clip : mClips)
2451 clips.push_back(clip.get());
2452 std::sort(clips.begin(), clips.end(),
2453 [](const WaveClip *a, const WaveClip *b)
2454 { return a->GetPlayStartTime() < b->GetPlayStartTime(); });
2455 return clips;
2456 }

◆ FindClip() [1/2]

WaveClipHolders::const_iterator anonymous_namespace{WaveTrack.cpp}::FindClip ( const WaveClipHolders list,
const WaveClip clip,
int *  distance = nullptr 
)

Definition at line 980 of file WaveTrack.cpp.

981 {
982 if (distance)
983 *distance = 0;
984 auto it = list.begin();
985 for (const auto end = list.end(); it != end; ++it)
986 {
987 if (it->get() == clip)
988 break;
989 if (distance)
990 ++*distance;
991 }
992 return it;
993 }
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Definition: PackedArray.h:159

References PackedArray::end().

Here is the call graph for this function:

◆ FindClip() [2/2]

WaveClipHolders::iterator anonymous_namespace{WaveTrack.cpp}::FindClip ( WaveClipHolders list,
const WaveClip clip,
int *  distance = nullptr 
)

Definition at line 996 of file WaveTrack.cpp.

997 {
998 if (distance)
999 *distance = 0;
1000 auto it = list.begin();
1001 for (const auto end = list.end(); it != end; ++it)
1002 {
1003 if (it->get() == clip)
1004 break;
1005 if (distance)
1006 ++*distance;
1007 }
1008 return it;
1009 }

References PackedArray::end().

Referenced by WaveTrack::GetClipIndex(), WaveTrack::HandleClear(), WaveTrack::Join(), WaveTrack::MergeClips(), and WaveTrack::RemoveAndReturnClip().

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

◆ IsValidChannel()

bool anonymous_namespace{WaveTrack.cpp}::IsValidChannel ( const int  nValue)

Definition at line 1650 of file WaveTrack.cpp.

1651{
1652 return (nValue >= Track::LeftChannel) && (nValue <= Track::MonoChannel);
1653}
@ LeftChannel
Definition: Track.h:283
@ MonoChannel
Definition: Track.h:285

References Track::LeftChannel, and Track::MonoChannel.

Referenced by WaveTrack::HandleXMLTag().

Here is the caller graph for this function:

◆ ToLinkType()

Track::LinkType anonymous_namespace{WaveTrack.cpp}::ToLinkType ( int  value)

Definition at line 85 of file WaveTrack.cpp.

86{
87 if (value < 0)
89 else if (value > 3)
91 return static_cast<Track::LinkType>(value);
92}
LinkType
For two tracks describes the type of the linkage.
Definition: Track.h:237

References Track::Group, and Track::None.

Referenced by WaveTrack::HandleXMLTag().

Here is the caller graph for this function: