Audacity 3.2.0
Functions
anonymous_namespace{SyncLock.cpp} Namespace Reference

Functions

bool IsSyncLockableNonSeparatorTrack (const Track &track)
 
bool IsSeparatorTrack (const Track &track)
 
bool IsGoodNextSyncLockTrack (const Track &t, bool inSeparatorSection)
 
std::pair< Track *, Track * > FindSyncLockGroup (Track &member)
 

Function Documentation

◆ FindSyncLockGroup()

std::pair< Track *, Track * > anonymous_namespace{SyncLock.cpp}::FindSyncLockGroup ( Track member)

Definition at line 110 of file SyncLock.cpp.

111{
112 // A non-trivial sync-locked group is a maximal sub-sequence of the tracks
113 // consisting of any positive number of audio tracks followed by zero or
114 // more label tracks.
115
116 // Step back through any label tracks.
117 auto pList = member.GetOwner();
118 auto ppMember = pList->Find(&member);
119 while (*ppMember && IsSeparatorTrack(**ppMember))
120 --ppMember;
121
122 // Step back through the wave and note tracks before the label tracks.
123 Track *first = nullptr;
124 while (*ppMember && IsSyncLockableNonSeparatorTrack(**ppMember)) {
125 first = *ppMember;
126 --ppMember;
127 }
128
129 if (!first)
130 // Can't meet the criteria described above. In that case,
131 // consider the track to be the sole member of a group.
132 return { &member, &member };
133
134 auto last = pList->Find(first);
135 auto next = last;
136 bool inLabels = false;
137
138 while (*++next) {
139 if (!IsGoodNextSyncLockTrack(**next, inLabels))
140 break;
141 last = next;
142 inLabels = IsSeparatorTrack(**last);
143 }
144
145 return { first, *last };
146}
Subclass * Find(const RegisteredFactory &key)
Get a (bare) pointer to an attachment, or null, down-cast it to Subclass *; will not create on demand...
Definition: ClientData.h:342
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:110
std::shared_ptr< TrackList > GetOwner() const
Definition: Track.h:230
bool IsSyncLockableNonSeparatorTrack(const Track &track)
Definition: SyncLock.cpp:58
bool IsSeparatorTrack(const Track &track)
Definition: SyncLock.cpp:63
bool IsGoodNextSyncLockTrack(const Track &t, bool inSeparatorSection)
Definition: SyncLock.cpp:68

References ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Find(), Track::GetOwner(), IsGoodNextSyncLockTrack(), IsSeparatorTrack(), and IsSyncLockableNonSeparatorTrack().

Referenced by SyncLock::Group().

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

◆ IsGoodNextSyncLockTrack()

bool anonymous_namespace{SyncLock.cpp}::IsGoodNextSyncLockTrack ( const Track t,
bool  inSeparatorSection 
)

Definition at line 68 of file SyncLock.cpp.

69{
70 const bool isSeparator = IsSeparatorTrack(t);
71 if (inSeparatorSection)
72 return isSeparator;
73 else if (isSeparator)
74 return true;
75 else
77}

References IsSeparatorTrack(), and IsSyncLockableNonSeparatorTrack().

Referenced by FindSyncLockGroup().

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

◆ IsSeparatorTrack()

bool anonymous_namespace{SyncLock.cpp}::IsSeparatorTrack ( const Track track)
inline

Definition at line 63 of file SyncLock.cpp.

64{
66}
@ EndSeparator
Delimits the end of a group (of which it is a part)
static Return Call(This &obj, Arguments ...arguments)
Invoke the method – but only after static initialization time.

References AttachedVirtualFunction< Tag, Return, This, Arguments >::Call(), and EndSeparator.

Referenced by FindSyncLockGroup(), IsGoodNextSyncLockTrack(), and SyncLock::IsSyncLockSelected().

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

◆ IsSyncLockableNonSeparatorTrack()

bool anonymous_namespace{SyncLock.cpp}::IsSyncLockableNonSeparatorTrack ( const Track track)
inline

Definition at line 58 of file SyncLock.cpp.

59{
61}
@ Grouped
Can be part of a group.

References AttachedVirtualFunction< Tag, Return, This, Arguments >::Call(), and Grouped.

Referenced by FindSyncLockGroup(), IsGoodNextSyncLockTrack(), and SyncLock::IsSyncLockSelected().

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