Audacity 3.2.0
Functions
anonymous_namespace{SyncLock.cpp} Namespace Reference

Functions

bool IsSyncLockableNonSeparatorTrack (const Track *pTrack)
 
bool IsSeparatorTrack (const Track *pTrack)
 
bool IsGoodNextSyncLockTrack (const Track *t, bool inSeparatorSection)
 
std::pair< Track *, Track * > FindSyncLockGroup (Track *pMember)
 

Function Documentation

◆ FindSyncLockGroup()

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

Definition at line 118 of file SyncLock.cpp.

119{
120 if (!pMember)
121 return { nullptr, nullptr };
122
123 // A non-trivial sync-locked group is a maximal sub-sequence of the tracks
124 // consisting of any positive number of audio tracks followed by zero or
125 // more label tracks.
126
127 // Step back through any label tracks.
128 auto pList = pMember->GetOwner();
129 auto member = pList->Find(pMember);
130 while (*member && IsSeparatorTrack(*member))
131 --member;
132
133 // Step back through the wave and note tracks before the label tracks.
134 Track *first = nullptr;
135 while (*member && IsSyncLockableNonSeparatorTrack(*member)) {
136 first = *member;
137 --member;
138 }
139
140 if (!first)
141 // Can't meet the criteria described above. In that case,
142 // consider the track to be the sole member of a group.
143 return { pMember, pMember };
144
145 auto last = pList->Find(first);
146 auto next = last;
147 bool inLabels = false;
148
149 while (*++next) {
150 if (!IsGoodNextSyncLockTrack(*next, inLabels))
151 break;
152 last = next;
153 inLabels = IsSeparatorTrack(*last);
154 }
155
156 return { first, *last };
157}
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:341
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:122
std::shared_ptr< TrackList > GetOwner() const
Definition: Track.h:254
bool IsSeparatorTrack(const Track *pTrack)
Definition: SyncLock.cpp:62
bool IsSyncLockableNonSeparatorTrack(const Track *pTrack)
Definition: SyncLock.cpp:57
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 if (!t)
71 return false;
72 const bool isSeparator = IsSeparatorTrack(t);
73 if (inSeparatorSection)
74 return isSeparator;
75 else if (isSeparator)
76 return true;
77 else
79}

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 pTrack)
inline

Definition at line 62 of file SyncLock.cpp.

63{
64 return pTrack &&
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 pTrack)
inline

Definition at line 57 of file SyncLock.cpp.

58{
59 return pTrack && GetSyncLockPolicy::Call(*pTrack) == SyncLockPolicy::Grouped;
60}
@ 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: