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 79 of file SyncLock.cpp.

80{
81 if (!pMember)
82 return { nullptr, nullptr };
83
84 // A non-trivial sync-locked group is a maximal sub-sequence of the tracks
85 // consisting of any positive number of audio tracks followed by zero or
86 // more label tracks.
87
88 // Step back through any label tracks.
89 auto pList = pMember->GetOwner();
90 auto member = pList->Find(pMember);
91 while (*member && IsSeparatorTrack(*member) )
92 --member;
93
94 // Step back through the wave and note tracks before the label tracks.
95 Track *first = nullptr;
96 while (*member && IsSyncLockableNonSeparatorTrack(*member)) {
97 first = *member;
98 --member;
99 }
100
101 if (!first)
102 // Can't meet the criteria described above. In that case,
103 // consider the track to be the sole member of a group.
104 return { pMember, pMember };
105
106 auto last = pList->Find(first);
107 auto next = last;
108 bool inLabels = false;
109
110 while (*++next) {
111 if ( ! IsGoodNextSyncLockTrack(*next, inLabels) )
112 break;
113 last = next;
114 inLabels = IsSeparatorTrack(*last);
115 }
116
117 return { first, *last };
118}
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:333
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:225
std::shared_ptr< TrackList > GetOwner() const
Definition: Track.h:409
bool IsSeparatorTrack(const Track *pTrack)
Definition: SyncLock.cpp:23
bool IsSyncLockableNonSeparatorTrack(const Track *pTrack)
Definition: SyncLock.cpp:18
bool IsGoodNextSyncLockTrack(const Track *t, bool inSeparatorSection)
Definition: SyncLock.cpp:29

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 29 of file SyncLock.cpp.

30{
31 if (!t)
32 return false;
33 const bool isSeparator = IsSeparatorTrack(t);
34 if (inSeparatorSection)
35 return isSeparator;
36 else if (isSeparator)
37 return true;
38 else
40}

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 23 of file SyncLock.cpp.

24{
25 return pTrack &&
27}
@ 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 18 of file SyncLock.cpp.

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