Audacity  3.2.0
Track.h
Go to the documentation of this file.
1 /*!********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  @file Track.h
6  @brief declares abstract base class Track, TrackList, and iterators over TrackList
7 
8  Dominic Mazzoni
9 
10 **********************************************************************/
11 
12 #ifndef __AUDACITY_TRACK__
13 #define __AUDACITY_TRACK__
14 
15 #include <utility>
16 #include <vector>
17 #include <list>
18 #include <functional>
19 #include <wx/longlong.h>
20 
21 #include "ClientData.h"
22 #include "Observer.h"
23 // TrackAttachment needs to be a complete type for the Windows build, though
24 // not the others, so there is a nested include here:
25 #include "TrackAttachment.h"
26 #include "XMLTagHandler.h"
27 
28 #ifdef __WXMSW__
29 #pragma warning(disable:4284)
30 #endif
31 
32 class wxTextFile;
33 class Track;
34 class ProjectSettings;
35 class AudacityProject;
36 
37 using TrackArray = std::vector< Track* >;
38 
39 class TrackList;
40 
41 using ListOfTracks = std::list< std::shared_ptr< Track > >;
42 
44 
47 std::pair< ListOfTracks::iterator, ListOfTracks* >;
48 
49 inline bool operator == (const TrackNodePointer &a, const TrackNodePointer &b)
50 { return a.second == b.second && a.first == b.first; }
51 
52 inline bool operator != (const TrackNodePointer &a, const TrackNodePointer &b)
53 { return !(a == b); }
54 
55 namespace {
56 
59 
64 
66 template<unsigned U, typename Tag> using EnumeratedTrackType =
67  std::remove_reference_t< decltype( enumerateTrackTypes( Tag{},
68  std::integral_constant<unsigned, U>{} ) ) >;
69 
71 
74 template<typename Tag>
76  template<unsigned U> struct Stop{
77  static constexpr unsigned value = U; };
78  template<unsigned U> struct Count
79  : std::conditional_t<
80  std::is_void_v<EnumeratedTrackType<U, Tag>>,
81  Stop<U>,
82  Count<U + 1>
83  >
84  {};
85 public:
86  static constexpr unsigned value = Count<0>::value;
87 };
88 
90 
95 template<typename Tag>
97  template<typename... Types> struct Stop{
98  using type = std::tuple<Types...>; };
99  template<unsigned U, typename... Types> struct Accumulate;
100  template<unsigned U, typename Type, typename... Types> struct AccumulateType
101  : std::conditional_t< std::is_void_v<Type>,
102  Stop<Types...>,
103  Accumulate<U + 1, Type, Types...>
104  >
105  {};
106  template<unsigned U, typename... Types> struct Accumulate
107  : AccumulateType<U, EnumeratedTrackType<U, Tag>, Types...>
108  {};
109 public:
110  using type = typename Accumulate<0>::type;
111 };
112 
114 template<typename T>
116  struct Tag : TrackTypeCountTag {};
117  static constexpr unsigned value = CountTrackTypes<Tag>::value;
118 };
119 
120 }
121 
123 
124 #define ENUMERATE_TRACK_TYPE(T) namespace { auto enumerateTrackTypes(\
125  TrackTypeCountTag, \
126  std::integral_constant<unsigned, TrackTypeCounter<T>::value>) -> T&; }
127 
128 // forward declarations, so we can make them friends
129 template<typename T>
130  std::enable_if_t< std::is_pointer_v<T>, T >
131  track_cast(Track *track);
132 
133 template<typename T>
134  std::enable_if_t<
135  std::is_pointer_v<T> &&
136  std::is_const_v< std::remove_pointer_t< T > >,
137  T
138  >
139  track_cast(const Track *track);
140 
142 
149 class TrackId
150 {
151 public:
152  TrackId() : mValue(-1) {}
153  explicit TrackId (long value) : mValue(value) {}
154 
155  bool operator == (const TrackId &other) const
156  { return mValue == other.mValue; }
157 
158  bool operator != (const TrackId &other) const
159  { return mValue != other.mValue; }
160 
161  // Define this in case you want to key a std::map on TrackId
162  // The operator does not mean anything else
163  bool operator < (const TrackId &other) const
164  { return mValue < other.mValue; }
165 
166 private:
167  long mValue;
168 };
169 
171 struct TRACK_API TrackIntervalData {
173 };
174 
176 
178 public:
179 
181  ConstTrackInterval( double start, double end,
182  std::unique_ptr<TrackIntervalData> pExtra = {} )
183  : start{ start }, end{ end }, pExtra{ std::move( pExtra ) }
184  {
185  wxASSERT( start <= end );
186  }
187 
190 
191  double Start() const { return start; }
192  double End() const { return end; }
193  const TrackIntervalData *Extra() const { return pExtra.get(); }
194 
195 private:
196  double start, end;
197 protected:
198  // TODO C++17: use std::any instead
199  std::unique_ptr< TrackIntervalData > pExtra;
200 };
201 
203 
205 public:
207 
210 
211  TrackIntervalData *Extra() const { return pExtra.get(); }
212 };
213 
217 >;
218 
220 class TRACK_API Track /* not final */
221  : public XMLTagHandler
222  , public AttachedTrackObjects
223  , public std::enable_shared_from_this<Track> // see SharedPointer()
224 {
225 public:
226 
228  enum class LinkType : int {
229  None = 0, //< No linkage
230  Group = 2, //< Tracks are grouped together
231  Aligned, //< Tracks are grouped and changes should be synchronized
232  };
233 
234 private:
235 
236  friend class TrackList;
237 
238  private:
240  LinkType mLinkType{ LinkType::None };
241 
242  protected:
243  std::weak_ptr<TrackList> mList;
244 
247  int mIndex;
248  wxString mName;
249  wxString mDefaultName;
250 
251  private:
252  bool mSelected;
253 
254  public:
255 
258 
260  {
261  LeftChannel = 0,
262  RightChannel = 1,
263  MonoChannel = 2
264  };
265 
266  TrackId GetId() const { return mId; }
267  private:
268  void SetId( TrackId id ) { mId = id; }
269  public:
270 
271  // Given a bare pointer, find a shared_ptr. Undefined results if the track
272  // is not yet managed by a shared_ptr. Undefined results if the track is
273  // not really of the subclass. (That is, trusts the caller and uses static
274  // not dynamic casting.)
275  template<typename Subclass = Track>
276  inline std::shared_ptr<Subclass> SharedPointer()
277  {
278  // shared_from_this is injected into class scope by base class
279  // std::enable_shared_from_this<Track>
280  return std::static_pointer_cast<Subclass>( shared_from_this() );
281  }
282 
283  template<typename Subclass = const Track>
284  inline auto SharedPointer() const ->
285  std::enable_if_t<
286  std::is_const_v<Subclass>, std::shared_ptr<Subclass>
287  >
288  {
289  // shared_from_this is injected into class scope by base class
290  // std::enable_shared_from_this<Track>
291  return std::static_pointer_cast<Subclass>( shared_from_this() );
292  }
293 
294  // Static overloads of SharedPointer for when the pointer may be null
295  template<typename Subclass = Track>
296  static inline std::shared_ptr<Subclass> SharedPointer( Track *pTrack )
297  { return pTrack ? pTrack->SharedPointer<Subclass>() : nullptr; }
298 
299  template<typename Subclass = const Track>
300  static inline std::shared_ptr<Subclass> SharedPointer( const Track *pTrack )
301  { return pTrack ? pTrack->SharedPointer<Subclass>() : nullptr; }
302 
303  // Find anything registered with TrackList::RegisterPendingChangedTrack and
304  // not yet cleared or applied; if no such exists, return this track
305  std::shared_ptr<Track> SubstitutePendingChangedTrack();
306  std::shared_ptr<const Track> SubstitutePendingChangedTrack() const;
307 
308  // If this track is a pending changed track, return the corresponding
309  // original; else return this track
310  std::shared_ptr<const Track> SubstituteOriginalTrack() const;
311 
314  using Intervals = std::vector< Interval >;
316  using ConstIntervals = std::vector< ConstInterval >;
317 
319 
320  struct TypeNames {
321  wxString info;
322  wxString property;
324  };
325  struct TypeInfo {
327  bool concrete = false;
328  const TypeInfo *pBaseInfo = nullptr;
329 
330  bool IsBaseOf(const TypeInfo &other) const
331  {
332  for (auto pInfo = &other;
333  pInfo; pInfo = pInfo->pBaseInfo)
334  if (this == pInfo)
335  return true;
336  return false;
337  }
338  };
339  virtual const TypeInfo &GetTypeInfo() const = 0;
340  static const TypeInfo &ClassTypeInfo();
341  virtual const TypeNames &GetTypeNames() const
342  { return GetTypeInfo().names; }
343 
345  virtual bool SupportsBasicEditing() const;
346 
347  using Holder = std::shared_ptr<Track>;
348 
350 
351  virtual Holder PasteInto( AudacityProject & ) const = 0;
352 
354 
357  virtual ConstIntervals GetIntervals() const;
358 
362  virtual Intervals GetIntervals();
363 
364  public:
365  mutable std::pair<int, int> vrulerSize;
366 
367  int GetIndex() const;
368  void SetIndex(int index);
369 
370 public:
371  static void FinishCopy (const Track *n, Track *dest);
372 
373  // For use when loading a file. Return true if ok, else make repair
374  virtual bool LinkConsistencyCheck();
375 
376  bool HasOwner() const { return static_cast<bool>(GetOwner());}
377 
378  std::shared_ptr<TrackList> GetOwner() const { return mList.lock(); }
379 
380  LinkType GetLinkType() const noexcept;
382  bool IsAlignedWithLeader() const;
383 
384 protected:
385 
386  void SetLinkType(LinkType linkType);
387  void DoSetLinkType(LinkType linkType) noexcept;
388  void SetChannel(ChannelType c) noexcept;
389 private:
390 
391  Track* GetLinkedTrack() const;
393  bool HasLinkedTrack() const noexcept;
394 
396  TrackNodePointer GetNode() const;
398  void SetOwner
399  (const std::weak_ptr<TrackList> &list, TrackNodePointer node);
400 
401  // Keep in Track
402 
403  protected:
404  ChannelType mChannel;
405  double mOffset;
406 
407  public:
408 
409  Track();
410  Track(const Track &orig);
411 
412  virtual ~ Track();
413 
414  void Init(const Track &orig);
415 
416  // public nonvirtual duplication function that invokes Clone():
417  virtual Holder Duplicate() const;
418 
419  // Called when this track is merged to stereo with another, and should
420  // take on some parameters of its partner.
421  virtual void Merge(const Track &orig);
422 
423  wxString GetName() const { return mName; }
424  void SetName( const wxString &n );
425  wxString GetDefaultName() const { return mDefaultName; }
426  void SetDefaultName( const wxString &n ) { mDefaultName = n; }
427 
428  bool GetSelected() const { return mSelected; }
429 
430  virtual void SetSelected(bool s);
431 
432  // The argument tells whether the last undo history state should be
433  // updated for the appearance change
434  void EnsureVisible( bool modifyState = false );
435 
436 public:
437 
438  virtual ChannelType GetChannel() const { return mChannel;}
439  virtual double GetOffset() const = 0;
440 
441  void Offset(double t) { SetOffset(GetOffset() + t); }
442  virtual void SetOffset (double o) { mOffset = o; }
443 
444  virtual void SetPan( float ){ ;}
445  virtual void SetPanFromChannelType(){ ;};
446 
447  // Create a NEW track and modify this track
448  // Return non-NULL or else throw
449  // May assume precondition: t0 <= t1
450  virtual Holder Cut(double WXUNUSED(t0), double WXUNUSED(t1)) = 0;
451 
452  // Create a NEW track and don't modify this track
453  // Return non-NULL or else throw
454  // Note that subclasses may want to distinguish tracks stored in a clipboard
455  // from those stored in a project
456  // May assume precondition: t0 <= t1
457  virtual Holder Copy
458  (double WXUNUSED(t0), double WXUNUSED(t1), bool forClipboard = true) const = 0;
459 
460  // May assume precondition: t0 <= t1
461  virtual void Clear(double WXUNUSED(t0), double WXUNUSED(t1)) = 0;
462 
463  virtual void Paste(double WXUNUSED(t), const Track * WXUNUSED(src)) = 0;
464 
465  // This can be used to adjust a sync-lock selected track when the selection
466  // is replaced by one of a different length.
467  virtual void SyncLockAdjust(double oldT1, double newT1);
468 
469  // May assume precondition: t0 <= t1
470  virtual void Silence(double WXUNUSED(t0), double WXUNUSED(t1)) = 0;
471 
472  // May assume precondition: t0 <= t1
473  virtual void InsertSilence(double WXUNUSED(t), double WXUNUSED(len)) = 0;
474 
475 private:
476  // Subclass responsibility implements only a part of Duplicate(), copying
477  // the track data proper (not associated data such as for groups and views):
478  virtual Holder Clone() const = 0;
479 
480  template<typename T>
481  friend std::enable_if_t< std::is_pointer_v<T>, T >
482  track_cast(Track *track);
483  template<typename T>
484  friend std::enable_if_t<
485  std::is_pointer_v<T> &&
486  std::is_const_v< std::remove_pointer_t< T > >,
487  T
488  >
489  track_cast(const Track *track);
490 
491 public:
492  bool SameKindAs(const Track &track) const
493  { return &GetTypeInfo() == &track.GetTypeInfo(); }
494 
496  template < typename R = void >
497  using Continuation = std::function< R() >;
500 
501 private:
503  template< typename ...Params >
504  struct Executor{};
505 
507 
508  struct Dispatcher {
510  template< typename Tag, typename R, typename ArgumentType,
511  typename Function, typename ...Functions >
513  {
515  std::conditional_t< std::is_const_v<ArgumentType>,
516  const Track, Track >;
517 
519  using Tail = Executor< Tag, R, ArgumentType, Functions... >;
521  enum : unsigned { SetUsed = Tail::SetUsed << 1 };
522 
524  R operator ()
525  (QualifiedTrackType *pTrack,
526  const Function &, const Functions &...functions) const
527  { return Tail{}( pTrack, functions... ); }
528  };
529 
531  template< typename R, typename BaseClass, typename ArgumentType,
532  typename Function >
533  struct applicable1
534  {
536  std::conditional_t< std::is_const_v<ArgumentType>,
537  const Track, Track >;
539  std::conditional_t< std::is_const_v<ArgumentType>,
540  const BaseClass, BaseClass >;
541 
543  enum : unsigned { SetUsed = 1u };
544 
546  R operator ()
547  (QualifiedTrackType *pTrack, const Function &function, ...) const
548  { return function( static_cast<QualifiedBaseClass *>(pTrack) ); }
549  };
550 
552  template< typename Tag,
553  typename R, typename BaseClass, typename ArgumentType,
554  typename Function, typename ...Functions >
555  struct applicable2
556  {
558  std::conditional_t< std::is_const_v<ArgumentType>,
559  const Track, Track >;
561  std::conditional_t< std::is_const_v<ArgumentType>,
562  const BaseClass, BaseClass >;
563 
565  using Tail = Executor< Tag, R, ArgumentType, Functions... >;
567  enum : unsigned { SetUsed = (Tail::SetUsed << 1) | 1u };
568 
570  R operator ()
571  (QualifiedTrackType *pTrack, const Function &function,
572  const Functions &...functions) const
573  {
574  auto continuation = Continuation<R>{ [&] {
575  return Tail{}( pTrack, functions... );
576  } };
577  return function( static_cast<QualifiedBaseClass *>(pTrack),
578  continuation );
579  }
580  };
581 
583  template< typename ... > struct Switch {};
584 
586 
587  template< typename Tag, typename R, typename ArgumentType >
588  struct Switch< Tag, R, ArgumentType, std::tuple<> >
589  {
591  template< typename Function, typename ...Functions >
592  static auto test()
593  -> inapplicable< Tag, R, ArgumentType, Function, Functions... >;
594  };
595 
597 
598  template< typename Tag, typename R, typename ArgumentType,
599  typename BaseClass, typename ...BaseClasses >
600  struct Switch< Tag, R, ArgumentType, std::tuple<BaseClass, BaseClasses...> >
601  {
603  std::conditional_t< std::is_const_v<ArgumentType>,
604  const BaseClass, BaseClass >;
605 
607  using Retry =
608  Switch< Tag, R, ArgumentType, std::tuple<BaseClasses...> >;
609 
611 
613  template< typename Function, typename ...Functions >
614  static auto test( const void * )
615  -> decltype( Retry::template test< Function, Functions... >() );
616 
618 
621  template< typename Function, typename ...Functions >
622  static auto test( std::true_type * )
623  -> decltype(
624  (void) std::declval<Function>()
625  ( (QualifiedBaseClass*)nullptr ),
627  );
628 
630 
634  template< typename Function, typename ...Functions >
635  static auto test( std::true_type * )
636  -> decltype(
637  (void) std::declval<Function>()
638  ( (QualifiedBaseClass*)nullptr,
639  std::declval< Continuation<R> >() ),
640  applicable2< Tag, R, BaseClass, ArgumentType,
641  Function, Functions... >{}
642  );
643 
645  static constexpr bool Compatible =
646  std::is_base_of_v<BaseClass, ArgumentType>;
648  template< typename Function, typename ...Functions >
649  static auto test()
650  -> decltype(
651  test< Function, Functions... >(
652  (std::integral_constant<bool, Compatible>*)nullptr) );
653  };
654  };
655 
657  template< typename Tag, typename R, typename ArgumentType >
658  struct Executor< Tag, R, ArgumentType >
659  {
660  using NominalType = ArgumentType;
662  enum : unsigned { SetUsed = 0 };
664  R operator () (const void *, ...)
665  {
666  if constexpr (std::is_void_v<R>)
667  return;
668  else
669  return R{};
670  }
671  };
672 
674 
675  template< typename Tag, typename R, typename ArgumentType,
676  typename Function, typename ...Functions >
677  struct Executor< Tag, R, ArgumentType, Function, Functions... >
678  : decltype(
679  Dispatcher::Switch< Tag, R, ArgumentType,
680  typename CollectTrackTypes<Tag>::type >
681  ::template test<Function, Functions... >())
682  {
683  using NominalType = ArgumentType;
684  };
685 
686 public:
687 
688  template<typename TrackType>
689  static void checkTrackType()
690  {
691  static_assert(
692  std::is_same_v<Track, TrackType> ||
693  std::is_same_v<const Track, TrackType>, "Error" );
694  }
695  template<typename R, typename TrackType, typename... Functions>
696  static R CallExecutor(R*, std::tuple<>*, TrackType&, const Functions&...)
697  {
698  // This overload is needed so that the other overload of CallExecutor
699  // compiles, but it should never be reached at run-time, because an
700  // Executor generated for (const) Track should have been the catch-all.
701  wxASSERT(false);
702  checkTrackType<TrackType>();
703  if constexpr (std::is_void_v<R>)
704  return;
705  else
706  return R{};
707  }
708  template<
709  typename R, typename TrackType, typename... Functions,
710  typename Executor, typename... Executors>
711  static R CallExecutor(
712  R*, std::tuple<Executor, Executors...>*, TrackType &track,
713  const Functions &...functions)
714  {
715  checkTrackType<TrackType>();
716  const auto &info = Executor::NominalType::ClassTypeInfo();
717  // Dynamic type test of track
718  // Assumes Executor classes are sequenced with more specific accepted
719  // types earlier
720  if ( info.IsBaseOf(track.GetTypeInfo()) )
721  // Dispatch to an Executor that knows which of functions applies
722  return Executor{}(&track, functions...);
723  else
724  // Recur, with fewer candidate Executors and all of functions
725  return CallExecutor( (R*)nullptr,
726  (std::tuple<Executors...>*)nullptr, track, functions...);
727  }
728 
729  template<typename ...Executors>
730  static constexpr unsigned UsedCases(std::tuple<Executors...>*)
731  {
732  return (Executors::SetUsed | ...); // My very first fold expression :-)
733  }
734 
735  template<
736  typename Tag,
737  bool IsConst,
738  typename R,
739  typename ...TrackTypes,
740  typename ...Functions
741  >
742  static R DoTypeSwitch(
743  std::conditional_t<IsConst, const Track, Track> &track,
744  std::tuple<TrackTypes...>*,
745  const Functions &...functions )
746  {
747  // Generate Executor classes, for each of TrackTypes,
748  // each zero-sized and with an operator () that calls the correct
749  // one of functions, assuming the track is of the corresponding type
750  using Executors = std::tuple< Executor<
751  Tag, R,
752  std::conditional_t<IsConst, const TrackTypes, TrackTypes>,
753  Functions...
754  >... >;
755  // Don't even construct the tuple of zero-sized types, just point
756  constexpr Executors *executors = nullptr;
757 
758  // Compile time reachability check of the given functions
759  enum { All = sizeof...( functions ) };
760  static_assert( (1u << All) - 1u == UsedCases(executors),
761  "Uncallable case in Track::TypeSwitch");
762 
763  // Do dynamic dispatch to one of the Executors
764  return CallExecutor((R *)nullptr, executors, track, functions...);
765  }
766 
768 
786  template<
787  typename R = void,
788  typename ...Functions
789  >
790  R TypeSwitch(const Functions &...functions)
791  {
792  struct Tag : TrackTypeCountTag {};
793  // Collect all concrete and abstract track types known at compile time
794  using TrackTypes = typename CollectTrackTypes<Tag>::type;
795  TrackTypes *const trackTypes = nullptr;
796  // Generate a function that dispatches dynamically on track type
797  return DoTypeSwitch<Tag, false, R>(*this, trackTypes, functions...);
798  }
799 
803  template<
804  typename R = void,
805  typename ...Functions
806  >
807  R TypeSwitch(const Functions &...functions) const
808  {
809  struct Tag : TrackTypeCountTag {};
810  // Collect all concrete and abstract track types known at compile time
811  using TrackTypes = typename CollectTrackTypes<Tag>::type;
812  TrackTypes *const trackTypes = nullptr;
813  // Generate a function that dispatches dynamically on track type
814  return DoTypeSwitch<Tag, true, R>(*this, trackTypes, functions...);
815  }
816 
817  // XMLTagHandler callback methods -- NEW virtual for writing
818  virtual void WriteXML(XMLWriter &xmlFile) const = 0;
819 
820  // Returns true if an error was encountered while trying to
821  // open the track from XML
822  virtual bool GetErrorOpening() { return false; }
823 
824  virtual double GetStartTime() const = 0;
825  virtual double GetEndTime() const = 0;
826 
827  // Send a notification to subscribers when state of the track changes
828  // To do: define values for the argument to distinguish different parts
829  // of the state
830  void Notify( int code = -1 );
831 
832  // An always-true predicate useful for defining iterators
833  bool Any() const;
834 
835  // Frequently useful operands for + and -
836  bool IsSelected() const;
837  bool IsLeader() const;
838  bool IsSelectedLeader() const;
839 
840  // Cause this track and following ones in its TrackList to adjust
841  void AdjustPositions();
842 
843  // Serialize, not with tags of its own, but as attributes within a tag.
844  void WriteCommonXMLAttributes(
845  XMLWriter &xmlFile, bool includeNameAndSelected = true) const;
846 
847  // Return true iff the attribute is recognized.
848  bool HandleCommonXMLAttribute(const std::string_view& attr, const XMLAttributeValueView& valueView);
849 };
850 
852 
854 class TRACK_API AudioTrack /* not final */ : public Track
855 {
856 public:
858  : Track{} {}
859  AudioTrack(const Track &orig) : Track{ orig } {}
860 
861  static const TypeInfo &ClassTypeInfo();
862 
863  // Serialize, not with tags of its own, but as attributes within a tag.
864  void WriteXMLAttributes(XMLWriter &WXUNUSED(xmlFile)) const {}
865 
866  // Return true iff the attribute is recognized.
867  bool HandleXMLAttribute(const std::string_view & /*attr*/, const XMLAttributeValueView &/*value*/)
868  { return false; }
869 };
870 
872 
874 class TRACK_API PlayableTrack /* not final */ : public AudioTrack
875 {
876 public:
878  : AudioTrack{} {}
879  PlayableTrack(const Track &orig) : AudioTrack{ orig } {}
880 
881  static const TypeInfo &ClassTypeInfo();
882 
883  bool GetMute () const { return mMute; }
884  bool GetSolo () const { return mSolo; }
885  bool GetNotMute () const { return !mMute; }
886  bool GetNotSolo () const { return !mSolo; }
887  void SetMute (bool m);
888  void SetSolo (bool s);
889 
890  void Init( const PlayableTrack &init );
891  void Merge( const Track &init ) override;
892 
893  // Serialize, not with tags of its own, but as attributes within a tag.
894  void WriteXMLAttributes(XMLWriter &xmlFile) const;
895 
896  // Return true iff the attribute is recognized.
897  bool HandleXMLAttribute(const std::string_view &attr, const XMLAttributeValueView &value);
898 
899 protected:
900  bool mMute { false };
901  bool mSolo { false };
902 };
903 
905 
906 
908 
915 template<typename T>
916  inline std::enable_if_t< std::is_pointer_v<T>, T >
918 {
919  using BareType = std::remove_pointer_t< T >;
920  if (track &&
921  BareType::ClassTypeInfo().IsBaseOf(track->GetTypeInfo() ))
922  return reinterpret_cast<T>(track);
923  else
924  return nullptr;
925 }
926 
929 template<typename T>
930  inline std::enable_if_t<
931  std::is_pointer_v<T> && std::is_const_v< std::remove_pointer_t< T > >,
932  T
933  >
934  track_cast(const Track *track)
935 {
936  using BareType = std::remove_pointer_t< T >;
937  if (track &&
938  BareType::ClassTypeInfo().IsBaseOf(track->GetTypeInfo() ))
939  return reinterpret_cast<T>(track);
940  else
941  return nullptr;
942 }
943 
944 template < typename TrackType > struct TrackIterRange;
945 
947 
954 template <
955  typename TrackType
956 > class TrackIter
957  : public ValueIterator< TrackType *, std::bidirectional_iterator_tag >
958 {
959 public:
961  using FunctionType = std::function< bool(
962  std::add_pointer_t< std::add_const_t< std::remove_pointer_t<TrackType> > >
963  ) >;
964 
967  TrackNodePointer begin,
968  TrackNodePointer iter,
969  TrackNodePointer end,
970  FunctionType pred = {}
971  )
972  : mBegin( begin ), mIter( iter ), mEnd( end )
973  , mPred( std::move(pred) )
974  {
975  // Establish the class invariant
976  if (this->mIter != this->mEnd && !this->valid())
977  this->operator ++ ();
978  }
979 
981 
983  template < typename Predicate2 >
984  TrackIter Filter( const Predicate2 &pred2 ) const
985  {
986  return { this->mBegin, this->mIter, this->mEnd, pred2 };
987  }
988 
990 
992  template < typename TrackType2 >
993  auto Filter() const
994  -> std::enable_if_t<
995  std::is_base_of_v< TrackType, TrackType2 > &&
996  (!std::is_const_v<TrackType> ||
997  std::is_const_v<TrackType2>),
998  TrackIter< TrackType2 >
999  >
1000  {
1001  return { this->mBegin, this->mIter, this->mEnd, this->mPred };
1002  }
1003 
1005  { return this->mPred; }
1006 
1008 
1010  {
1011  // Maintain the class invariant
1012  if (this->mIter != this->mEnd) do
1013  ++this->mIter.first;
1014  while (this->mIter != this->mEnd && !this->valid() );
1015  return *this;
1016  }
1017 
1020  {
1021  TrackIter result { *this };
1022  this-> operator ++ ();
1023  return result;
1024  }
1025 
1027 
1029  {
1030  // Maintain the class invariant
1031  do {
1032  if (this->mIter == this->mBegin)
1033  // Go circularly
1034  this->mIter = this->mEnd;
1035  else
1036  --this->mIter.first;
1037  } while (this->mIter != this->mEnd && !this->valid() );
1038  return *this;
1039  }
1040 
1043  {
1044  TrackIter result { *this };
1045  this->operator -- ();
1046  return result;
1047  }
1048 
1050 
1051  TrackType *operator * () const
1052  {
1053  if (this->mIter == this->mEnd)
1054  return nullptr;
1055  else
1056  // Other methods guarantee that the cast is correct
1057  // (provided no operations on the TrackList invalidated
1058  // underlying iterators or replaced the tracks there)
1059  return static_cast< TrackType * >( &**this->mIter.first );
1060  }
1061 
1064  long amount
1065  ) const
1066  {
1067  auto copy = *this;
1068  std::advance( copy, amount );
1069  return copy;
1070  }
1071 
1073  friend inline bool operator == (TrackIter a, TrackIter b)
1074  {
1075  // Assume the predicate is not stateful. Just compare the iterators.
1076  return
1077  a.mIter == b.mIter
1078  // Assume this too:
1079  // && a.mBegin == b.mBegin && a.mEnd == b.mEnd
1080  ;
1081  }
1082 
1084  friend inline bool operator != (TrackIter a, TrackIter b)
1085  {
1086  return !(a == b);
1087  }
1088 
1089 private:
1094  bool valid() const
1096  {
1097  // assume mIter != mEnd
1098  const auto pTrack = track_cast< TrackType * >( &**this->mIter.first );
1099  if (!pTrack)
1100  return false;
1101  return !this->mPred || this->mPred( pTrack );
1102  }
1103 
1106 
1112 };
1113 
1115 template <
1116  typename TrackType // Track or a subclass, maybe const-qualified
1118  : public IteratorRange< TrackIter< TrackType > >
1119 {
1121  ( const TrackIter< TrackType > &begin,
1122  const TrackIter< TrackType > &end )
1123  : IteratorRange< TrackIter< TrackType > >
1124  ( begin, end )
1125  {}
1126 
1127  // Conjoin the filter predicate with another predicate
1128  // Read + as "and"
1129  template< typename Predicate2 >
1130  TrackIterRange operator + ( const Predicate2 &pred2 ) const
1131  {
1132  const auto &pred1 = this->first.GetPredicate();
1133  using Function = typename TrackIter<TrackType>::FunctionType;
1134  const auto &newPred = pred1
1135  ? Function{ [=] (typename Function::argument_type track) {
1136  return pred1(track) && pred2(track);
1137  } }
1138  : Function{ pred2 };
1139  return {
1140  this->first.Filter( newPred ),
1141  this->second.Filter( newPred )
1142  };
1143  }
1144 
1145  // Specify the added conjunct as a pointer to member function
1146  // Read + as "and"
1147  template< typename R, typename C >
1148  TrackIterRange operator + ( R ( C ::* pmf ) () const ) const
1149  {
1150  return this->operator + ( std::mem_fn( pmf ) );
1151  }
1152 
1153  // Conjoin the filter predicate with the negation of another predicate
1154  // Read - as "and not"
1155  template< typename Predicate2 >
1156  TrackIterRange operator - ( const Predicate2 &pred2 ) const
1157  {
1158  using ArgumentType =
1159  typename TrackIterRange::iterator::FunctionType::argument_type;
1160  auto neg = [=] (ArgumentType track) { return !pred2( track ); };
1161  return this->operator + ( neg );
1162  }
1163 
1164  // Specify the negated conjunct as a pointer to member function
1165  // Read - as "and not"
1166  template< typename R, typename C >
1167  TrackIterRange operator - ( R ( C ::* pmf ) () const ) const
1168  {
1169  return this->operator + ( std::not1( std::mem_fn( pmf ) ) );
1170  }
1171 
1172  template< typename TrackType2 >
1174  {
1175  return {
1176  this-> first.template Filter< TrackType2 >(),
1177  this->second.template Filter< TrackType2 >()
1178  };
1179  }
1180 
1181  TrackIterRange StartingWith( const Track *pTrack ) const
1182  {
1183  auto newBegin = this->find( pTrack );
1184  // More careful construction is needed so that the independent
1185  // increment and decrement of each iterator in the NEW pair
1186  // has the expected behavior at boundaries of the range
1187  return {
1188  { newBegin.mIter, newBegin.mIter, this->second.mEnd,
1189  this->first.GetPredicate() },
1190  { newBegin.mIter, this->second.mIter, this->second.mEnd,
1191  this->second.GetPredicate() }
1192  };
1193  }
1194 
1195  TrackIterRange EndingAfter( const Track *pTrack ) const
1196  {
1197  const auto newEnd = this->reversal().find( pTrack ).base();
1198  // More careful construction is needed so that the independent
1199  // increment and decrement of each iterator in the NEW pair
1200  // has the expected behavior at boundaries of the range
1201  return {
1202  { this->first.mBegin, this->first.mIter, newEnd.mIter,
1203  this->first.GetPredicate() },
1204  { this->first.mBegin, newEnd.mIter, newEnd.mIter,
1205  this->second.GetPredicate() }
1206  };
1207  }
1208 
1209  // Exclude one given track
1210  TrackIterRange Excluding ( const TrackType *pExcluded ) const
1211  {
1212  return this->operator - (
1213  [=](const Track *pTrack){ return pExcluded == pTrack; } );
1214  }
1215 
1217  template< typename ...Functions >
1218  void Visit(const Functions &...functions)
1219  {
1220  for (auto track : *this)
1221  track->TypeSwitch(functions...);
1222  }
1223 
1225 
1226  template< typename Flag, typename ...Functions >
1227  void VisitWhile(Flag &flag, const Functions &...functions)
1228  {
1229  if ( flag ) for (auto track : *this) {
1230  track->TypeSwitch(functions...);
1231  if (!flag)
1232  break;
1233  }
1234  }
1235 };
1236 
1237 
1240 {
1241  enum Type {
1244 
1247 
1250 
1252 
1254 
1257 
1260 
1262 
1264  };
1265 
1267  const std::weak_ptr<Track> &pTrack = {}, int extra = -1)
1268  : mType{ type }
1269  , mpTrack{ pTrack }
1270  , mExtra{ extra }
1271  {}
1272 
1273  TrackListEvent( const TrackListEvent& ) = default;
1274 
1275  const Type mType;
1276  const std::weak_ptr<Track> mpTrack;
1277  const int mExtra;
1278 };
1279 
1283 class TRACK_API TrackList final
1284  : public Observer::Publisher<TrackListEvent>
1285  , public ListOfTracks
1286  , public std::enable_shared_from_this<TrackList>
1287  , public ClientData::Base
1288 {
1289  // privatize this, make you use Add instead:
1290  using ListOfTracks::push_back;
1291 
1292  // privatize this, make you use Swap instead:
1293  using ListOfTracks::swap;
1294 
1295  // Disallow copy
1296  TrackList(const TrackList &that) = delete;
1297  TrackList &operator= (const TrackList&) = delete;
1298 
1299  // No need for move, disallow it
1300  TrackList(TrackList &&that) = delete;
1302 
1303  void clear() = delete;
1304 
1305  public:
1306  static TrackList &Get( AudacityProject &project );
1307  static const TrackList &Get( const AudacityProject &project );
1308 
1309  // Create an empty TrackList
1310  // Don't call directly -- use Create() instead
1311  explicit TrackList( AudacityProject *pOwner );
1312 
1313  // Create an empty TrackList
1314  static std::shared_ptr<TrackList> Create( AudacityProject *pOwner );
1315 
1316  // Move is defined in terms of Swap
1317  void Swap(TrackList &that);
1318 
1319  // Destructor
1320  virtual ~TrackList();
1321 
1322  // Find the owning project, which may be null
1323  AudacityProject *GetOwner() { return mOwner; }
1324  const AudacityProject *GetOwner() const { return mOwner; }
1325 
1326  // Iteration
1327 
1328  // Hide the inherited begin() and end()
1331  using value_type = Track *;
1332  iterator begin() { return Any().begin(); }
1333  iterator end() { return Any().end(); }
1334  const_iterator begin() const { return Any().begin(); }
1335  const_iterator end() const { return Any().end(); }
1336  const_iterator cbegin() const { return begin(); }
1337  const_iterator cend() const { return end(); }
1338 
1340  template < typename TrackType = Track >
1341  auto Find(Track *pTrack)
1343  {
1344  if (!pTrack || pTrack->GetOwner().get() != this)
1345  return EndIterator<TrackType>();
1346  else
1347  return MakeTrackIterator<TrackType>( pTrack->GetNode() );
1348  }
1349 
1351 
1352  template < typename TrackType = const Track >
1353  auto Find(const Track *pTrack) const
1354  -> std::enable_if_t< std::is_const_v<TrackType>,
1356  >
1357  {
1358  if (!pTrack || pTrack->GetOwner().get() != this)
1359  return EndIterator<TrackType>();
1360  else
1361  return MakeTrackIterator<TrackType>( pTrack->GetNode() );
1362  }
1363 
1364  // If the track is not an audio track, or not one of a group of channels,
1365  // return the track itself; else return the first channel of its group --
1366  // in either case as an iterator that will only visit other leader tracks.
1367  // (Generalizing away from the assumption of at most stereo)
1368  TrackIter< Track > FindLeader( Track *pTrack );
1369 
1371  FindLeader( const Track *pTrack ) const
1372  {
1373  return const_cast<TrackList*>(this)->
1374  FindLeader( const_cast<Track*>(pTrack) ).Filter< const Track >();
1375  }
1376 
1377 
1378  template < typename TrackType = Track >
1379  auto Any()
1381  {
1382  return Tracks< TrackType >();
1383  }
1384 
1385  template < typename TrackType = const Track >
1386  auto Any() const
1387  -> std::enable_if_t< std::is_const_v<TrackType>,
1388  TrackIterRange< TrackType >
1389  >
1390  {
1391  return Tracks< TrackType >();
1392  }
1393 
1394  // Abbreviating some frequently used cases
1395  template < typename TrackType = Track >
1396  auto Selected()
1398  {
1399  return Tracks< TrackType >( &Track::IsSelected );
1400  }
1401 
1402  template < typename TrackType = const Track >
1403  auto Selected() const
1404  -> std::enable_if_t< std::is_const_v<TrackType>,
1405  TrackIterRange< TrackType >
1406  >
1407  {
1408  return Tracks< TrackType >( &Track::IsSelected );
1409  }
1410 
1411 
1412  template < typename TrackType = Track >
1413  auto Leaders()
1415  {
1416  return Tracks< TrackType >( &Track::IsLeader );
1417  }
1418 
1419  template < typename TrackType = const Track >
1420  auto Leaders() const
1421  -> std::enable_if_t< std::is_const_v<TrackType>,
1422  TrackIterRange< TrackType >
1423  >
1424  {
1425  return Tracks< TrackType >( &Track::IsLeader );
1426  }
1427 
1428 
1429  template < typename TrackType = Track >
1432  {
1433  return Tracks< TrackType >( &Track::IsSelectedLeader );
1434  }
1435 
1436  template < typename TrackType = const Track >
1437  auto SelectedLeaders() const
1438  -> std::enable_if_t< std::is_const_v<TrackType>,
1439  TrackIterRange< TrackType >
1440  >
1441  {
1442  return Tracks< TrackType >( &Track::IsSelectedLeader );
1443  }
1444 
1445 
1446  template<typename TrackType>
1447  static auto SingletonRange( TrackType *pTrack )
1449  {
1450  return pTrack->GetOwner()->template Any<TrackType>()
1451  .StartingWith( pTrack ).EndingAfter( pTrack );
1452  }
1453 
1454 
1455 private:
1456  Track *DoAddToHead(const std::shared_ptr<Track> &t);
1457  Track *DoAdd(const std::shared_ptr<Track> &t);
1458 
1459  template< typename TrackType, typename InTrackType >
1462  {
1463  // Assume iterator filters leader tracks
1464  if (*iter1) {
1465  return {
1466  iter1.Filter( &Track::Any )
1467  .template Filter<TrackType>(),
1468  (++iter1).Filter( &Track::Any )
1469  .template Filter<TrackType>()
1470  };
1471  }
1472  else
1473  // empty range
1474  return {
1475  iter1.template Filter<TrackType>(),
1476  iter1.template Filter<TrackType>()
1477  };
1478  }
1479 
1480 public:
1481  // Find an iterator range of channels including the given track.
1482  template< typename TrackType >
1483  static auto Channels( TrackType *pTrack )
1485  {
1486  return Channels_<TrackType>( pTrack->GetOwner()->FindLeader(pTrack) );
1487  }
1488 
1489  friend class Track;
1490 
1492  void Permute(const std::vector<TrackNodePointer> &permutation);
1493 
1494  Track *FindById( TrackId id );
1495 
1497  template<typename TrackKind>
1498  TrackKind *AddToHead( const std::shared_ptr< TrackKind > &t )
1499  { return static_cast< TrackKind* >( DoAddToHead( t ) ); }
1500 
1501  template<typename TrackKind>
1502  TrackKind *Add( const std::shared_ptr< TrackKind > &t )
1503  { return static_cast< TrackKind* >( DoAdd( t ) ); }
1504 
1506  void UnlinkChannels(Track& track);
1515  bool MakeMultiChannelTrack(Track& first, int nChannels, bool aligned);
1516 
1519  ListOfTracks::value_type Replace(
1520  Track * t, const ListOfTracks::value_type &with);
1521 
1524 
1526  void Clear(bool sendEvent = true);
1527 
1528  bool CanMoveUp(Track * t) const;
1529  bool CanMoveDown(Track * t) const;
1530 
1531  bool MoveUp(Track * t);
1532  bool MoveDown(Track * t);
1533  bool Move(Track * t, bool up) { return up ? MoveUp(t) : MoveDown(t); }
1534 
1536  bool Contains(const Track * t) const;
1537 
1538  // Return non-null only if the weak pointer is not, and the track is
1539  // owned by this list; constant time.
1540  template <typename Subclass>
1541  std::shared_ptr<Subclass> Lock(const std::weak_ptr<Subclass> &wTrack)
1542  {
1543  auto pTrack = wTrack.lock();
1544  if (pTrack) {
1545  auto pList = pTrack->mList.lock();
1546  if (pTrack && this == pList.get())
1547  return pTrack;
1548  }
1549  return {};
1550  }
1551 
1552  bool empty() const;
1553  size_t size() const;
1554 
1555  double GetStartTime() const;
1556  double GetEndTime() const;
1557 
1558  double GetMinOffset() const;
1559 
1560 private:
1561 
1562  // Visit all tracks satisfying a predicate, mutative access
1563  template <
1564  typename TrackType = Track,
1565  typename Pred =
1567  >
1568  auto Tracks( const Pred &pred = {} )
1570  {
1571  auto b = getBegin(), e = getEnd();
1572  return { { b, b, e, pred }, { b, e, e, pred } };
1573  }
1574 
1575  // Visit all tracks satisfying a predicate, const access
1576  template <
1577  typename TrackType = const Track,
1578  typename Pred =
1580  >
1581  auto Tracks( const Pred &pred = {} ) const
1582  -> std::enable_if_t< std::is_const_v<TrackType>,
1584  >
1585  {
1586  auto b = const_cast<TrackList*>(this)->getBegin();
1587  auto e = const_cast<TrackList*>(this)->getEnd();
1588  return { { b, b, e, pred }, { b, e, e, pred } };
1589  }
1590 
1591  Track *GetPrev(Track * t, bool linked = false) const;
1592  Track *GetNext(Track * t, bool linked = false) const;
1593 
1594  template < typename TrackType >
1597  {
1598  auto b = const_cast<TrackList*>(this)->getBegin();
1599  auto e = const_cast<TrackList*>(this)->getEnd();
1600  return { b, iter, e };
1601  }
1602 
1603  template < typename TrackType >
1605  EndIterator() const
1606  {
1607  auto e = const_cast<TrackList*>(this)->getEnd();
1608  return { e, e, e };
1609  }
1610 
1611  TrackIterRange< Track > EmptyRange() const;
1612 
1613  bool isNull(TrackNodePointer p) const
1614  { return (p.second == this && p.first == ListOfTracks::end())
1615  || (p.second == &mPendingUpdates && p.first == mPendingUpdates.end()); }
1617  { return { const_cast<TrackList*>(this)->ListOfTracks::end(),
1618  const_cast<TrackList*>(this)}; }
1620  { return { const_cast<TrackList*>(this)->ListOfTracks::begin(),
1621  const_cast<TrackList*>(this)}; }
1622 
1625  {
1626  if ( isNull(p) )
1627  return p;
1628  auto q = p;
1629  ++q.first;
1630  return q;
1631  }
1632 
1635  {
1636  if (p == getBegin())
1637  return getEnd();
1638  else {
1639  auto q = p;
1640  --q.first;
1641  return q;
1642  }
1643  }
1644 
1645  void RecalcPositions(TrackNodePointer node);
1646  void QueueEvent(TrackListEvent event);
1647  void SelectionEvent( const std::shared_ptr<Track> &pTrack );
1648  void PermutationEvent(TrackNodePointer node);
1649  void DataEvent( const std::shared_ptr<Track> &pTrack, int code );
1650  void EnsureVisibleEvent(
1651  const std::shared_ptr<Track> &pTrack, bool modifyState );
1652  void DeletionEvent(TrackNodePointer node = {});
1653  void AdditionEvent(TrackNodePointer node);
1654  void ResizingEvent(TrackNodePointer node);
1655 
1656  void SwapNodes(TrackNodePointer s1, TrackNodePointer s2);
1657 
1658  // Nondecreasing during the session.
1659  // Nonpersistent.
1660  // Used to assign ids to added tracks.
1661  static long sCounter;
1662 
1663 public:
1664  using Updater = std::function< void(Track &dest, const Track &src) >;
1665  // Start a deferred update of the project.
1666  // The return value is a duplicate of the given track.
1667  // While ApplyPendingTracks or ClearPendingTracks is not yet called,
1668  // there may be other direct changes to the project that push undo history.
1669  // Meanwhile the returned object can accumulate other changes for a deferred
1670  // push, and temporarily shadow the actual project track for display purposes.
1671  // The Updater function, if not null, merges state (from the actual project
1672  // into the pending track) which is not meant to be overridden by the
1673  // accumulated pending changes.
1674  // To keep the display consistent, the Y and Height values, minimized state,
1675  // and Linked state must be copied, and this will be done even if the
1676  // Updater does not do it.
1677  // Pending track will have the same TrackId as the actual.
1678  // Pending changed tracks will not occur in iterations.
1679  std::shared_ptr<Track> RegisterPendingChangedTrack(
1680  Updater updater,
1681  Track *src
1682  );
1683 
1684  // Like the previous, but for a NEW track, not a replacement track. Caller
1685  // supplies the track, and there are no updates.
1686  // Pending track will have an unassigned TrackId.
1687  // Pending changed tracks WILL occur in iterations, always after actual
1688  // tracks, and in the sequence that they were added. They can be
1689  // distinguished from actual tracks by TrackId.
1690  void RegisterPendingNewTrack( const std::shared_ptr<Track> &pTrack );
1691 
1692  // Invoke the updaters of pending tracks. Pass any exceptions from the
1693  // updater functions.
1694  void UpdatePendingTracks();
1695 
1696  // Forget pending track additions and changes;
1697  // if requested, give back the pending added tracks.
1698  void ClearPendingTracks( ListOfTracks *pAdded = nullptr );
1699 
1700  // Change the state of the project.
1701  // Strong guarantee for project state in case of exceptions.
1702  // Will always clear the pending updates.
1703  // Return true if the state of the track list really did change.
1704  bool ApplyPendingTracks();
1705 
1706  bool HasPendingTracks() const;
1707 
1708 private:
1710 
1712 
1715  std::vector< Updater > mUpdaters;
1716 };
1717 
1718 #endif
XMLWriter
Base class for XMLFileWriter and XMLStringWriter that provides the general functionality for creating...
Definition: XMLWriter.h:26
size
size_t size
Definition: ffmpeg-2.3.6-single-header.h:412
TrackList::isNull
bool isNull(TrackNodePointer p) const
Definition: Track.h:1613
Init
Definition: ModuleManager.h:154
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition: TranslatableString.h:32
TrackIntervalData::~TrackIntervalData
virtual ~TrackIntervalData()
ConstTrackInterval::operator=
ConstTrackInterval & operator=(ConstTrackInterval &&)=default
anonymous_namespace{Track.h}::TrackTypeCounter::Tag
Definition: Track.h:116
TrackList::EndIterator
TrackIter< TrackType > EndIterator() const
Definition: Track.h:1605
Track::TypeInfo::IsBaseOf
bool IsBaseOf(const TypeInfo &other) const
Definition: Track.h:330
Track::GetDefaultName
wxString GetDefaultName() const
Definition: Track.h:425
Track::SetId
void SetId(TrackId id)
Definition: Track.h:268
Track::Continuation
std::function< R() > Continuation
Type of arguments passed as optional second parameter to TypeSwitch() cases.
Definition: Track.h:497
PlayableTrack::PlayableTrack
PlayableTrack(const Track &orig)
Definition: Track.h:879
PlayableTrack::GetSolo
bool GetSolo() const
Definition: Track.h:884
Track::Dispatcher::Switch< Tag, R, ArgumentType, std::tuple< BaseClass, BaseClasses... > >::test
static auto test(const void *) -> decltype(Retry::template test< Function, Functions... >())
Catch-all overload of undefined function used in decltype only.
Track::Dispatcher::Switch< Tag, R, ArgumentType, std::tuple< BaseClass, BaseClasses... > >::test
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
ClientData::ShallowCopying
@ ShallowCopying
copy pointers only; won't compile for std::unique_ptr
Definition: ClientDataHelpers.h:35
Track::mSelected
bool mSelected
Definition: Track.h:252
PlayableTrack::GetMute
bool GetMute() const
Definition: Track.h:883
TrackListEvent::Type
Type
Definition: Track.h:1241
ConstTrackInterval::ConstTrackInterval
ConstTrackInterval(double start, double end, std::unique_ptr< TrackIntervalData > pExtra={})
Definition: Track.h:181
flag
static std::once_flag flag
Definition: WaveformView.cpp:1133
TrackListEvent::TRACK_DATA_CHANGE
@ TRACK_DATA_CHANGE
Posted when certain fields of a track change.
Definition: Track.h:1246
TrackList::getEnd
TrackNodePointer getEnd() const
Definition: Track.h:1616
Track::GetEndTime
virtual double GetEndTime() const =0
Track::checkTrackType
static void checkTrackType()
Definition: Track.h:689
TrackList::Lock
std::shared_ptr< Subclass > Lock(const std::weak_ptr< Subclass > &wTrack)
Definition: Track.h:1541
Track::ConstIntervals
std::vector< ConstInterval > ConstIntervals
Definition: Track.h:316
TrackIter
Iterator over only members of a TrackList of the specified subtype, optionally filtered by a predicat...
Definition: Track.h:958
Track::TypeInfo::pBaseInfo
const TypeInfo * pBaseInfo
Definition: Track.h:328
TrackId::operator==
bool operator==(const TrackId &other) const
Definition: Track.h:155
TrackIter::GetPredicate
const FunctionType & GetPredicate() const
Definition: Track.h:1004
Track::GetTypeInfo
virtual const TypeInfo & GetTypeInfo() const =0
TrackList::Channels
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
Definition: Track.h:1483
TrackList
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition: Track.h:1288
ConstTrackInterval::End
double End() const
Definition: Track.h:192
TrackId::operator!=
bool operator!=(const TrackId &other) const
Definition: Track.h:158
anonymous_namespace{Track.h}::CollectTrackTypes::type
typename Accumulate< 0 >::type type
Definition: Track.h:110
TrackIntervalData
Optional extra information about an interval, appropriate to a subtype of Track.
Definition: Track.h:171
Track::Merge
virtual void Merge(const Track &orig)
Definition: Track.cpp:102
operator==
bool operator==(const TrackNodePointer &a, const TrackNodePointer &b)
Definition: Track.h:49
Observer.h
Track::SharedPointer
std::shared_ptr< Subclass > SharedPointer()
Definition: Track.h:276
Track::Cut
virtual Holder Cut(double WXUNUSED(t0), double WXUNUSED(t1))=0
IteratorRange
A convenience for use with range-for.
Definition: MemoryX.h:252
Track::Dispatcher::applicable1
Second, nonrecursive case of metafunction, generates operator () that calls function without fallthro...
Definition: Track.h:534
Track::CallExecutor
static R CallExecutor(R *, std::tuple< Executor, Executors... > *, TrackType &track, const Functions &...functions)
Definition: Track.h:711
Track::InsertSilence
virtual void InsertSilence(double WXUNUSED(t), double WXUNUSED(len))=0
TrackId::mValue
long mValue
Definition: Track.h:167
TrackList::TrackList
TrackList(TrackList &&that)=delete
Track::GetTypeNames
virtual const TypeNames & GetTypeNames() const
Definition: Track.h:341
Track::GetOwner
std::shared_ptr< TrackList > GetOwner() const
Definition: Track.h:378
ClientData::Base
A convenient default parameter for class template Site.
Definition: ClientData.h:28
Track::Dispatcher::Switch< Tag, R, ArgumentType, std::tuple< BaseClass, BaseClasses... > >::QualifiedBaseClass
std::conditional_t< std::is_const_v< ArgumentType >, const BaseClass, BaseClass > QualifiedBaseClass
Definition: Track.h:604
TrackList::Add
TrackKind * Add(const std::shared_ptr< TrackKind > &t)
Definition: Track.h:1502
TrackList::Find
auto Find(Track *pTrack) -> TrackIter< TrackType >
Turn a pointer into a TrackIter (constant time); get end iterator if this does not own the track.
Definition: Track.h:1341
Track::SetPanFromChannelType
virtual void SetPanFromChannelType()
Definition: Track.h:445
TrackIterRange::VisitWhile
void VisitWhile(Flag &flag, const Functions &...functions)
See Track::TypeSwitch.
Definition: Track.h:1227
Track::Paste
virtual void Paste(double WXUNUSED(t), const Track *WXUNUSED(src))=0
Track::Any
bool Any() const
Definition: Track.cpp:292
Track::SharedPointer
static std::shared_ptr< Subclass > SharedPointer(Track *pTrack)
Definition: Track.h:296
anonymous_namespace{Track.h}::CollectTrackTypes::Stop::type
std::tuple< Types... > type
Definition: Track.h:98
AudioTrack::AudioTrack
AudioTrack(const Track &orig)
Definition: Track.h:859
Track::SetOffset
virtual void SetOffset(double o)
Definition: Track.h:442
TrackInterval
A start and an end time, and mutative access to optional extra information.
Definition: Track.h:204
anonymous_namespace{Track.h}::CollectTrackTypes::AccumulateType
Definition: Track.h:105
TrackIterRange::TrackIterRange
TrackIterRange(const TrackIter< TrackType > &begin, const TrackIter< TrackType > &end)
Definition: Track.h:1121
TrackList::Leaders
auto Leaders() const -> std::enable_if_t< std::is_const_v< TrackType >, TrackIterRange< TrackType > >
Definition: Track.h:1420
Track::ClassTypeInfo
static const TypeInfo & ClassTypeInfo()
Definition: Track.cpp:1096
ClientData.h
Utility ClientData::Site to register hooks into a host class that attach client data.
TrackInterval::Extra
TrackIntervalData * Extra() const
Definition: Track.h:211
Track::Dispatcher::Switch< Tag, R, ArgumentType, std::tuple< BaseClass, BaseClasses... > >::test
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
Definition: Track.h:635
Observer::Publisher::operator=
Publisher & operator=(Publisher &&)=default
anonymous_namespace{Track.h}::CollectTrackTypes::Accumulate
Definition: Track.h:108
Track::DoTypeSwitch
static R DoTypeSwitch(std::conditional_t< IsConst, const Track, Track > &track, std::tuple< TrackTypes... > *, const Functions &...functions)
Definition: Track.h:742
TrackList::SelectedLeaders
auto SelectedLeaders() -> TrackIterRange< TrackType >
Definition: Track.h:1430
Track::Dispatcher::inapplicable
First, recursive case of metafunction, defers generation of operator ()
Definition: Track.h:513
TrackList::Any
auto Any() const -> std::enable_if_t< std::is_const_v< TrackType >, TrackIterRange< TrackType > >
Definition: Track.h:1386
Track::mDefaultName
wxString mDefaultName
Definition: Track.h:249
RefreshCode::EnsureVisible
@ EnsureVisible
Definition: RefreshCode.h:31
TrackList::MakeTrackIterator
TrackIter< TrackType > MakeTrackIterator(TrackNodePointer iter) const
Definition: Track.h:1596
anonymous_namespace{Track.h}::EnumeratedTrackType
std::remove_reference_t< decltype(enumerateTrackTypes(Tag{}, std::integral_constant< unsigned, U >{})) > EnumeratedTrackType
What type is associated with U (at the point of instantiation for Tag)?
Definition: Track.h:68
TrackIterRange::Filter
TrackIterRange< TrackType2 > Filter() const
Definition: Track.h:1173
TrackListEvent::ADDITION
@ ADDITION
Posted when a track has been added to a tracklist. Also posted when one track replaces another.
Definition: Track.h:1259
TrackListEvent::TrackListEvent
TrackListEvent(const TrackListEvent &)=default
TrackIter::TrackIter
TrackIter(TrackNodePointer begin, TrackNodePointer iter, TrackNodePointer end, FunctionType pred={})
Constructor, usually not called directly except by methods of TrackList.
Definition: Track.h:966
Track::Dispatcher::applicable1::QualifiedTrackType
std::conditional_t< std::is_const_v< ArgumentType >, const Track, Track > QualifiedTrackType
Definition: Track.h:537
TrackList::end
iterator end()
Definition: Track.h:1333
TrackIterRange::Excluding
TrackIterRange Excluding(const TrackType *pExcluded) const
Definition: Track.h:1210
TrackIter::mPred
FunctionType mPred
Optional filter
Definition: Track.h:1111
anonymous_namespace{Track.h}::CountTrackTypes
Embedded value member counts track types so far declared in the compilation unit.
Definition: Track.h:75
Track::UsedCases
static constexpr unsigned UsedCases(std::tuple< Executors... > *)
Definition: Track.h:730
PlayableTrack::GetNotMute
bool GetNotMute() const
Definition: Track.h:885
TrackList::Move
bool Move(Track *t, bool up)
Definition: Track.h:1533
Track::mName
wxString mName
Definition: Track.h:248
Track::vrulerSize
std::pair< int, int > vrulerSize
Definition: Track.h:365
TrackList::end
const_iterator end() const
Definition: Track.h:1335
Track::GetStartTime
virtual double GetStartTime() const =0
TrackList::cend
const_iterator cend() const
Definition: Track.h:1337
TrackList::mUpdaters
std::vector< Updater > mUpdaters
This is in correspondence with mPendingUpdates.
Definition: Track.h:1715
Track::GetErrorOpening
virtual bool GetErrorOpening()
Definition: Track.h:822
Track::Track
Track()
Definition: Track.cpp:44
TrackId::operator<
bool operator<(const TrackId &other) const
Definition: Track.h:163
TrackList::mPendingUpdates
ListOfTracks mPendingUpdates
Shadow tracks holding append-recording in progress; need to put them into a list so that GetLink() wo...
Definition: Track.h:1713
Track::mList
std::weak_ptr< TrackList > mList
Definition: Track.h:243
TrackList::Updater
std::function< void(Track &dest, const Track &src) > Updater
Definition: Track.h:1664
AudioTrack::WriteXMLAttributes
void WriteXMLAttributes(XMLWriter &WXUNUSED(xmlFile)) const
Definition: Track.h:864
XMLTagHandler.h
TrackIter::FunctionType
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.
Definition: Track.h:963
Track::mId
TrackId mId
Identifies the track only in-session, not persistently.
Definition: Track.h:239
anonymous_namespace{Track.h}::CountTrackTypes::Count
Definition: Track.h:84
TrackIter::operator++
TrackIter & operator++()
Safe to call even when at the end.
Definition: Track.h:1009
Track::GetId
TrackId GetId() const
Definition: Track.h:266
Track::Dispatcher::inapplicable::QualifiedTrackType
std::conditional_t< std::is_const_v< ArgumentType >, const Track, Track > QualifiedTrackType
Definition: Track.h:516
TrackListEvent
Notification of changes in individual tracks of TrackList, or of TrackList's composition.
Definition: Track.h:1240
TrackIter::valid
bool valid() const
Test satisfaction of the invariant, while initializing, incrementing, or decrementing.
Definition: Track.h:1095
Track::Offset
void Offset(double t)
Definition: Track.h:441
TrackListEvent::TrackListEvent
TrackListEvent(Type type, const std::weak_ptr< Track > &pTrack={}, int extra=-1)
Definition: Track.h:1266
TrackListEvent::TRACK_REQUEST_VISIBLE
@ TRACK_REQUEST_VISIBLE
Posted when a track needs to be scrolled into view.
Definition: Track.h:1249
TrackIter::operator!=
friend bool operator!=(TrackIter a, TrackIter b)
Compares only current positions, assuming same beginnings and ends.
Definition: Track.h:1084
Track::Holder
std::shared_ptr< Track > Holder
Definition: Track.h:347
BasicUI::Get
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:26
Track::SetDefaultName
void SetDefaultName(const wxString &n)
Definition: Track.h:426
TrackList::mOwner
AudacityProject * mOwner
Definition: Track.h:1709
TrackIter::advance
TrackIter advance(long amount) const
This might be called operator + , but it's not constant-time as with a random access iterator.
Definition: Track.h:1063
operator!=
bool operator!=(const TrackNodePointer &a, const TrackNodePointer &b)
Definition: Track.h:52
Track::SharedPointer
auto SharedPointer() const -> std::enable_if_t< std::is_const_v< Subclass >, std::shared_ptr< Subclass > >
Definition: Track.h:284
TrackList::begin
iterator begin()
Definition: Track.h:1332
anonymous_namespace{Track.h}::enumerateTrackTypes
auto enumerateTrackTypes(TrackTypeCountTag,...) -> void
TrackIter::operator==
friend bool operator==(TrackIter a, TrackIter b)
Compares only current positions, assuming same beginnings and ends.
Definition: Track.h:1073
ListOfTracks
std::list< std::shared_ptr< Track > > ListOfTracks
Definition: Track.h:41
TrackList::FindLeader
TrackIter< const Track > FindLeader(const Track *pTrack) const
Definition: Track.h:1371
Track::SameKindAs
bool SameKindAs(const Track &track) const
Definition: Track.h:492
Track::Silence
virtual void Silence(double WXUNUSED(t0), double WXUNUSED(t1))=0
Track::GetOffset
virtual double GetOffset() const =0
AttachedTrackObjects
ClientData::Site< Track, TrackAttachment, ClientData::ShallowCopying, std::shared_ptr > AttachedTrackObjects
Template generated base class for Track lets it host opaque UI related objects.
Definition: Track.h:217
Observer::Publisher
An object that sends messages to an open-ended list of subscribed callbacks.
Definition: Observer.h:108
TrackNodePointer
std::pair< ListOfTracks::iterator, ListOfTracks * > TrackNodePointer
Pairs a std::list iterator and a pointer to a list, for comparison purposes.
Definition: Track.h:47
Track::CallExecutor
static R CallExecutor(R *, std::tuple<> *, TrackType &, const Functions &...)
Definition: Track.h:696
TrackList::AddToHead
TrackKind * AddToHead(const std::shared_ptr< TrackKind > &t)
Add a Track, giving it a fresh id.
Definition: Track.h:1498
TrackList::SelectedLeaders
auto SelectedLeaders() const -> std::enable_if_t< std::is_const_v< TrackType >, TrackIterRange< TrackType > >
Definition: Track.h:1437
TrackListEvent::mpTrack
const std::weak_ptr< Track > mpTrack
Definition: Track.h:1276
AudioTrack
Track subclass holding data representing sound (as notes, or samples, or ...)
Definition: Track.h:855
ConstTrackInterval
A start and an end time, and non-mutative access to optional extra information.
Definition: Track.h:177
Track::Clone
virtual Holder Clone() const =0
TrackIterRange::operator-
TrackIterRange operator-(const Predicate2 &pred2) const
Definition: Track.h:1156
AudioTrack::ClassTypeInfo
static const TypeInfo & ClassTypeInfo()
Definition: Track.cpp:1163
ClientData::Site
Utility to register hooks into a host class that attach client data.
Definition: ClientData.h:220
Track::Executor< Tag, R, ArgumentType >::NominalType
ArgumentType NominalType
Definition: Track.h:660
Track::Fallthrough
Continuation<> Fallthrough
Type of arguments passed as optional second parameter to TypeSwitch<void>() cases.
Definition: Track.h:499
Track::IsSelected
bool IsSelected() const
Definition: Track.cpp:295
TrackListEvent::DELETION
@ DELETION
Posted when a track has been deleted from a tracklist. Also posted when one track replaces another.
Definition: Track.h:1263
anonymous_namespace{Track.h}::CollectTrackTypes
Embedded type member is the tuple of track types so far declared in the compilation unit.
Definition: Track.h:96
TrackArray
std::vector< Track * > TrackArray
Definition: TimeShiftHandle.h:23
track_cast
std::enable_if_t< std::is_pointer_v< T >, T > track_cast(Track *track)
Encapsulate the checked down-casting of track pointers.
Definition: Track.h:917
TrackIter::Filter
TrackIter Filter(const Predicate2 &pred2) const
Return an iterator that replaces the predicate.
Definition: Track.h:984
TrackList::GetOwner
const AudacityProject * GetOwner() const
Definition: Track.h:1324
XMLAttributeValueView
A view into an attribute value. The class does not take the ownership of the data.
Definition: XMLAttributeValueView.h:44
anonymous_namespace{NoteTrack.cpp}::swap
void swap(std::unique_ptr< Alg_seq > &a, std::unique_ptr< Alg_seq > &b)
Definition: NoteTrack.cpp:753
TrackId::TrackId
TrackId()
Definition: Track.h:152
ConstTrackInterval::Extra
const TrackIntervalData * Extra() const
Definition: Track.h:193
Track::IsSelectedLeader
bool IsSelectedLeader() const
Definition: Track.cpp:303
TrackIter::operator--
TrackIter & operator--()
Safe to call even when at the beginning.
Definition: Track.h:1028
PlayableTrack::GetNotSolo
bool GetNotSolo() const
Definition: Track.h:886
Track::SetPan
virtual void SetPan(float)
Definition: Track.h:444
TrackIterRange
Range between two TrackIters, usable in range-for statements, and with Visit member functions.
Definition: Track.h:1119
PlayableTrack
AudioTrack subclass that can also be audibly replayed by the program.
Definition: Track.h:875
TrackList::Tracks
auto Tracks(const Pred &pred={}) const -> std::enable_if_t< std::is_const_v< TrackType >, TrackIterRange< TrackType > >
Definition: Track.h:1581
TrackList::getBegin
TrackNodePointer getBegin() const
Definition: Track.h:1619
anonymous_namespace{ProjectSettings.cpp}::Notify
void Notify(AudacityProject &project, ProjectSettings::EventCode code, long previousValue)
Definition: ProjectSettings.cpp:26
TrackList::TrackList
TrackList(const TrackList &that)=delete
XMLTagHandler
This class is an interface which should be implemented by classes which wish to be able to load and s...
Definition: XMLTagHandler.h:42
Track::GetSelected
bool GetSelected() const
Definition: Track.h:428
Track::Intervals
std::vector< Interval > Intervals
Definition: Track.h:314
AudioTrack::AudioTrack
AudioTrack()
Definition: Track.h:857
Track::mIndex
int mIndex
0-based position of this track in its TrackList
Definition: Track.h:247
TrackIterRange::StartingWith
TrackIterRange StartingWith(const Track *pTrack) const
Definition: Track.h:1181
Track::Dispatcher::applicable2::QualifiedTrackType
std::conditional_t< std::is_const_v< ArgumentType >, const Track, Track > QualifiedTrackType
Definition: Track.h:559
Track::TypeNames
Names of a track type for various purposes.
Definition: Track.h:320
ConstTrackInterval::end
double end
Definition: Track.h:196
TrackList::GetOwner
AudacityProject * GetOwner()
Definition: Track.h:1323
TrackListEvent::mExtra
const int mExtra
Definition: Track.h:1277
id
int id
Definition: WaveTrackControls.cpp:577
TrackList::clear
void clear()=delete
ConstTrackInterval::pExtra
std::unique_ptr< TrackIntervalData > pExtra
Definition: Track.h:199
Track::TypeNames::property
wxString property
short, like "wave", as a Lisp symbol property, not internationalized
Definition: Track.h:322
Track::WriteXML
virtual void WriteXML(XMLWriter &xmlFile) const =0
Track::Dispatcher::applicable1::QualifiedBaseClass
std::conditional_t< std::is_const_v< ArgumentType >, const BaseClass, BaseClass > QualifiedBaseClass
Definition: Track.h:540
TrackAttachment
Definition: TrackAttachment.h:25
AudioTrack::HandleXMLAttribute
bool HandleXMLAttribute(const std::string_view &, const XMLAttributeValueView &)
Definition: Track.h:867
Track::TypeSwitch
R TypeSwitch(const Functions &...functions)
Use this function rather than testing track type explicitly and making down-casts.
Definition: Track.h:790
TrackId
An in-session identifier of track objects across undo states. It does not persist between sessions.
Definition: Track.h:150
TrackList::begin
const_iterator begin() const
Definition: Track.h:1334
Track::TypeNames::info
wxString info
short, like "wave", in macro output, not internationalized
Definition: Track.h:321
TrackList::Leaders
auto Leaders() -> TrackIterRange< TrackType >
Definition: Track.h:1413
TrackList::sCounter
static long sCounter
Definition: Track.h:1661
Track
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:224
Track::IsLeader
bool IsLeader() const
Definition: Track.cpp:298
Track::ChannelType
ChannelType
Definition: Track.h:260
Track::SharedPointer
static std::shared_ptr< Subclass > SharedPointer(const Track *pTrack)
Definition: Track.h:300
Track::Dispatcher::Switch< Tag, R, ArgumentType, std::tuple<> >::test
static auto test() -> inapplicable< Tag, R, ArgumentType, Function, Functions... >
No BaseClass of ArgumentType is acceptable to Function.
Track::Init
void Init(const Track &orig)
Definition: Track.cpp:65
TrackListEvent::RESIZING
@ RESIZING
Posted when some track changed its height.
Definition: Track.h:1256
TrackIter::Filter
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.
Definition: Track.h:993
anonymous_namespace{Track.h}::CountTrackTypes::Stop
Definition: Track.h:76
TrackInterval::operator=
TrackInterval & operator=(TrackInterval &&)=default
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:89
TrackList::getNext
TrackNodePointer getNext(TrackNodePointer p) const
Move an iterator to the next node, if any; else stay at end.
Definition: Track.h:1624
ValueIterator
A convenience for defining iterators that return rvalue types, so that they cooperate correctly with ...
Definition: MemoryX.h:238
Track::TypeInfo::names
TypeNames names
Definition: Track.h:326
anonymous_namespace{EditMenus.cpp}::FinishCopy
void FinishCopy(const Track *n, const Track::Holder &dest, TrackList &list)
Definition: EditMenus.cpp:35
Track::GetChannel
virtual ChannelType GetChannel() const
Definition: Track.h:438
anonymous_namespace{Track.h}::TrackTypeCountTag
Empty class which will have subclasses.
Definition: Track.h:58
TrackListEvent::SELECTION_CHANGE
@ SELECTION_CHANGE
Posted when the set of selected tracks changes.
Definition: Track.h:1243
Track::Executor< Tag, R, ArgumentType, Function, Functions... >::NominalType
ArgumentType NominalType
Definition: Track.h:683
TrackList::getPrev
TrackNodePointer getPrev(TrackNodePointer p) const
Move an iterator to the previous node, if any; else wrap to end.
Definition: Track.h:1634
TrackInterval::TrackInterval
TrackInterval(TrackInterval &&)=default
TrackIterRange::Visit
void Visit(const Functions &...functions)
See Track::TypeSwitch.
Definition: Track.h:1218
ENUMERATE_TRACK_TYPE
#define ENUMERATE_TRACK_TYPE(T)
This macro should be called immediately after each definition of a track subtype.
Definition: Track.h:124
Track::Dispatcher::applicable2::QualifiedBaseClass
std::conditional_t< std::is_const_v< ArgumentType >, const BaseClass, BaseClass > QualifiedBaseClass
Definition: Track.h:562
TrackList::Find
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.
Definition: Track.h:1353
Track::HasOwner
bool HasOwner() const
Definition: Track.h:376
Track::Clear
virtual void Clear(double WXUNUSED(t0), double WXUNUSED(t1))=0
TrackIterRange::operator+
TrackIterRange operator+(const Predicate2 &pred2) const
Definition: Track.h:1130
TrackList::Tracks
auto Tracks(const Pred &pred={}) -> TrackIterRange< TrackType >
Definition: Track.h:1568
TrackList::Channels_
static TrackIterRange< TrackType > Channels_(TrackIter< InTrackType > iter1)
Definition: Track.h:1461
ConstTrackInterval::start
double start
Definition: Track.h:196
TrackIter::operator*
TrackType * operator*() const
Safe to call even when at the end.
Definition: Track.h:1051
TrackListEvent::PERMUTED
@ PERMUTED
Posted when tracks are reordered but otherwise unchanged.
Definition: Track.h:1253
TrackId::TrackId
TrackId(long value)
Definition: Track.h:153
TrackList::Selected
auto Selected() const -> std::enable_if_t< std::is_const_v< TrackType >, TrackIterRange< TrackType > >
Definition: Track.h:1403
TrackListEvent::mType
const Type mType
Definition: Track.h:1275
PlayableTrack::PlayableTrack
PlayableTrack()
Definition: Track.h:877
ConstTrackInterval::Start
double Start() const
Definition: Track.h:191
TrackList::Any
auto Any() -> TrackIterRange< TrackType >
Definition: Track.h:1379
Track::TypeNames::name
TranslatableString name
long, like "Wave Track"
Definition: Track.h:323
TrackList::SingletonRange
static auto SingletonRange(TrackType *pTrack) -> TrackIterRange< TrackType >
Definition: Track.h:1447
ActiveProjects::Remove
void Remove(const FilePath &path)
Journal::Events::anonymous_namespace{JournalEvents.cpp}::Types
std::vector< Type > Types
Definition: JournalEvents.cpp:41
TrackIter::mEnd
TrackNodePointer mEnd
Allows end of iteration to be detected without comparison to other TrackIter.
Definition: Track.h:1110
Track::TypeSwitch
R TypeSwitch(const Functions &...functions) const
Use this function rather than testing track type explicitly and making down-casts.
Definition: Track.h:807
Track::TypeInfo
Definition: Track.h:325
Track::Copy
virtual Holder Copy(double WXUNUSED(t0), double WXUNUSED(t1), bool forClipboard=true) const =0
TrackList::cbegin
const_iterator cbegin() const
Definition: Track.h:1336
TrackIterRange::EndingAfter
TrackIterRange EndingAfter(const Track *pTrack) const
Definition: Track.h:1195
Track::LinkType
LinkType
For two tracks describes the type of the linkage.
Definition: Track.h:228
Track::Dispatcher
Helper for recursive case of metafunction implementing Track::TypeSwitch.
Definition: Track.h:508
Track::PasteInto
virtual Holder PasteInto(AudacityProject &) const =0
Find or create the destination track for a paste, maybe in a different project.
TrackIter::mBegin
TrackNodePointer mBegin
Allows end of reverse iteration to be detected without comparison to other TrackIter.
Definition: Track.h:1108
TrackList::Selected
auto Selected() -> TrackIterRange< TrackType >
Definition: Track.h:1396
TrackIter::mIter
TrackNodePointer mIter
Current position.
Definition: Track.h:1109
anonymous_namespace{Track.h}::CollectTrackTypes::Stop
Definition: Track.h:97
anonymous_namespace{Track.h}::TrackTypeCounter
Implements the ENUMERATE_TRACK_TYPE macro.
Definition: Track.h:115
Track::Dispatcher::Switch
Variadic template implements metafunction with specializations, to choose among implementations of op...
Definition: Track.h:583
Track::Executor
Variadic template implements metafunction with specializations, to dispatch Track::TypeSwitch.
Definition: Track.h:504
Track::Dispatcher::applicable2
Third, recursive case of metafunction, generates operator () that calls function with fallthrough.
Definition: Track.h:556
ProjectSettings
Holds various per-project settings values, and sends events to the project when certain values change...
Definition: ProjectSettings.h:60
Track::Dispatcher::Switch< Tag, R, ArgumentType, std::tuple< BaseClass, BaseClasses... > >::test
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
Definition: Track.h:622
TrackAttachment.h
abstract base class for structures that user interface associates with tracks