11#ifndef __AUDACITY_TRACK__
12#define __AUDACITY_TRACK__
19#include <wx/longlong.h>
30#pragma warning(disable:4284)
49std::pair< ListOfTracks::iterator, ListOfTracks* >;
52{
return a.second == b.second && a.first == b.first; }
63#define ENUMERATE_TRACK_TYPE(T) ENUMERATE_TYPE(TrackTypeTag, T)
67 std::enable_if_t< std::is_pointer_v<T>, T >
72 std::is_pointer_v<T> &&
73 std::is_const_v< std::remove_pointer_t< T > >,
119 std::unique_ptr<TrackIntervalData>
pExtra = {} )
136 std::unique_ptr< TrackIntervalData >
pExtra;
160 ,
public std::enable_shared_from_this<Track>
178 struct ChannelGroupData;
190 bool mSelected{
false };
223 template<
typename Sub
class = Track>
228 return std::static_pointer_cast<Subclass>( shared_from_this() );
231 template<
typename Sub
class = const Track>
234 std::is_const_v<Subclass>,
std::shared_ptr<Subclass>
239 return std::static_pointer_cast<Subclass>( shared_from_this() );
243 template<
typename Sub
class = Track>
245 {
return pTrack ? pTrack->
SharedPointer<Subclass>() :
nullptr; }
247 template<
typename Sub
class = const Track>
249 {
return pTrack ? pTrack->
SharedPointer<Subclass>() :
nullptr; }
253 std::shared_ptr<Track> SubstitutePendingChangedTrack();
254 std::shared_ptr<const Track> SubstitutePendingChangedTrack()
const;
258 std::shared_ptr<const Track> SubstituteOriginalTrack()
const;
275 bool concrete =
false;
280 for (
auto pInfo = &other;
288 static const TypeInfo &ClassTypeInfo();
290 {
return GetTypeInfo().names; }
293 virtual bool SupportsBasicEditing()
const;
325 virtual bool LinkConsistencyFix(
bool doFix =
true,
bool completeList =
true);
329 {
return const_cast<Track*
>(
this)->LinkConsistencyFix(
false, completeList); }
331 bool HasOwner()
const {
return static_cast<bool>(GetOwner());}
333 std::shared_ptr<TrackList>
GetOwner()
const {
return mList.lock(); }
335 LinkType GetLinkType() const noexcept;
337 bool IsAlignedWithLeader() const;
339 ChannelGroupData &GetGroupData();
340 const ChannelGroupData &GetGroupData() const;
347 void SetLinkType(LinkType linkType,
bool completeList = true);
350 int GetIndex() const;
351 void SetIndex(
int index);
353 ChannelGroupData &MakeGroupData();
357 void DoSetLinkType(LinkType linkType,
bool completeList = true);
359 Track* GetLinkedTrack() const;
361 bool HasLinkedTrack() const noexcept;
385 virtual
Holder Duplicate() const;
388 const wxString &GetName() const;
389 void SetName( const wxString &n );
392 bool GetSelected() const;
393 virtual
void SetSelected(
bool s);
401 virtual
double GetOffset() const = 0;
403 void Offset(
double t) { SetOffset(GetOffset() + t); }
409 virtual Holder Cut(
double WXUNUSED(t0),
double WXUNUSED(t1)) = 0;
418 (
double WXUNUSED(t0),
double WXUNUSED(t1),
bool forClipboard =
true)
const = 0;
421 virtual void Clear(
double WXUNUSED(t0),
double WXUNUSED(t1)) = 0;
423 virtual void Paste(
double WXUNUSED(t),
const Track * WXUNUSED(src)) = 0;
427 virtual void SyncLockAdjust(
double oldT1,
double newT1);
430 virtual void Silence(
double WXUNUSED(t0),
double WXUNUSED(t1)) = 0;
441 friend std::enable_if_t< std::is_pointer_v<T>, T >
444 friend std::enable_if_t<
445 std::is_pointer_v<T> &&
446 std::is_const_v< std::remove_pointer_t< T > >,
456 template <
typename R =
void >
463 template<
typename ...Params >
470 template<
typename Tag,
typename R,
typename ArgumentType,
471 typename Function,
typename ...Functions >
475 std::conditional_t< std::is_const_v<ArgumentType>,
481 enum :
unsigned { SetUsed = Tail::SetUsed << 1 };
486 const Function &,
const Functions &...functions)
const
487 {
return Tail{}( pTrack, functions... ); }
491 template<
typename R,
typename BaseClass,
typename ArgumentType,
496 std::conditional_t< std::is_const_v<ArgumentType>,
499 std::conditional_t< std::is_const_v<ArgumentType>,
500 const BaseClass, BaseClass >;
503 enum :
unsigned { SetUsed = 1u };
512 template<
typename Tag,
513 typename R,
typename BaseClass,
typename ArgumentType,
514 typename Function,
typename ...Functions >
518 std::conditional_t< std::is_const_v<ArgumentType>,
521 std::conditional_t< std::is_const_v<ArgumentType>,
522 const BaseClass, BaseClass >;
527 enum :
unsigned { SetUsed = (Tail::SetUsed << 1) | 1u };
532 const Functions &...functions)
const
535 return Tail{}( pTrack, functions... );
543 template<
typename ... >
struct Switch {};
547 template<
typename Tag,
typename R,
typename ArgumentType>
551 template<
typename Function,
typename ...Functions >
553 ->
inapplicable< Tag, R, ArgumentType, Function, Functions... >;
558 template<
typename Tag,
typename R,
typename ArgumentType,
559 typename BaseClass,
typename ...BaseClasses>
561 TypeList::List<BaseClass, BaseClasses...>>
564 std::conditional_t< std::is_const_v<ArgumentType>,
565 const BaseClass, BaseClass >;
574 template<
typename Function,
typename ...Functions >
575 static auto test(
const void * )
576 ->
decltype( Retry::template test< Function, Functions... >() );
582 template<
typename Function,
typename ...Functions >
583 static auto test( std::true_type * )
585 (void) std::declval<Function>()
595 template<
typename Function,
typename ...Functions >
596 static auto test( std::true_type * )
598 (void) std::declval<Function>()
602 Function, Functions... >{}
606 static constexpr bool Compatible =
607 std::is_base_of_v<BaseClass, ArgumentType>;
609 template<
typename Function,
typename ...Functions >
612 test< Function, Functions... >(
613 (std::integral_constant<bool, Compatible>*)
nullptr) );
618 template<
typename Tag,
typename R,
typename ArgumentType >
623 enum :
unsigned { SetUsed = 0 };
625 R operator () (
const void *, ...)
627 if constexpr (std::is_void_v<R>)
636 template<
typename Tag,
typename R,
typename ArgumentType,
637 typename Function,
typename ...Functions >
638 struct Executor< Tag, R, ArgumentType, Function, Functions... >
640 Dispatcher::Switch<Tag, R, ArgumentType,
644 typename TypeEnumerator::CollectTypes<TrackTypeTag, Tag>::type>
645 >::template test<Function, Functions... >())
652 template<
typename TrackType>
656 std::is_same_v<Track, TrackType> ||
657 std::is_same_v<const Track, TrackType>,
"Error" );
659 template<
typename R,
typename TrackType,
typename... Functions>
660 static R
CallExecutor(R*, std::tuple<>*, TrackType&,
const Functions&...)
666 checkTrackType<TrackType>();
667 if constexpr (std::is_void_v<R>)
673 typename R,
typename TrackType,
typename... Functions,
674 typename Executor,
typename... Executors>
676 R*, std::tuple<Executor, Executors...>*, TrackType &track,
677 const Functions &...functions)
679 checkTrackType<TrackType>();
680 const auto &info = Executor::NominalType::ClassTypeInfo();
684 if ( info.IsBaseOf(track.GetTypeInfo()) )
686 return Executor{}(&track, functions...);
689 return CallExecutor( (R*)
nullptr,
690 (std::tuple<Executors...>*)
nullptr, track, functions...);
693 template<
typename ...Executors>
694 static constexpr unsigned UsedCases(std::tuple<Executors...>*)
696 return (Executors::SetUsed | ...);
704 typename ...TrackTypes,
705 typename ...Functions
708 std::conditional_t<IsConst, const Track, Track> &track,
710 const Functions &...functions )
715 using Executors = std::tuple<
Executor<
717 std::conditional_t<IsConst, const TrackTypes, TrackTypes>,
721 constexpr Executors *executors =
nullptr;
724 enum { All =
sizeof...( functions ) };
725 static_assert( (1u << All) - 1u == UsedCases(executors),
726 "Uncallable case in Track::TypeSwitch");
729 return CallExecutor((R *)
nullptr, executors, track, functions...);
753 typename ...Functions
757 struct Tag : TrackTypeTag {};
762 return DoTypeSwitch<Tag, false, R>(*
this, TrackTypes{}, functions...);
770 typename ...Functions
774 struct Tag : TrackTypeTag {};
779 return DoTypeSwitch<Tag, true, R>(*
this, TrackTypes{}, functions...);
795 void Notify(
bool allChannels,
int code = -1);
801 bool IsSelected()
const;
802 bool IsLeader()
const;
803 bool IsSelectedLeader()
const;
806 void AdjustPositions();
809 void WriteCommonXMLAttributes(
810 XMLWriter &xmlFile,
bool includeNameAndSelected =
true)
const;
827 inline std::enable_if_t< std::is_pointer_v<T>, T >
830 using BareType = std::remove_pointer_t< T >;
832 BareType::ClassTypeInfo().IsBaseOf(track->
GetTypeInfo() ))
833 return reinterpret_cast<T
>(track);
841 inline std::enable_if_t<
842 std::is_pointer_v<T> && std::is_const_v< std::remove_pointer_t< T > >,
847 using BareType = std::remove_pointer_t< T >;
849 BareType::ClassTypeInfo().IsBaseOf(track->
GetTypeInfo() ))
850 return reinterpret_cast<T
>(track);
868 :
public ValueIterator< TrackType *, std::bidirectional_iterator_tag >
873 std::add_pointer_t< std::add_const_t< std::remove_pointer_t<TrackType> > >
884 ,
mPred( std::move(pred) )
894 template <
typename Predicate2 >
903 template <
typename TrackType2 >
906 std::is_base_of_v< TrackType, TrackType2 > &&
907 (!
std::is_const_v<TrackType> ||
908 std::is_const_v<TrackType2>),
916 {
return this->
mPred; }
970 return static_cast< TrackType *
>( &**this->
mIter.first );
979 std::advance(
copy, amount );
1009 const auto pTrack = track_cast< TrackType * >( &**this->
mIter.first );
1012 return !this->
mPred || this->
mPred( pTrack );
1040 template<
typename Predicate2 >
1043 const auto &pred1 = this->first.GetPredicate();
1045 const auto &newPred = pred1
1046 ? Function{ [=] (
typename Function::argument_type track) {
1047 return pred1(track) && pred2(track);
1049 : Function{ pred2 };
1051 this->first.Filter( newPred ),
1052 this->second.Filter( newPred )
1058 template<
typename R,
typename C >
1061 return this->
operator + ( std::mem_fn( pmf ) );
1066 template<
typename Predicate2 >
1069 using ArgumentType =
1070 typename TrackIterRange::iterator::FunctionType::argument_type;
1071 auto neg = [=] (ArgumentType track) {
return !pred2( track ); };
1077 template<
typename R,
typename C >
1080 return this->
operator + ( std::not1( std::mem_fn( pmf ) ) );
1083 template<
typename TrackType2 >
1087 this-> first.template Filter< TrackType2 >(),
1088 this->second.template Filter< TrackType2 >()
1094 auto newBegin = this->
find( pTrack );
1099 { newBegin.mIter, newBegin.mIter, this->second.mEnd,
1100 this->first.GetPredicate() },
1101 { newBegin.mIter, this->second.mIter, this->second.mEnd,
1102 this->second.GetPredicate() }
1108 const auto newEnd = this->
reversal().find( pTrack ).base();
1113 { this->first.mBegin, this->first.mIter, newEnd.mIter,
1114 this->first.GetPredicate() },
1115 { this->first.mBegin, newEnd.mIter, newEnd.mIter,
1116 this->second.GetPredicate() }
1124 [=](
const Track *pTrack){
return pExcluded == pTrack; } );
1128 template<
typename ...Functions >
1129 void Visit(
const Functions &...functions)
1131 for (
auto track : *
this)
1132 track->TypeSwitch(functions...);
1137 template<
typename Flag,
typename ...Functions >
1140 if (
flag )
for (
auto track : *
this) {
1141 track->TypeSwitch(functions...);
1180 const std::weak_ptr<Track> &pTrack = {},
int extra = -1)
1199 ,
public std::enable_shared_from_this<TrackList>
1203 using ListOfTracks::push_back;
1247 wxString MakeUniqueTrackName(
const wxString& baseTrackName)
const;
1263 template <
typename TrackType = Track >
1267 if (!pTrack || pTrack->GetOwner().get() !=
this)
1268 return EndIterator<TrackType>();
1270 return MakeTrackIterator<TrackType>( pTrack->GetNode() );
1275 template <
typename TrackType = const Track >
1277 -> std::enable_if_t< std::is_const_v<TrackType>,
1281 if (!pTrack || pTrack->GetOwner().get() !=
this)
1282 return EndIterator<TrackType>();
1284 return MakeTrackIterator<TrackType>( pTrack->GetNode() );
1297 FindLeader(
const_cast<Track*
>(pTrack) ).Filter< const Track >();
1301 template <
typename TrackType = Track >
1305 return Tracks< TrackType >();
1308 template <
typename TrackType = const Track >
1310 ->
std::enable_if_t<
std::is_const_v<TrackType>,
1314 return Tracks< TrackType >();
1318 template <
typename TrackType = Track >
1325 template <
typename TrackType = const Track >
1327 ->
std::enable_if_t<
std::is_const_v<TrackType>,
1335 template <
typename TrackType = Track >
1342 template <
typename TrackType = const Track >
1344 ->
std::enable_if_t<
std::is_const_v<TrackType>,
1352 template <
typename TrackType = Track >
1359 template <
typename TrackType = const Track >
1361 ->
std::enable_if_t<
std::is_const_v<TrackType>,
1369 template<
typename TrackType>
1373 return pTrack->GetOwner()->template Any<TrackType>()
1379 Track *DoAddToHead(
const std::shared_ptr<Track> &t);
1380 Track *DoAdd(
const std::shared_ptr<Track> &t);
1382 template<
typename TrackType,
typename InTrackType >
1390 .template Filter<TrackType>(),
1392 .template Filter<TrackType>()
1398 iter1.template Filter<TrackType>(),
1399 iter1.template Filter<TrackType>()
1405 template<
typename TrackType >
1409 return Channels_<TrackType>( pTrack->GetOwner()->FindLeader(pTrack) );
1415 return Channels(&track).size();
1420 static bool SwapChannels(
Track &track);
1425 void Permute(
const std::vector<TrackNodePointer> &permutation);
1430 template<
typename TrackKind>
1431 TrackKind *
AddToHead(
const std::shared_ptr< TrackKind > &t )
1432 {
return static_cast< TrackKind*
>( DoAddToHead( t ) ); }
1434 template<
typename TrackKind>
1435 TrackKind *
Add(
const std::shared_ptr< TrackKind > &t )
1436 {
return static_cast< TrackKind*
>( DoAdd( t ) ); }
1439 void UnlinkChannels(
Track& track);
1448 bool MakeMultiChannelTrack(
Track& first,
int nChannels,
bool aligned);
1452 ListOfTracks::value_type Replace(
1453 Track * t,
const ListOfTracks::value_type &with);
1459 void Clear(
bool sendEvent =
true);
1461 bool CanMoveUp(
Track * t)
const;
1462 bool CanMoveDown(
Track * t)
const;
1464 bool MoveUp(
Track * t);
1465 bool MoveDown(
Track * t);
1466 bool Move(
Track * t,
bool up) {
return up ? MoveUp(t) : MoveDown(t); }
1469 bool Contains(
const Track * t)
const;
1473 template <
typename Sub
class>
1474 std::shared_ptr<Subclass>
Lock(
const std::weak_ptr<Subclass> &wTrack)
1476 auto pTrack = wTrack.lock();
1478 auto pList = pTrack->mList.lock();
1479 if (pTrack &&
this == pList.get())
1486 size_t NChannels()
const;
1487 size_t Size()
const {
return Leaders().size(); }
1492 double GetMinOffset()
const;
1499 typename TrackType =
Track,
1506 auto b = getBegin(), e = getEnd();
1507 return { { b, b, e, pred }, { b, e, e, pred } };
1512 typename TrackType =
const Track,
1517 -> std::enable_if_t< std::is_const_v<TrackType>,
1521 auto b =
const_cast<TrackList*
>(
this)->getBegin();
1522 auto e =
const_cast<TrackList*
>(
this)->getEnd();
1523 return { { b, b, e, pred }, { b, e, e, pred } };
1526 Track *GetPrev(
Track * t,
bool linked =
false)
const;
1527 Track *GetNext(
Track * t,
bool linked =
false)
const;
1529 template <
typename TrackType >
1533 auto b =
const_cast<TrackList*
>(
this)->getBegin();
1534 auto e =
const_cast<TrackList*
>(
this)->getEnd();
1535 return { b, iter, e };
1538 template <
typename TrackType >
1542 auto e =
const_cast<TrackList*
>(
this)->getEnd();
1550 || (p.second == &mPendingUpdates && p.first == mPendingUpdates.end()); }
1571 if (p == getBegin())
1582 void SelectionEvent(
Track &track);
1585 const std::shared_ptr<Track> &pTrack,
bool allChannels,
int code );
1586 void EnsureVisibleEvent(
1587 const std::shared_ptr<Track> &pTrack,
bool modifyState );
1588 void DeletionEvent(std::weak_ptr<Track> node,
bool duringReplace);
1615 std::shared_ptr<Track> RegisterPendingChangedTrack(
1626 void RegisterPendingNewTrack(
const std::shared_ptr<Track> &pTrack );
1630 void UpdatePendingTracks();
1634 void ClearPendingTracks(
ListOfTracks *pAdded =
nullptr );
1640 bool ApplyPendingTracks();
1642 bool HasPendingTracks()
const;
Utility ClientData::Site to register hooks into a host class that attach client data.
std::vector< Track * > TrackArray
ClientData::Site< Track, TrackAttachment, ClientData::ShallowCopying, std::shared_ptr > AttachedTrackObjects
Template generated base class for Track lets it host opaque UI related objects.
#define ENUMERATE_TRACK_TYPE(T)
Empty class which will have subclasses.
bool operator==(const TrackNodePointer &a, const TrackNodePointer &b)
bool operator!=(const TrackNodePointer &a, const TrackNodePointer &b)
std::pair< ListOfTracks::iterator, ListOfTracks * > TrackNodePointer
Pairs a std::list iterator and a pointer to a list, for comparison purposes.
std::list< std::shared_ptr< Track > > ListOfTracks
std::enable_if_t< std::is_pointer_v< T >, T > track_cast(Track *track)
Encapsulate the checked down-casting of track pointers.
abstract base class for structures that user interface associates with tracks
Make a list of all distinct types so far mentioned in calls of a certain macro.
#define BEGIN_TYPE_ENUMERATION(Tag)
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Utility to register hooks into a host class that attach client data.
A start and an end time, and non-mutative access to optional extra information.
ConstTrackInterval(ConstTrackInterval &&)=default
std::unique_ptr< TrackIntervalData > pExtra
ConstTrackInterval(double start, double end, std::unique_ptr< TrackIntervalData > pExtra={})
const TrackIntervalData * Extra() const
ConstTrackInterval & operator=(ConstTrackInterval &&)=default
An object that sends messages to an open-ended list of subscribed callbacks.
Holds various per-project settings values, and sends events to the project when certain values change...
Abstract base class for an object holding data associated with points on a time axis.
static void checkTrackType()
std::function< R() > Continuation
Type of arguments passed as optional second parameter to TypeSwitch() cases.
virtual void SetOffset(double o)
bool SameKindAs(const Track &track) const
static R CallExecutor(R *, std::tuple<> *, TrackType &, const Functions &...)
virtual void Paste(double WXUNUSED(t), const Track *WXUNUSED(src))=0
virtual Holder Cut(double WXUNUSED(t0), double WXUNUSED(t1))=0
virtual Holder PasteInto(AudacityProject &) const =0
Find or create the destination track for a paste, maybe in a different project.
virtual void Clear(double WXUNUSED(t0), double WXUNUSED(t1))=0
virtual const TypeInfo & GetTypeInfo() const =0
virtual double GetStartTime() const =0
virtual Holder Clone() const =0
bool IsSelectedLeader() const
virtual Holder Copy(double WXUNUSED(t0), double WXUNUSED(t1), bool forClipboard=true) const =0
static R CallExecutor(R *, std::tuple< Executor, Executors... > *, TrackType &track, const Functions &...functions)
std::pair< int, int > vrulerSize
std::shared_ptr< TrackList > GetOwner() const
R TypeSwitch(const Functions &...functions)
Use this function rather than testing track type explicitly and making down-casts.
static std::shared_ptr< Subclass > SharedPointer(Track *pTrack)
virtual const TypeNames & GetTypeNames() const
auto SharedPointer() const -> std::enable_if_t< std::is_const_v< Subclass >, std::shared_ptr< Subclass > >
std::shared_ptr< Subclass > SharedPointer()
std::shared_ptr< Track > Holder
bool LinkConsistencyCheck(bool completeList)
Do the non-mutating part of consistency fix only and return status.
virtual void WriteXML(XMLWriter &xmlFile) const =0
R TypeSwitch(const Functions &...functions) const
Use this function rather than testing track type explicitly and making down-casts.
virtual void Silence(double WXUNUSED(t0), double WXUNUSED(t1))=0
Continuation<> Fallthrough
Type of arguments passed as optional second parameter to TypeSwitch<void>() cases.
static R DoTypeSwitch(std::conditional_t< IsConst, const Track, Track > &track, TypeList::List< TrackTypes... >, const Functions &...functions)
Deduce two packs from arguments.
std::weak_ptr< TrackList > mList
virtual double GetEndTime() const =0
std::vector< Interval > Intervals
virtual void InsertSilence(double WXUNUSED(t), double WXUNUSED(len))=0
static constexpr unsigned UsedCases(std::tuple< Executors... > *)
LinkType
For two tracks describes the type of the linkage.
virtual bool GetErrorOpening()
int mIndex
0-based position of this track in its TrackList
static std::shared_ptr< Subclass > SharedPointer(const Track *pTrack)
std::unique_ptr< ChannelGroupData > mpGroupData
std::vector< ConstInterval > ConstIntervals
TrackId mId
Identifies the track only in-session, not persistently.
An in-session identifier of track objects across undo states. It does not persist between sessions.
bool operator!=(const TrackId &other) const
bool operator<(const TrackId &other) const
bool operator==(const TrackId &other) const
A start and an end time, and mutative access to optional extra information.
TrackIntervalData * Extra() const
TrackInterval(TrackInterval &&)=default
TrackInterval & operator=(TrackInterval &&)=default
Iterator over only members of a TrackList of the specified subtype, optionally filtered by a predicat...
const FunctionType & GetPredicate() const
TrackNodePointer mIter
Current position.
TrackType * operator*() const
Safe to call even when at the end.
TrackIter & operator--()
Safe to call even when at the beginning.
friend bool operator!=(TrackIter a, TrackIter b)
Compares only current positions, assuming same beginnings and ends.
auto Filter() const -> std::enable_if_t< std::is_base_of_v< TrackType, TrackType2 > &&(!std::is_const_v< TrackType >||std::is_const_v< TrackType2 >), TrackIter< TrackType2 > >
Return an iterator for a subclass of TrackType (and not removing const) with same predicate.
TrackNodePointer mBegin
Allows end of reverse iteration to be detected without comparison to other TrackIter.
friend bool operator==(TrackIter a, TrackIter b)
Compares only current positions, assuming same beginnings and ends.
TrackIter Filter(const Predicate2 &pred2) const
Return an iterator that replaces the predicate.
TrackIter & operator++()
Safe to call even when at the end.
std::function< bool(std::add_pointer_t< std::add_const_t< std::remove_pointer_t< TrackType > > >) > FunctionType
Type of predicate taking pointer to const TrackType.
TrackIter advance(long amount) const
This might be called operator + , but it's not constant-time as with a random access iterator.
FunctionType mPred
Optional filter
TrackIter(TrackNodePointer begin, TrackNodePointer iter, TrackNodePointer end, FunctionType pred={})
Constructor, usually not called directly except by methods of TrackList.
bool valid() const
Test satisfaction of the invariant, while initializing, incrementing, or decrementing.
TrackNodePointer mEnd
Allows end of iteration to be detected without comparison to other TrackIter.
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
std::shared_ptr< Subclass > Lock(const std::weak_ptr< Subclass > &wTrack)
static auto SingletonRange(TrackType *pTrack) -> TrackIterRange< TrackType >
auto Selected() const -> std::enable_if_t< std::is_const_v< TrackType >, TrackIterRange< TrackType > >
bool Move(Track *t, bool up)
const_iterator begin() const
auto Find(const Track *pTrack) const -> std::enable_if_t< std::is_const_v< TrackType >, TrackIter< TrackType > >
Turn a pointer into a TrackIter (constant time); get end iterator if this does not own the track.
auto SelectedLeaders() -> TrackIterRange< TrackType >
std::vector< Updater > mUpdaters
This is in correspondence with mPendingUpdates.
TrackNodePointer getBegin() const
auto Tracks(const Pred &pred={}) const -> std::enable_if_t< std::is_const_v< TrackType >, TrackIterRange< TrackType > >
TrackIter< const Track > FindLeader(const Track *pTrack) const
auto Leaders() -> TrackIterRange< TrackType >
static size_t NChannels(const Track &track)
Count channels of a track.
TrackKind * Add(const std::shared_ptr< TrackKind > &t)
auto Tracks(const Pred &pred={}) -> TrackIterRange< TrackType >
bool isNull(TrackNodePointer p) const
TrackNodePointer getNext(TrackNodePointer p) const
Move an iterator to the next node, if any; else stay at end.
auto Find(Track *pTrack) -> TrackIter< TrackType >
Turn a pointer into a TrackIter (constant time); get end iterator if this does not own the track.
auto Any() -> TrackIterRange< TrackType >
TrackNodePointer getEnd() const
std::function< void(Track &dest, const Track &src) > Updater
TrackIter< TrackType > EndIterator() const
auto Any() const -> std::enable_if_t< std::is_const_v< TrackType >, TrackIterRange< TrackType > >
auto Leaders() const -> std::enable_if_t< std::is_const_v< TrackType >, TrackIterRange< TrackType > >
static TrackIterRange< TrackType > Channels_(TrackIter< InTrackType > iter1)
const AudacityProject * GetOwner() const
const_iterator cend() const
auto Selected() -> TrackIterRange< TrackType >
const_iterator cbegin() const
AudacityProject * GetOwner()
TrackIter< TrackType > MakeTrackIterator(TrackNodePointer iter) const
TrackList(const TrackList &that)=delete
TrackList(TrackList &&that)=delete
TrackNodePointer getPrev(TrackNodePointer p) const
Move an iterator to the previous node, if any; else wrap to end.
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
ListOfTracks mPendingUpdates
Shadow tracks holding append-recording in progress; need to put them into a list so that GetLink() wo...
TrackKind * AddToHead(const std::shared_ptr< TrackKind > &t)
Add a Track, giving it a fresh id.
const_iterator end() const
auto SelectedLeaders() const -> std::enable_if_t< std::is_const_v< TrackType >, TrackIterRange< TrackType > >
Holds a msgid for the translation catalog; may also bind format arguments.
typename Accumulate< 0 >::type type
A view into an attribute value. The class does not take the ownership of the data.
This class is an interface which should be implemented by classes which wish to be able to load and s...
Base class for XMLFileWriter and XMLStringWriter that provides the general functionality for creating...
PROJECT_FILE_IO_API void Remove(const FilePath &path)
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
@ ShallowCopying
copy pointers only; won't compile for std::unique_ptr
@ DeepCopying
point to new sub-objects; these must define a Clone() member; won't compile for std::weak_ptr
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
auto begin(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Utilities for compile-time type manipulation. Some terminology as in Lisp.
typename Reverse< TypeList >::type Reverse_t
void swap(std::unique_ptr< Alg_seq > &a, std::unique_ptr< Alg_seq > &b)
void Notify(AudacityProject &project, ProjectSettings::EventCode code, long previousValue)
void copy(const T *src, T *dst, int32_t n)
A convenient default parameter for class template Site.
A convenient base class defining abstract virtual Clone() for a given kind of pointer.
A convenience for use with range-for.
iterator find(const T &t) const
IteratorRange< reverse_iterator > reversal() const
TrackIter< TrackType > end() const
TrackIter< TrackType > begin() const
std::conditional_t< std::is_const_v< ArgumentType >, const BaseClass, BaseClass > QualifiedBaseClass
static auto test() -> decltype(test< Function, Functions... >((std::integral_constant< bool, Compatible > *) nullptr))
undefined function used in decltype only to compute a type, using other overloads
static auto test(const void *) -> decltype(Retry::template test< Function, Functions... >())
Catch-all overload of undefined function used in decltype only.
static auto test(std::true_type *) -> decltype((void) std::declval< Function >()((QualifiedBaseClass *) nullptr, std::declval< Continuation< R > >()), applicable2< Tag, R, BaseClass, ArgumentType, Function, Functions... >{})
overload when upcast of ArgumentType* works, with sfinae'd return type
static auto test(std::true_type *) -> decltype((void) std::declval< Function >()((QualifiedBaseClass *) nullptr), applicable1< R, BaseClass, ArgumentType, Function >{})
overload when upcast of ArgumentType* works, with sfinae'd return type
static auto test() -> inapplicable< Tag, R, ArgumentType, Function, Functions... >
No BaseClass of ArgumentType is acceptable to Function.
Variadic template implements metafunction with specializations, to choose among implementations of op...
Second, nonrecursive case of metafunction, generates operator () that calls function without fallthro...
std::conditional_t< std::is_const_v< ArgumentType >, const BaseClass, BaseClass > QualifiedBaseClass
std::conditional_t< std::is_const_v< ArgumentType >, const Track, Track > QualifiedTrackType
Third, recursive case of metafunction, generates operator () that calls function with fallthrough.
std::conditional_t< std::is_const_v< ArgumentType >, const Track, Track > QualifiedTrackType
std::conditional_t< std::is_const_v< ArgumentType >, const BaseClass, BaseClass > QualifiedBaseClass
First, recursive case of metafunction, defers generation of operator ()
std::conditional_t< std::is_const_v< ArgumentType >, const Track, Track > QualifiedTrackType
Helper for recursive case of metafunction implementing Track::TypeSwitch.
Variadic template implements metafunction with specializations, to dispatch Track::TypeSwitch.
Empty argument passed to some public constructors.
bool IsBaseOf(const TypeInfo &other) const
const TypeInfo * pBaseInfo
Names of a track type for various purposes.
wxString info
short, like "wave", in macro output, not internationalized
TranslatableString name
long, like "Wave Track"
wxString property
short, like "wave", as a Lisp symbol property, not internationalized
Optional extra information about an interval, appropriate to a subtype of Track.
virtual ~TrackIntervalData()
Range between two TrackIters, usable in range-for statements, and with Visit member functions.
TrackIterRange EndingAfter(const Track *pTrack) const
void VisitWhile(Flag &flag, const Functions &...functions)
See Track::TypeSwitch.
TrackIterRange operator+(const Predicate2 &pred2) const
TrackIterRange(const TrackIter< TrackType > &begin, const TrackIter< TrackType > &end)
void Visit(const Functions &...functions)
See Track::TypeSwitch.
TrackIterRange< TrackType2 > Filter() const
TrackIterRange Excluding(const TrackType *pExcluded) const
TrackIterRange operator-(const Predicate2 &pred2) const
TrackIterRange StartingWith(const Track *pTrack) const
Notification of changes in individual tracks of TrackList, or of TrackList's composition.
TrackListEvent(const TrackListEvent &)=default
const std::weak_ptr< Track > mpTrack
@ RESIZING
Posted when some track changed its height.
@ SELECTION_CHANGE
Posted when the set of selected tracks changes.
@ DELETION
Posted when a track has been deleted from a tracklist. Also posted when one track replaces another.
@ ADDITION
Posted when a track has been added to a tracklist. Also posted when one track replaces another.
@ PERMUTED
Posted when tracks are reordered but otherwise unchanged.
@ TRACK_REQUEST_VISIBLE
Posted when a track needs to be scrolled into view.
@ TRACK_DATA_CHANGE
Posted when certain fields of a track change.
TrackListEvent(Type type, const std::weak_ptr< Track > &pTrack={}, int extra=-1)
Primary template for a list of arbitrary types.
Holds one item with description and time range for the UndoManager.
A convenience for defining iterators that return rvalue types, so that they cooperate correctly with ...