Audacity  3.0.3
Functions
anonymous_namespace{WaveTrack.cpp} Namespace Reference

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

71 {
72  if (a.size() != b.size())
73  return false;
74 
75  const auto compare = [](const WaveClip* a, const WaveClip* b) {
76  // clips are aligned if both sequence start/end
77  // points and play start/end points of the first clip match
78  // the corresponding points of the other clip
79  return a->GetPlayStartTime() == b->GetPlayStartTime() &&
80  a->GetSequenceStartTime() == b->GetSequenceStartTime() &&
81  a->GetPlayEndTime() == b->GetPlayEndTime() &&
82  a->GetSequenceEndTime() == b->GetSequenceEndTime();
83  };
84 
85  return std::mismatch(a.begin(), a.end(), b.begin(), compare).first == a.end();
86 }

References WaveClip::GetPlayEndTime(), WaveClip::GetPlayStartTime(), WaveClip::GetSequenceEndTime(), and WaveClip::GetSequenceStartTime().

Referenced by WaveTrack::LinkConsistencyCheck().

Here is the call graph for this function:
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 2583 of file WaveTrack.cpp.

2584  {
2585  Cont1 clips;
2586  for (const auto &clip : mClips)
2587  clips.push_back(clip.get());
2588  std::sort(clips.begin(), clips.end(),
2589  [](const WaveClip *a, const WaveClip *b)
2590  { return a->GetPlayStartTime() < b->GetPlayStartTime(); });
2591  return clips;
2592  }

◆ FindClip() [1/2]

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

Definition at line 1022 of file WaveTrack.cpp.

1023  {
1024  if (distance)
1025  *distance = 0;
1026  auto it = list.begin();
1027  for (const auto end = list.end(); it != end; ++it)
1028  {
1029  if (it->get() == clip)
1030  break;
1031  if (distance)
1032  ++*distance;
1033  }
1034  return it;
1035  }

◆ FindClip() [2/2]

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

Definition at line 1038 of file WaveTrack.cpp.

1039  {
1040  if (distance)
1041  *distance = 0;
1042  auto it = list.begin();
1043  for (const auto end = list.end(); it != end; ++it)
1044  {
1045  if (it->get() == clip)
1046  break;
1047  if (distance)
1048  ++*distance;
1049  }
1050  return it;
1051  }

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

Here is the caller graph for this function:

◆ IsValidChannel()

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

Definition at line 1698 of file WaveTrack.cpp.

1699 {
1700  return (nValue >= Track::LeftChannel) && (nValue <= Track::MonoChannel);
1701 }

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

90 {
91  if (value < 0)
92  return Track::LinkType::None;
93  else if (value > 3)
95  return static_cast<Track::LinkType>(value);
96 }

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

Referenced by WaveTrack::HandleXMLTag().

Here is the caller graph for this function:
WaveClip::GetSequenceEndTime
double GetSequenceEndTime() const
Definition: WaveClip.cpp:1879
WaveClip
This allows multiple clips to be a part of one WaveTrack.
Definition: WaveClip.h:175
Track::LinkType::Group
@ Group
Track::LinkType::None
@ None
WaveClip::GetPlayEndTime
double GetPlayEndTime() const
Definition: WaveClip.cpp:1800
WaveClip::GetSequenceStartTime
double GetSequenceStartTime() const noexcept
Definition: WaveClip.cpp:1867
Track::MonoChannel
@ MonoChannel
Definition: Track.h:278
Track::LinkType
LinkType
For two tracks describes the type of the linkage.
Definition: Track.h:243
Track::LeftChannel
@ LeftChannel
Definition: Track.h:276
WaveClip::GetPlayStartTime
double GetPlayStartTime() const noexcept
Definition: WaveClip.cpp:1790