Audacity  3.0.3
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
TrackList Class Referencefinal

A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list of tracks, event notifications. More...

#include <Track.h>

Inheritance diagram for TrackList:
[legend]
Collaboration diagram for TrackList:
[legend]

Public Types

using iterator = TrackIter< Track >
 
using const_iterator = TrackIter< const Track >
 
using value_type = Track *
 
using Updater = std::function< void(Track &dest, const Track &src) >
 

Public Member Functions

 TrackList (AudacityProject *pOwner)
 
void Swap (TrackList &that)
 
virtual ~TrackList ()
 
AudacityProjectGetOwner ()
 
const AudacityProjectGetOwner () const
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
template<typename TrackType = Track>
auto Find (Track *pTrack) -> TrackIter< TrackType >
 Turn a pointer into a TrackIter (constant time); get end iterator if this does not own the track. More...
 
template<typename TrackType = const Track>
auto Find (const Track *pTrack) const -> typename std::enable_if< std::is_const< TrackType >::value, TrackIter< TrackType > >::type
 Turn a pointer into a TrackIter (constant time); get end iterator if this does not own the track. More...
 
TrackIter< TrackFindLeader (Track *pTrack)
 
TrackIter< const TrackFindLeader (const Track *pTrack) const
 
template<typename TrackType = Track>
auto Any () -> TrackIterRange< TrackType >
 
template<typename TrackType = const Track>
auto Any () const -> typename std::enable_if< std::is_const< TrackType >::value, TrackIterRange< TrackType > >::type
 
template<typename TrackType = Track>
auto Selected () -> TrackIterRange< TrackType >
 
template<typename TrackType = const Track>
auto Selected () const -> typename std::enable_if< std::is_const< TrackType >::value, TrackIterRange< TrackType > >::type
 
template<typename TrackType = Track>
auto Leaders () -> TrackIterRange< TrackType >
 
template<typename TrackType = const Track>
auto Leaders () const -> typename std::enable_if< std::is_const< TrackType >::value, TrackIterRange< TrackType > >::type
 
template<typename TrackType = Track>
auto SelectedLeaders () -> TrackIterRange< TrackType >
 
template<typename TrackType = const Track>
auto SelectedLeaders () const -> typename std::enable_if< std::is_const< TrackType >::value, TrackIterRange< TrackType > >::type
 
void Permute (const std::vector< TrackNodePointer > &permutation)
 For use in sorting: assume each iterator points into this list, no duplications. More...
 
TrackFindById (TrackId id)
 
template<typename TrackKind >
TrackKindAddToHead (const std::shared_ptr< TrackKind > &t)
 Add a Track, giving it a fresh id. More...
 
template<typename TrackKind >
TrackKindAdd (const std::shared_ptr< TrackKind > &t)
 
void GroupChannels (Track &track, size_t groupSize, bool resetChannels=true)
 Define a group of channels starting at the given track. More...
 
ListOfTracks::value_type Replace (Track *t, const ListOfTracks::value_type &with)
 
TrackNodePointer Remove (Track *t)
 Remove the Track and return an iterator to what followed it. More...
 
void Clear (bool sendEvent=true)
 Make the list empty. More...
 
bool CanMoveUp (Track *t) const
 
bool CanMoveDown (Track *t) const
 
bool MoveUp (Track *t)
 
bool MoveDown (Track *t)
 
bool Move (Track *t, bool up)
 
bool Contains (const Track *t) const
 Mainly a test function. Uses a linear search, so could be slow. More...
 
template<typename Subclass >
std::shared_ptr< Subclass > Lock (const std::weak_ptr< Subclass > &wTrack)
 
bool empty () const
 
size_t size () const
 
double GetStartTime () const
 
double GetEndTime () const
 
double GetMinOffset () const
 
std::shared_ptr< TrackRegisterPendingChangedTrack (Updater updater, Track *src)
 
void RegisterPendingNewTrack (const std::shared_ptr< Track > &pTrack)
 
void UpdatePendingTracks ()
 
void ClearPendingTracks (ListOfTracks *pAdded=nullptr)
 
bool ApplyPendingTracks ()
 
bool HasPendingTracks () const
 
- Public Member Functions inherited from ClientData::Base
virtual ~Base ()
 

Static Public Member Functions

static TrackListGet (AudacityProject &project)
 
static const TrackListGet (const AudacityProject &project)
 
static std::shared_ptr< TrackListCreate (AudacityProject *pOwner)
 
template<typename TrackType >
static auto SingletonRange (TrackType *pTrack) -> TrackIterRange< TrackType >
 
static TrackIterRange< TrackSyncLockGroup (Track *pTrack)
 
static TrackIterRange< const TrackSyncLockGroup (const Track *pTrack)
 
template<typename TrackType >
static auto Channels (TrackType *pTrack) -> TrackIterRange< TrackType >
 

Private Member Functions

 TrackList (const TrackList &that)=delete
 
TrackListoperator= (const TrackList &)=delete
 
 TrackList (TrackList &&that)=delete
 
TrackListoperator= (TrackList &&)=delete
 
void clear ()=delete
 
TrackDoAddToHead (const std::shared_ptr< Track > &t)
 
TrackDoAdd (const std::shared_ptr< Track > &t)
 
template<typename TrackType = Track, typename Pred = typename TrackIterRange< TrackType >::iterator::FunctionType>
auto Tracks (const Pred &pred={}) -> TrackIterRange< TrackType >
 
template<typename TrackType = const Track, typename Pred = typename TrackIterRange< TrackType >::iterator::FunctionType>
auto Tracks (const Pred &pred={}) const -> typename std::enable_if< std::is_const< TrackType >::value, TrackIterRange< TrackType > >::type
 
TrackGetPrev (Track *t, bool linked=false) const
 
TrackGetNext (Track *t, bool linked=false) const
 Return a track in the list that comes after Track t. More...
 
std::pair< Track *, Track * > FindSyncLockGroup (Track *pMember) const
 
template<typename TrackType >
TrackIter< TrackType > MakeTrackIterator (TrackNodePointer iter) const
 
template<typename TrackType >
TrackIter< TrackType > EndIterator () const
 
TrackIterRange< TrackEmptyRange () const
 
bool isNull (TrackNodePointer p) const
 
TrackNodePointer getEnd () const
 
TrackNodePointer getBegin () const
 
TrackNodePointer getNext (TrackNodePointer p) const
 Move an iterator to the next node, if any; else stay at end. More...
 
TrackNodePointer getPrev (TrackNodePointer p) const
 Move an iterator to the previous node, if any; else wrap to end. More...
 
void RecalcPositions (TrackNodePointer node)
 
void SelectionEvent (const std::shared_ptr< Track > &pTrack)
 
void PermutationEvent (TrackNodePointer node)
 
void DataEvent (const std::shared_ptr< Track > &pTrack, int code)
 
void EnsureVisibleEvent (const std::shared_ptr< Track > &pTrack, bool modifyState)
 
void DeletionEvent (TrackNodePointer node={})
 
void AdditionEvent (TrackNodePointer node)
 
void ResizingEvent (TrackNodePointer node)
 
void SwapNodes (TrackNodePointer s1, TrackNodePointer s2)
 

Static Private Member Functions

template<typename TrackType , typename InTrackType >
static TrackIterRange< TrackType > Channels_ (TrackIter< InTrackType > iter1)
 

Private Attributes

AudacityProjectmOwner
 
ListOfTracks mPendingUpdates
 Shadow tracks holding append-recording in progress; need to put them into a list so that GetLink() works. More...
 
std::vector< UpdatermUpdaters
 This is in correspondence with mPendingUpdates. More...
 

Static Private Attributes

static long sCounter = -1
 

Friends

class Track
 

Detailed Description

A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list of tracks, event notifications.

Definition at line 1259 of file Track.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 1306 of file Track.h.

◆ iterator

Definition at line 1305 of file Track.h.

◆ Updater

using TrackList::Updater = std::function< void(Track &dest, const Track &src) >

Definition at line 1648 of file Track.h.

◆ value_type

Definition at line 1307 of file Track.h.

Constructor & Destructor Documentation

◆ TrackList() [1/3]

TrackList::TrackList ( const TrackList that)
privatedelete

◆ TrackList() [2/3]

TrackList::TrackList ( TrackList &&  that)
privatedelete

◆ TrackList() [3/3]

TrackList::TrackList ( AudacityProject pOwner)
explicit

Definition at line 505 of file Track.cpp.

506 : wxEvtHandler()
507 , mOwner{ pOwner }
508 {
509 }

◆ ~TrackList()

TrackList::~TrackList ( )
virtual

Definition at line 548 of file Track.cpp.

549 {
550  Clear(false);
551 }

References Clear().

Here is the call graph for this function:

Member Function Documentation

◆ Add()

template<typename TrackKind >
TrackKind* TrackList::Add ( const std::shared_ptr< TrackKind > &  t)
inline

◆ AdditionEvent()

void TrackList::AdditionEvent ( TrackNodePointer  node)
private

Definition at line 617 of file Track.cpp.

618 {
619  // wxWidgets will own the event object
620  QueueEvent( safenew TrackListEvent{ EVT_TRACKLIST_ADDITION, *node.first } );
621 }

References safenew.

Referenced by ApplyPendingTracks(), DoAdd(), and DoAddToHead().

Here is the caller graph for this function:

◆ AddToHead()

template<typename TrackKind >
TrackKind* TrackList::AddToHead ( const std::shared_ptr< TrackKind > &  t)
inline

Add a Track, giving it a fresh id.

Definition at line 1483 of file Track.h.

1484  { return static_cast< TrackKind* >( DoAddToHead( t ) ); }

◆ Any() [1/2]

template<typename TrackType = Track>
auto TrackList::Any ( ) -> TrackIterRange< TrackType >
inline

Definition at line 1355 of file Track.h.

1357  {
1358  return Tracks< TrackType >();
1359  }

Referenced by anonymous_namespace{Track.cpp}::Accumulate(), ImportCommand::Apply(), LabelDefaultClickHandle::Click(), Effect::CopyInputTracks(), ExportMultipleDialog::CountTracksAndLabels(), ExportPlugin::CreateMixer(), CutCopyAvailableFlag(), DefaultPlayOptions(), DefaultSpeedPlayOptions(), LabelTrackView::DoKeyDown(), TrackPanel::DrawTracks(), anonymous_namespace{LabelMenus.cpp}::EditByLabel(), anonymous_namespace{LabelMenus.cpp}::EditClipboardByLabel(), ControlToolBar::EnableDisableButtons(), TranscriptionToolBar::EnableDisableButtons(), GetInfoCommand::ExploreTrackPanel(), ExportMultipleDialog::ExportMultipleByTrack(), LabelDialog::FindAllLabels(), anonymous_namespace{Snap.cpp}::FindCandidates(), anonymous_namespace{TimeShiftHandle.cpp}::FindCorrespondence(), ProjectAudioManager::GetAllPlaybackTracks(), GetAllSeqBlocks(), GetNumExportChannels(), TrackView::GetTotalHeight(), MixerBoard::HasSolo(), ClipMoveState::Init(), ODTask::IsTaskAssociatedWithProject(), LabelTracksExistFlag(), NoteTracksExistFlag(), AudacityPrintout::OnPrintPage(), ProjectAudioManager::OnRecord(), LabelDialog::OnSelectCell(), ScreenshotBigDialog::OnShortTracks(), TransportActions::Handler::OnTimerRecord(), TranscriptionToolBar::PlayAtSpeed(), ProjectHistory::PopState(), Effect::Preview(), EffectFindClipping::Process(), SelectionState::SelectNone(), SelectionState::SelectRangeOfTracks(), TracksExistFlag(), LabelDialog::TransferDataFromWindow(), LyricsPanel::UpdateLyrics(), TrackPanel::UpdateVRulerSize(), VisitBlocks(), Mixer::WarpOptions::WarpOptions(), WaveTracksExistFlag(), ZoomInAvailableFlag(), ZoomOutAvailableFlag(), and SelectionStateChanger::~SelectionStateChanger().

◆ Any() [2/2]

template<typename TrackType = const Track>
auto TrackList::Any ( ) const -> typename std::enable_if< std::is_const<TrackType>::value, TrackIterRange< TrackType > >::type
inline

Definition at line 1362 of file Track.h.

1366  {
1367  return Tracks< TrackType >();
1368  }

◆ ApplyPendingTracks()

bool TrackList::ApplyPendingTracks ( )
Exception safety guarantee:
Strong

Definition at line 1119 of file Track.cpp.

1120 {
1121  bool result = false;
1122 
1123  ListOfTracks additions;
1124  ListOfTracks updates;
1125  {
1126  // Always clear, even if one of the update functions throws
1127  auto cleanup = finally( [&] { ClearPendingTracks( &additions ); } );
1129  updates.swap( mPendingUpdates );
1130  }
1131 
1132  // Remaining steps must be No-fail-guarantee so that this function
1133  // gives Strong-guarantee
1134 
1135  std::vector< std::shared_ptr<Track> > reinstated;
1136 
1137  for (auto &pendingTrack : updates) {
1138  if (pendingTrack) {
1139  if (pendingTrack->mpView)
1140  pendingTrack->mpView->Reparent( pendingTrack );
1141  if (pendingTrack->mpControls)
1142  pendingTrack->mpControls->Reparent( pendingTrack );
1143  auto src = FindById( pendingTrack->GetId() );
1144  if (src)
1145  this->Replace(src, pendingTrack), result = true;
1146  else
1147  // Perhaps a track marked for pending changes got deleted by
1148  // some other action. Recreate it so we don't lose the
1149  // accumulated changes.
1150  reinstated.push_back(pendingTrack);
1151  }
1152  }
1153 
1154  // If there are tracks to reinstate, append them to the list.
1155  for (auto &pendingTrack : reinstated)
1156  if (pendingTrack)
1157  this->Add( pendingTrack ), result = true;
1158 
1159  // Put the pending added tracks back into the list, preserving their
1160  // positions.
1161  bool inserted = false;
1162  ListOfTracks::iterator first;
1163  for (auto &pendingTrack : additions) {
1164  if (pendingTrack) {
1165  auto iter = ListOfTracks::begin();
1166  std::advance( iter, pendingTrack->GetIndex() );
1167  iter = ListOfTracks::insert( iter, pendingTrack );
1168  pendingTrack->SetOwner( shared_from_this(), {iter, this} );
1169  pendingTrack->SetId( TrackId{ ++sCounter } );
1170  if (!inserted) {
1171  first = iter;
1172  inserted = true;
1173  }
1174  }
1175  }
1176  if (inserted) {
1177  TrackNodePointer node{first, this};
1178  RecalcPositions(node);
1179  AdditionEvent(node);
1180  result = true;
1181  }
1182 
1183  return result;
1184 }

References Add(), AdditionEvent(), ClearPendingTracks(), FindById(), mPendingUpdates, RecalcPositions(), Replace(), sCounter, and UpdatePendingTracks().

Referenced by ProjectAudioManager::OnCommitRecording().

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

◆ begin() [1/2]

iterator TrackList::begin ( )
inline

Definition at line 1308 of file Track.h.

1308 { return Any().begin(); }

Referenced by TimeShiftHandle::DoSlideVertical(), empty(), HasPendingTracks(), and EffectTruncSilence::ProcessAll().

Here is the caller graph for this function:

◆ begin() [2/2]

const_iterator TrackList::begin ( ) const
inline

Definition at line 1310 of file Track.h.

1310 { return Any().begin(); }

◆ CanMoveDown()

bool TrackList::CanMoveDown ( Track t) const

Definition at line 884 of file Track.cpp.

885 {
886  return GetNext(t, true) != NULL;
887 }

References GetNext().

Here is the call graph for this function:

◆ CanMoveUp()

bool TrackList::CanMoveUp ( Track t) const

Definition at line 879 of file Track.cpp.

880 {
881  return GetPrev(t, true) != NULL;
882 }

References GetPrev().

Here is the call graph for this function:

◆ cbegin()

const_iterator TrackList::cbegin ( ) const
inline

Definition at line 1312 of file Track.h.

1312 { return begin(); }

◆ cend()

const_iterator TrackList::cend ( ) const
inline

Definition at line 1313 of file Track.h.

1313 { return end(); }

◆ Channels()

template<typename TrackType >
static auto TrackList::Channels ( TrackType *  pTrack) -> TrackIterRange< TrackType >
inlinestatic

Definition at line 1468 of file Track.h.

1470  {
1471  return Channels_<TrackType>( pTrack->GetOwner()->FindLeader(pTrack) );
1472  }

Referenced by AppendItem(), SelectTracksCommand::Apply(), SetTrackBase::Apply(), anonymous_namespace{ClipMenus.cpp}::ChannelsHaveDifferentClipBoundaries(), anonymous_namespace{TrackPanel.cpp}::ResizingChannelGroup::Children(), anonymous_namespace{TrackPanel.cpp}::Subgroup::Children(), anonymous_namespace{TrackPanel.cpp}::ChannelGroup::Children(), ProjectAudioManager::ChooseExistingRecordingTracks(), TrackPanelResizeHandle::Click(), CutlineHandle::Click(), EnvelopeHandle::Click(), WaveformPrefs::Commit(), MinimizeButtonHandle::CommitChanges(), TrackShifter::CommonMayMigrateTo(), anonymous_namespace{TrackMenus.cpp}::DoAlign(), anonymous_namespace{ClipMenus.cpp}::DoClipMove(), WaveformVRulerControls::DoHandleWheelRotation(), SpectrumVRulerControls::DoHandleWheelRotation(), ClipMoveState::DoHorizontalOffset(), anonymous_namespace{TrackMenus.cpp}::DoMixAndRender(), TrackUtilities::DoRemoveTrack(), anonymous_namespace{TrackMenus.cpp}::DoSortTracks(), TrackUtilities::DoTrackMute(), TrackUtilities::DoTrackSolo(), SpectrumVZoomHandle::DoZoom(), WaveformVZoomHandle::DoZoom(), TrackPanelResizeHandle::Drag(), anonymous_namespace{TrackPanel.cpp}::ChannelGroup::Draw(), TrackPanelResizerCell::Draw(), SpectrumView::Draw(), WaveformView::Draw(), ExportMultipleDialog::ExportMultipleByTrack(), anonymous_namespace{ClipMenus.cpp}::FindClipBoundaries(), anonymous_namespace{ClipMenus.cpp}::FindClips(), TrackView::GetChannelGroupHeight(), ContrastDialog::GetDB(), CommonTrackView::GetMinimizedHeight(), MixerTrackCluster::GetRight(), VampEffect::Init(), ClipMoveState::Init(), TrackPanelAx::IsFocused(), LOFImportFileHandle::lofOpenFiles(), MixAndRender(), TrackPanel::OnEnsureVisible(), FormatMenuTable::OnFormatChange(), WaveTrackMenuTable::OnMultiView(), EditActions::Handler::OnPaste(), WaveTrackMenuTable::OnSetDisplay(), TrackMenuTable::OnSetName(), SpectrumVRulerMenuTable::OnSpectrumScaleType(), WaveTrackMenuTable::OnSwapChannels(), WaveColorMenuTable::OnWaveColorChange(), WaveformVRulerMenuTable::OnWaveformScaleType(), IsVisibleTrack::operator()(), SpectrumPrefs::Preview(), EffectLoudness::Process(), EffectNormalize::Process(), NyquistEffect::Process(), EffectSBSMS::Process(), EffectStereoToMono::Process(), VampEffect::Process(), EffectTruncSilence::ProcessIndependently(), NyquistEffect::ProcessOne(), Effect::ProcessPass(), TrackPanel::RefreshTrack(), SpectrumPrefs::Rollback(), SelectionState::SelectTrack(), SelectionState::SelectTrackLength(), GetInfoCommand::SendTracks(), TrackView::SetMinimized(), RateMenuTable::SetRate(), anonymous_namespace{TrackMenus.cpp}::SetTrackGain(), anonymous_namespace{TrackMenus.cpp}::SetTrackPan(), GainSliderHandle::SetValue(), PanSliderHandle::SetValue(), ScreenshotBigDialog::SizeTracks(), WaveTrackMenuTable::SplitStereo(), AudioIO::StartStream(), anonymous_namespace{WaveTrackControls.cpp}::Status1DrawFunction(), SwapNodes(), and TrackPanel::UpdateTrackVRuler().

◆ Channels_()

template<typename TrackType , typename InTrackType >
static TrackIterRange< TrackType > TrackList::Channels_ ( TrackIter< InTrackType >  iter1)
inlinestaticprivate

Definition at line 1446 of file Track.h.

1447  {
1448  // Assume iterator filters leader tracks
1449  if (*iter1) {
1450  return {
1451  iter1.Filter( &Track::Any )
1452  .template Filter<TrackType>(),
1453  (++iter1).Filter( &Track::Any )
1454  .template Filter<TrackType>()
1455  };
1456  }
1457  else
1458  // empty range
1459  return {
1460  iter1.template Filter<TrackType>(),
1461  iter1.template Filter<TrackType>()
1462  };
1463  }

References Track::Any(), and TrackIter< TrackType >::Filter().

Here is the call graph for this function:

◆ clear()

void TrackList::clear ( )
privatedelete

◆ Clear()

void TrackList::Clear ( bool  sendEvent = true)

Make the list empty.

Definition at line 801 of file Track.cpp.

802 {
803  // Null out the back-pointers to this in tracks, in case there
804  // are outstanding shared_ptrs to those tracks, making them outlive
805  // the temporary ListOfTracks below.
806  for ( auto pTrack: *this )
807  pTrack->SetOwner( {}, {} );
808  for ( auto pTrack: mPendingUpdates )
809  pTrack->SetOwner( {}, {} );
810 
811  ListOfTracks tempList;
812  tempList.swap( *this );
813 
814  ListOfTracks updating;
815  updating.swap( mPendingUpdates );
816 
817  mUpdaters.clear();
818 
819  if (sendEvent)
820  DeletionEvent();
821 }

References DeletionEvent(), mPendingUpdates, and mUpdaters.

Referenced by ~TrackList().

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

◆ ClearPendingTracks()

void TrackList::ClearPendingTracks ( ListOfTracks pAdded = nullptr)
Exception safety guarantee:
No-fail

Definition at line 1078 of file Track.cpp.

1079 {
1080  for (const auto &pTrack: mPendingUpdates)
1081  pTrack->SetOwner( {}, {} );
1082  mPendingUpdates.clear();
1083  mUpdaters.clear();
1084 
1085  if (pAdded)
1086  pAdded->clear();
1087 
1088  // To find the first node that remains after the first deleted one
1089  TrackNodePointer node;
1090  bool foundNode = false;
1091 
1092  for (auto it = ListOfTracks::begin(), stop = ListOfTracks::end();
1093  it != stop;) {
1094  if (it->get()->GetId() == TrackId{}) {
1095  do {
1096  if (pAdded)
1097  pAdded->push_back( *it );
1098  (*it)->SetOwner( {}, {} );
1099  it = erase( it );
1100  }
1101  while (it != stop && it->get()->GetId() == TrackId{});
1102 
1103  if (!foundNode && it != stop) {
1104  node = (*it)->GetNode();
1105  foundNode = true;
1106  }
1107  }
1108  else
1109  ++it;
1110  }
1111 
1112  if (!empty()) {
1114  DeletionEvent( node );
1115  }
1116 }

References DeletionEvent(), empty(), getBegin(), mPendingUpdates, mUpdaters, and RecalcPositions().

Referenced by ApplyPendingTracks(), ProjectAudioManager::CancelRecording(), and AudacityApp::OnExceptionInMainLoop().

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

◆ Contains()

bool TrackList::Contains ( const Track t) const

Mainly a test function. Uses a linear search, so could be slow.

Definition at line 978 of file Track.cpp.

979 {
980  return make_iterator_range( *this ).contains( t );
981 }

References make_iterator_range().

Here is the call graph for this function:

◆ Create()

std::shared_ptr< TrackList > TrackList::Create ( AudacityProject pOwner)
static

◆ DataEvent()

void TrackList::DataEvent ( const std::shared_ptr< Track > &  pTrack,
int  code 
)
private

Definition at line 583 of file Track.cpp.

584 {
585  // wxWidgets will own the event object
586  QueueEvent(
587  safenew TrackListEvent{ EVT_TRACKLIST_TRACK_DATA_CHANGE, pTrack, code } );
588 }

References safenew.

◆ DeletionEvent()

void TrackList::DeletionEvent ( TrackNodePointer  node = {})
private

Definition at line 606 of file Track.cpp.

607 {
608  // wxWidgets will own the event object
609  QueueEvent( safenew TrackListEvent{
610  EVT_TRACKLIST_DELETION,
611  node.second && node.first != node.second->end()
612  ? *node.first
613  : nullptr
614  } );
615 }

References safenew.

Referenced by Clear(), ClearPendingTracks(), and Remove().

Here is the caller graph for this function:

◆ DoAdd()

Track * TrackList::DoAdd ( const std::shared_ptr< Track > &  t)
private

Definition at line 694 of file Track.cpp.

695 {
696  push_back(t);
697 
698  auto n = getPrev( getEnd() );
699 
700  t->SetOwner(shared_from_this(), n);
701  t->SetId( TrackId{ ++sCounter } );
702  RecalcPositions(n);
703  AdditionEvent(n);
704  return back().get();
705 }

References AdditionEvent(), getEnd(), getPrev(), RecalcPositions(), sCounter, Track::SetId(), and Track::SetOwner().

Here is the call graph for this function:

◆ DoAddToHead()

Track * TrackList::DoAddToHead ( const std::shared_ptr< Track > &  t)
private

Definition at line 682 of file Track.cpp.

683 {
684  Track *pTrack = t.get();
685  push_front(ListOfTracks::value_type(t));
686  auto n = getBegin();
687  pTrack->SetOwner(shared_from_this(), n);
688  pTrack->SetId( TrackId{ ++sCounter } );
689  RecalcPositions(n);
690  AdditionEvent(n);
691  return front().get();
692 }

References AdditionEvent(), getBegin(), RecalcPositions(), sCounter, Track::SetId(), and Track::SetOwner().

Here is the call graph for this function:

◆ empty()

bool TrackList::empty ( ) const

Definition at line 983 of file Track.cpp.

984 {
985  return begin() == end();
986 }

References begin(), and end().

Referenced by anonymous_namespace{Track.cpp}::Accumulate(), ClearPendingTracks(), ProjectFileManager::Import(), ApplyMacroDialog::OnApplyToFiles(), anonymous_namespace{ProjectWindow.cpp}::MouseWheelHandler::operator()(), and size().

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

◆ EmptyRange()

auto TrackList::EmptyRange ( ) const
private

Definition at line 629 of file Track.cpp.

631 {
632  auto it = const_cast<TrackList*>(this)->getEnd();
633  return {
634  { it, it, it, &Track::Any },
635  { it, it, it, &Track::Any }
636  };
637 }

References Track::Any(), and getEnd().

Here is the call graph for this function:

◆ end() [1/2]

iterator TrackList::end ( )
inline

Definition at line 1309 of file Track.h.

1309 { return Any().end(); }

Referenced by TimeShiftHandle::DoSlideVertical(), empty(), GroupChannels(), HasPendingTracks(), and RecalcPositions().

Here is the caller graph for this function:

◆ end() [2/2]

const_iterator TrackList::end ( ) const
inline

Definition at line 1311 of file Track.h.

1311 { return Any().end(); }

◆ EndIterator()

template<typename TrackType >
TrackIter< TrackType > TrackList::EndIterator ( ) const
inlineprivate

Definition at line 1590 of file Track.h.

1591  {
1592  auto e = const_cast<TrackList*>(this)->getEnd();
1593  return { e, e, e };
1594  }

◆ EnsureVisibleEvent()

void TrackList::EnsureVisibleEvent ( const std::shared_ptr< Track > &  pTrack,
bool  modifyState 
)
private

Definition at line 590 of file Track.cpp.

592 {
593  auto pEvent = std::make_unique<TrackListEvent>(
594  EVT_TRACKLIST_TRACK_REQUEST_VISIBLE, pTrack, 0 );
595  pEvent->SetInt( modifyState ? 1 : 0 );
596  // wxWidgets will own the event object
597  QueueEvent( pEvent.release() );
598 }

◆ Find() [1/2]

template<typename TrackType = const Track>
auto TrackList::Find ( const Track pTrack) const -> typename std::enable_if< std::is_const<TrackType>::value, TrackIter< TrackType > >::type
inline

Turn a pointer into a TrackIter (constant time); get end iterator if this does not own the track.

const overload will only produce iterators over const TrackType

Definition at line 1329 of file Track.h.

1333  {
1334  if (!pTrack || pTrack->GetOwner().get() != this)
1335  return EndIterator<TrackType>();
1336  else
1337  return MakeTrackIterator<TrackType>( pTrack->GetNode() );
1338  }

◆ Find() [2/2]

template<typename TrackType = Track>
auto TrackList::Find ( Track pTrack) -> TrackIter< TrackType >
inline

Turn a pointer into a TrackIter (constant time); get end iterator if this does not own the track.

Definition at line 1317 of file Track.h.

1319  {
1320  if (!pTrack || pTrack->GetOwner().get() != this)
1321  return EndIterator<TrackType>();
1322  else
1323  return MakeTrackIterator<TrackType>( pTrack->GetNode() );
1324  }

Referenced by TimeShiftHandle::DoSlideVertical(), anonymous_namespace{TimeShiftHandle.cpp}::FindCorrespondence(), anonymous_namespace{TrackView.cpp}::TrackPositioner::OnUpdate(), and RecalcPositions().

Here is the caller graph for this function:

◆ FindById()

Track * TrackList::FindById ( TrackId  id)

Definition at line 671 of file Track.cpp.

672 {
673  // Linear search. Tracks in a project are usually very few.
674  // Search only the non-pending tracks.
675  auto it = std::find_if( ListOfTracks::begin(), ListOfTracks::end(),
676  [=](const ListOfTracks::value_type &ptr){ return ptr->GetId() == id; } );
677  if (it == ListOfTracks::end())
678  return {};
679  return it->get();
680 }

Referenced by ApplyPendingTracks(), TrackPanelAx::IsFocused(), and UpdatePendingTracks().

Here is the caller graph for this function:

◆ FindLeader() [1/2]

TrackIter< const Track > TrackList::FindLeader ( const Track pTrack) const
inline

Definition at line 1347 of file Track.h.

1348  {
1349  return const_cast<TrackList*>(this)->
1350  FindLeader( const_cast<Track*>(pTrack) ).Filter< const Track >();
1351  }

◆ FindLeader() [2/2]

auto TrackList::FindLeader ( Track pTrack)

Definition at line 648 of file Track.cpp.

650 {
651  auto iter = Find(pTrack);
652  while( *iter && ! ( *iter )->IsLeader() )
653  --iter;
654  return iter.Filter( &Track::IsLeader );
655 }

References ActiveProjects::Find(), and Track::IsLeader().

Referenced by TrackPanel::FindTrackRect(), GroupChannels(), TrackPanel::RefreshTrack(), TrackFocus::Set(), and SwapNodes().

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

◆ FindSyncLockGroup()

std::pair< Track *, Track * > TrackList::FindSyncLockGroup ( Track pMember) const
private

Definition at line 433 of file Track.cpp.

434 {
435  if (!pMember)
436  return { nullptr, nullptr };
437 
438  // A non-trivial sync-locked group is a maximal sub-sequence of the tracks
439  // consisting of any positive number of audio tracks followed by zero or
440  // more label tracks.
441 
442  // Step back through any label tracks.
443  auto member = pMember;
444  while (member && ( nullptr != track_cast<const LabelTrack*>(member) )) {
445  member = GetPrev(member);
446  }
447 
448  // Step back through the wave and note tracks before the label tracks.
449  Track *first = nullptr;
450  while (member && IsSyncLockableNonLabelTrack(member)) {
451  first = member;
452  member = GetPrev(member);
453  }
454 
455  if (!first)
456  // Can't meet the criteria described above. In that case,
457  // consider the track to be the sole member of a group.
458  return { pMember, pMember };
459 
460  Track *last = first;
461  bool inLabels = false;
462 
463  while (const auto next = GetNext(last)) {
464  if ( ! IsGoodNextSyncLockTrack(next, inLabels) )
465  break;
466  last = next;
467  inLabels = (nullptr != track_cast<const LabelTrack*>(last) );
468  }
469 
470  return { first, last };
471 }

References GetNext(), GetPrev(), anonymous_namespace{Track.cpp}::IsGoodNextSyncLockTrack(), and anonymous_namespace{Track.cpp}::IsSyncLockableNonLabelTrack().

Here is the call graph for this function:

◆ Get() [1/2]

TrackList & TrackList::Get ( AudacityProject project)
static

Definition at line 495 of file Track.cpp.

496 {
497  return project.AttachedObjects::Get< TrackList >( key );
498 }

References key.

Referenced by ProjectFileManager::AddImportedTracks(), SelectHandle::AdjustSelection(), AdornedRulerPanel::AdornedRulerPanel(), AnyTracksSelectedPred(), AppendItem(), ImportCommand::Apply(), ScreenshotCommand::Apply(), SelectTimeCommand::Apply(), SelectTracksCommand::Apply(), SetLabelCommand::Apply(), SetTrackBase::Apply(), AudioTracksSelectedFlag(), TrackSelectHandle::CalculateRearrangingThresholds(), TrackPanelResizeHandle::Cancel(), ProjectAudioManager::CancelRecording(), Exporter::CheckMix(), ProjectAudioManager::ChooseExistingRecordingTracks(), ButtonHandle::Click(), TrackPanelResizeHandle::Click(), LabelDefaultClickHandle::Click(), LabelGlyphHandle::Click(), SelectHandle::Click(), TimeShiftHandle::Click(), BackgroundHandle::Click(), CutCopyAvailableFlag(), DefaultPlayOptions(), DefaultSpeedPlayOptions(), anonymous_namespace{LabelMenus.cpp}::DoAddLabel(), anonymous_namespace{TrackMenus.cpp}::DoAlign(), anonymous_namespace{SelectMenus.cpp}::DoBoundaryMove(), anonymous_namespace{ClipMenus.cpp}::DoClipLeftOrRight(), LOFImportFileHandle::doDurationAndScrollOffset(), LabelTrackView::DoEditLabels(), EffectUI::DoEffect(), anonymous_namespace{FileMenus.cpp}::DoExport(), DoImportMIDI(), LabelTrackView::DoKeyDown(), SelectUtilities::DoListSelection(), anonymous_namespace{TrackMenus.cpp}::DoMixAndRender(), anonymous_namespace{TransportMenus.cpp}::DoMoveToLabel(), TrackUtilities::DoMoveTrack(), anonymous_namespace{SelectMenus.cpp}::DoNextPeakFrequency(), anonymous_namespace{NavigationMenus.cpp}::DoNextTrack(), anonymous_namespace{TrackMenus.cpp}::DoPanTracks(), anonymous_namespace{EditMenus.cpp}::DoPasteNothingSelected(), anonymous_namespace{EditMenus.cpp}::DoPasteText(), anonymous_namespace{NavigationMenus.cpp}::DoPrevTrack(), ProjectAudioManager::DoRecord(), TrackUtilities::DoRemoveTrack(), TrackUtilities::DoRemoveTracks(), ProjectFileManager::DoSave(), SelectUtilities::DoSelectSomething(), anonymous_namespace{SelectUtilities.cpp}::DoSelectTimeAndAudioTracks(), SelectUtilities::DoSelectTimeAndTracks(), anonymous_namespace{TrackMenus.cpp}::DoSortTracks(), TrackUtilities::DoTrackMute(), TrackUtilities::DoTrackSolo(), ProjectWindow::DoZoomFit(), anonymous_namespace{ViewMenus.cpp}::DoZoomFitV(), ButtonHandle::Drag(), TrackPanelResizeHandle::Drag(), LabelTextHandle::Drag(), NoteTrackVZoomHandle::Drag(), SpectrumVZoomHandle::Drag(), WaveformVZoomHandle::Drag(), TimeTrackVZoomHandle::Drag(), SelectHandle::Drag(), TimeShiftHandle::Drag(), TrackSelectHandle::Drag(), EditableTracksSelectedPred(), ControlToolBar::EnableDisableButtons(), TranscriptionToolBar::EnableDisableButtons(), UndoManager::EstimateRemovedBlocks(), Exporter::ExamineTracks(), TimerRecordDialog::ExecutePostRecordActions(), GetInfoCommand::ExploreTrackPanel(), ExportCL::Export(), ExportFFmpeg::Export(), ExportFLAC::Export(), ExportMP3::Export(), ExportOGG::Export(), ExportPCM::Export(), anonymous_namespace{ClipMenus.cpp}::FindClipBoundaries(), anonymous_namespace{ClipMenus.cpp}::FindClips(), ProjectWindow::FixScrollbars(), ProjectFileIO::GenerateDoc(), Get(), GetAllSeqBlocks(), FrequencyPlotDialog::GetAudio(), ContrastDialog::GetDB(), GetPropertiesOfSelected(), CompareAudioCommand::GetSelection(), SliderHandle::GetSlider(), ScreenshotCommand::GetTrackRect(), TrackPanelAx::GetTracks(), ProjectWindow::GetZoomOfToFit(), LabelGlyphHandle::HandleGlyphDragRelease(), AUPImportFileHandle::HandleImport(), AUPImportFileHandle::HandleLabelTrack(), AUPImportFileHandle::HandleNoteTrack(), AUPImportFileHandle::HandleTimeTrack(), AUPImportFileHandle::HandleWaveTrack(), SelectHandle::HitTest(), ProjectFileManager::Import(), AUPImportFileHandle::Import(), anonymous_namespace{ProjectFileManager.cpp}::ImportProject(), EffectEqualization::Init(), NyquistEffect::Init(), ProjectHistory::InitialState(), ODTask::IsTaskAssociatedWithProject(), anonymous_namespace{LabelMenus.cpp}::LabelsSelectedFlag(), LabelTracksExistFlag(), AdornedRulerPanel::LockPlayRegion(), LOFImportFileHandle::lofOpenFiles(), MixerBoard::MixerBoard(), ProjectHistory::ModifyState(), anonymous_namespace{SelectMenus.cpp}::MoveWhenAudioInactive(), TrackActions::Handler::MuteTracks(), anonymous_namespace{SelectMenus.cpp}::NearestZeroCrossing(), NoteTracksExistFlag(), NoteTracksSelectedFlag(), ApplyMacroDialog::OnApplyToFiles(), ProjectAudioManager::OnAudioIOStopRecording(), ProjectManager::OnCloseWindow(), ViewActions::Handler::OnCollapseAllTracks(), ProjectAudioManager::OnCommitRecording(), EditActions::Handler::OnCopy(), LabelEditActions::Handler::OnCopyLabels(), SelectActions::Handler::OnCursorTrackEnd(), SelectActions::Handler::OnCursorTrackStart(), EditActions::Handler::OnCut(), LabelEditActions::Handler::OnCutLabels(), EditActions::Handler::OnDelete(), LabelEditActions::Handler::OnDeleteLabels(), EditActions::Handler::OnDisjoin(), LabelEditActions::Handler::OnDisjoinLabels(), EditActions::Handler::OnDuplicate(), AudacityApp::OnExceptionInMainLoop(), ViewActions::Handler::OnExpandAllTracks(), FileActions::Handler::OnExportLabels(), FileActions::Handler::OnExportMIDI(), NavigationActions::Handler::OnFirstTrack(), ContrastDialog::OnGetBackground(), ContrastDialog::OnGetForeground(), FileActions::Handler::OnImportLabels(), EditActions::Handler::OnJoin(), LabelEditActions::Handler::OnJoinLabels(), NavigationActions::Handler::OnLastTrack(), WaveTrackMenuTable::OnMergeStereo(), TrackActions::Handler::OnNewLabelTrack(), TrackActions::Handler::OnNewStereoTrack(), TrackActions::Handler::OnNewTimeTrack(), TrackActions::Handler::OnNewWaveTrack(), EditActions::Handler::OnPaste(), LabelEditActions::Handler::OnPasteNewLabel(), FileActions::Handler::OnPrint(), ProjectAudioManager::OnRecord(), EditActions::Handler::OnRedo(), TrackActions::Handler::OnResample(), SelectActions::Handler::OnSelectCursorEnd(), SelectActions::Handler::OnSelectStartCursor(), SelectActions::Handler::OnSelectSyncLockSel(), SelectActions::Handler::OnSelectTrackStartToEnd(), ScreenshotBigDialog::OnShortTracks(), EditActions::Handler::OnSilence(), LabelEditActions::Handler::OnSilenceLabels(), EditActions::Handler::OnSplit(), EditActions::Handler::OnSplitCut(), LabelEditActions::Handler::OnSplitCutLabels(), EditActions::Handler::OnSplitDelete(), LabelEditActions::Handler::OnSplitDeleteLabels(), LabelEditActions::Handler::OnSplitLabels(), EditActions::Handler::OnSplitNew(), WaveTrackMenuTable::OnSwapChannels(), TransportActions::Handler::OnTimerRecord(), TrackActions::Handler::OnTrackMoveBottom(), TrackActions::Handler::OnTrackMoveDown(), TrackActions::Handler::OnTrackMoveTop(), TrackActions::Handler::OnTrackMoveUp(), EditActions::Handler::OnTrim(), EditActions::Handler::OnUndo(), anonymous_namespace{TrackView.cpp}::TrackPositioner::OnUpdate(), ProjectFileManager::OpenProjectFile(), anonymous_namespace{ProjectWindow.cpp}::MouseWheelHandler::operator()(), TimeTrack::PasteInto(), PlayableTracksExistFlag(), TranscriptionToolBar::PlayAtSpeed(), ProjectAudioManager::PlayPlayRegion(), ProjectHistory::PopState(), TrackSelectHandle::Preview(), NyquistEffect::Process(), TrackPanel::ProcessUIHandleResult(), ProjectHistory::PushState(), ProjectFileManager::ReadProjectFile(), ProjectHistory::RedoAvailable(), ProjectWindow::RedrawProject(), ButtonHandle::Release(), LabelTextHandle::Release(), NoteTrackButtonHandle::Release(), NoteTrackVZoomHandle::Release(), SpectrumVZoomHandle::Release(), WaveformVZoomHandle::Release(), TimeTrackVZoomHandle::Release(), AffordanceHandle::Release(), LabelDefaultClickHandle::RestoreState(), ProjectManager::SafeToOpenProjectInto(), ProjectFileIO::SaveCopy(), LabelDefaultClickHandle::SaveState(), ProjectWindow::ScrollingLowerBoundTime(), anonymous_namespace{SelectMenus.cpp}::SeekWhenAudioInactive(), NoteTrackAffordanceHandle::SelectAt(), WaveTrackAffordanceHandle::SelectAt(), SelectUtilities::SelectNone(), GetInfoCommand::SendClips(), GetInfoCommand::SendEnvelopes(), GetInfoCommand::SendLabels(), GetInfoCommand::SendTracks(), TrackFocus::Set(), ProjectAudioManager::SetupCutPreviewTracks(), ScreenshotBigDialog::SizeTracks(), ProjectWindow::SkipEnd(), WaveTrackMenuTable::SplitStereo(), ProjectSelectionManager::SSBL_GetRate(), StereoRequiredFlag(), TracksExistFlag(), ProjectHistory::UndoAvailable(), LyricsPanel::UpdateLyrics(), ProjectSettings::UpdatePrefs(), WaveTracksExistFlag(), WaveTracksSelectedFlag(), ProjectFileIO::WriteXML(), ProjectWindow::ZoomAfterImport(), ZoomInAvailableFlag(), ZoomOutAvailableFlag(), and InvisibleTemporaryProject::~InvisibleTemporaryProject().

◆ Get() [2/2]

const TrackList & TrackList::Get ( const AudacityProject project)
static

Definition at line 500 of file Track.cpp.

501 {
502  return Get( const_cast< AudacityProject & >( project ) );
503 }

References Get().

Here is the call graph for this function:

◆ getBegin()

TrackNodePointer TrackList::getBegin ( ) const
inlineprivate

Definition at line 1604 of file Track.h.

1605  { return { const_cast<TrackList*>(this)->ListOfTracks::begin(),
1606  const_cast<TrackList*>(this)}; }

Referenced by ClearPendingTracks(), DoAddToHead(), and Permute().

Here is the caller graph for this function:

◆ getEnd()

TrackNodePointer TrackList::getEnd ( ) const
inlineprivate

Definition at line 1601 of file Track.h.

1602  { return { const_cast<TrackList*>(this)->ListOfTracks::end(),
1603  const_cast<TrackList*>(this)}; }

Referenced by DoAdd(), EmptyRange(), Remove(), and size().

Here is the caller graph for this function:

◆ GetEndTime()

double TrackList::GetEndTime ( ) const

Definition at line 1026 of file Track.cpp.

1027 {
1028  return Accumulate(*this, &Track::GetEndTime, -DBL_MAX, std::max);
1029 }

References anonymous_namespace{Track.cpp}::Accumulate(), and Track::GetEndTime().

Referenced by SelectTimeCommand::Apply(), LOFImportFileHandle::doDurationAndScrollOffset(), ExportMultipleDialog::ExportMultipleByLabel(), AdornedRulerPanel::HandleQPRelease(), AudacityPrintout::OnPrintPage(), anonymous_namespace{ProjectWindow.cpp}::MouseWheelHandler::operator()(), AdornedRulerPanel::StartQPPlay(), and AdornedRulerPanel::UpdateQuickPlayPos().

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

◆ GetMinOffset()

double TrackList::GetMinOffset ( ) const

Definition at line 1016 of file Track.cpp.

1017 {
1018  return Accumulate(*this, &Track::GetOffset, DBL_MAX, std::min);
1019 }

References anonymous_namespace{Track.cpp}::Accumulate(), Track::GetOffset(), and min().

Here is the call graph for this function:

◆ GetNext()

Track * TrackList::GetNext ( Track t,
bool  linked = false 
) const
private

Return a track in the list that comes after Track t.

Definition at line 824 of file Track.cpp.

825 {
826  if (t) {
827  auto node = t->GetNode();
828  if ( !isNull( node ) ) {
829  if ( linked && t->GetLinked() )
830  node = getNext( node );
831 
832  if ( !isNull( node ) )
833  node = getNext( node );
834 
835  if ( !isNull( node ) )
836  return node.first->get();
837  }
838  }
839 
840  return nullptr;
841 }

References Track::GetLinked(), getNext(), Track::GetNode(), and isNull().

Referenced by CanMoveDown(), FindSyncLockGroup(), and MoveDown().

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

◆ getNext()

TrackNodePointer TrackList::getNext ( TrackNodePointer  p) const
inlineprivate

Move an iterator to the next node, if any; else stay at end.

Definition at line 1609 of file Track.h.

1610  {
1611  if ( isNull(p) )
1612  return p;
1613  auto q = p;
1614  ++q.first;
1615  return q;
1616  }

Referenced by GetNext(), and Remove().

Here is the caller graph for this function:

◆ GetOwner() [1/2]

AudacityProject* TrackList::GetOwner ( )
inline

Definition at line 1299 of file Track.h.

1299 { return mOwner; }

Referenced by Effect::FindProject(), Track::HasOwner(), and Effect::Preview().

Here is the caller graph for this function:

◆ GetOwner() [2/2]

const AudacityProject* TrackList::GetOwner ( ) const
inline

Definition at line 1300 of file Track.h.

1300 { return mOwner; }

◆ GetPrev()

Track * TrackList::GetPrev ( Track t,
bool  linked = false 
) const
private

Definition at line 843 of file Track.cpp.

844 {
845  if (t) {
846  TrackNodePointer prev;
847  auto node = t->GetNode();
848  if ( !isNull( node ) ) {
849  // linked is true and input track second in team?
850  if (linked) {
851  prev = getPrev( node );
852  if( !isNull( prev ) &&
853  !t->GetLinked() && t->GetLink() )
854  // Make it the first
855  node = prev;
856  }
857 
858  prev = getPrev( node );
859  if ( !isNull( prev ) ) {
860  // Back up once
861  node = prev;
862 
863  // Back up twice sometimes when linked is true
864  if (linked) {
865  prev = getPrev( node );
866  if( !isNull( prev ) &&
867  !(*node.first)->GetLinked() && (*node.first)->GetLink() )
868  node = prev;
869  }
870 
871  return node.first->get();
872  }
873  }
874  }
875 
876  return nullptr;
877 }

References Track::GetLink(), Track::GetLinked(), Track::GetNode(), getPrev(), and isNull().

Referenced by CanMoveUp(), FindSyncLockGroup(), and MoveUp().

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

◆ getPrev()

TrackNodePointer TrackList::getPrev ( TrackNodePointer  p) const
inlineprivate

Move an iterator to the previous node, if any; else wrap to end.

Definition at line 1619 of file Track.h.

1620  {
1621  if (p == getBegin())
1622  return getEnd();
1623  else {
1624  auto q = p;
1625  --q.first;
1626  return q;
1627  }
1628  }

Referenced by DoAdd(), GetPrev(), RecalcPositions(), and size().

Here is the caller graph for this function:

◆ GetStartTime()

double TrackList::GetStartTime ( ) const

Definition at line 1021 of file Track.cpp.

1022 {
1023  return Accumulate(*this, &Track::GetStartTime, DBL_MAX, std::min);
1024 }

References anonymous_namespace{Track.cpp}::Accumulate(), Track::GetStartTime(), and min().

Referenced by AdornedRulerPanel::HandleQPRelease(), and AdornedRulerPanel::StartQPPlay().

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

◆ GroupChannels()

void TrackList::GroupChannels ( Track track,
size_t  groupSize,
bool  resetChannels = true 
)

Define a group of channels starting at the given track.

Parameters
trackand (groupSize - 1) following tracks must be in this list. They will be disassociated from any groups they already belong to.
groupSizemust be at least 1.
resetChannelsif true, disassociated channels will be marked Mono.

Definition at line 707 of file Track.cpp.

709 {
710  // If group size is exactly two, group as stereo, else mono (bug 2195).
711  auto list = track.mList.lock();
712  if ( groupSize > 0 && list.get() == this ) {
713  auto iter = track.mNode.first;
714  auto after = iter;
715  auto end = this->ListOfTracks::end();
716  auto count = groupSize;
717  for ( ; after != end && count; ++after, --count )
718  ;
719  if ( count == 0 ) {
720  auto unlink = [&] ( Track &tr ) {
721  if ( tr.GetLinked() ) {
722  if ( resetChannels ) {
723  auto link = tr.GetLink();
724  if ( link )
725  link->SetChannel( Track::MonoChannel );
726  }
727  tr.SetLinked( false );
728  }
729  if ( resetChannels )
730  tr.SetChannel( Track::MonoChannel );
731  };
732 
733  // Disassociate previous tracks -- at most one
734  auto pLeader = this->FindLeader( &track );
735  if ( *pLeader && *pLeader != &track )
736  unlink( **pLeader );
737 
738  // First disassociate given and later tracks, then reassociate them
739  for ( auto iter2 = iter; iter2 != after; ++iter2 )
740  unlink( **iter2 );
741 
742  if ( groupSize > 1 ) {
743  const auto channel = *iter++;
744  channel->SetLinked( groupSize == 2 );
745  channel->SetChannel( groupSize == 2? Track::LeftChannel : Track::MonoChannel );
746  (*iter++)->SetChannel( groupSize == 2? Track::RightChannel : Track::MonoChannel );
747  while (iter != after)
748  (*iter++)->SetChannel( Track::MonoChannel );
749  }
750  return;
751  }
752  }
753  // *this does not contain the track or sufficient following channels
754  // or group size is zero
756 }

References end(), FindLeader(), Track::LeftChannel, Track::mList, Track::mNode, Track::MonoChannel, Track::RightChannel, and THROW_INCONSISTENCY_EXCEPTION.

Referenced by ProjectAudioManager::DoRecord(), Effect::Preview(), and WaveTrackMenuTable::SplitStereo().

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

◆ HasPendingTracks()

bool TrackList::HasPendingTracks ( ) const

Definition at line 1289 of file Track.cpp.

1290 {
1291  if ( !mPendingUpdates.empty() )
1292  return true;
1293  if (end() != std::find_if(begin(), end(), [](const Track *t){
1294  return t->GetId() == TrackId{};
1295  }))
1296  return true;
1297  return false;
1298 }

References begin(), end(), Track::GetId(), and mPendingUpdates.

Here is the call graph for this function:

◆ isNull()

bool TrackList::isNull ( TrackNodePointer  p) const
inlineprivate

Definition at line 1598 of file Track.h.

1599  { return (p.second == this && p.first == ListOfTracks::end())
1600  || (p.second == &mPendingUpdates && p.first == mPendingUpdates.end()); }

Referenced by GetNext(), GetPrev(), RecalcPositions(), Remove(), and SwapNodes().

Here is the caller graph for this function:

◆ Leaders() [1/2]

template<typename TrackType = Track>
auto TrackList::Leaders ( ) -> TrackIterRange< TrackType >
inline

Definition at line 1389 of file Track.h.

1391  {
1392  return Tracks< TrackType >( &Track::IsLeader );
1393  }

References Track::IsLeader().

Referenced by ExportMultipleDialog::CountTracksAndLabels(), ExportMultipleDialog::ExportMultipleByTrack(), ScreenshotCommand::GetTrackRect(), TrackSelectHandle::Preview(), NyquistEffect::Process(), and MixerBoard::UpdateTrackClusters().

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

◆ Leaders() [2/2]

template<typename TrackType = const Track>
auto TrackList::Leaders ( ) const -> typename std::enable_if< std::is_const<TrackType>::value, TrackIterRange< TrackType > >::type
inline

Definition at line 1396 of file Track.h.

1400  {
1401  return Tracks< TrackType >( &Track::IsLeader );
1402  }

References Track::IsLeader().

Here is the call graph for this function:

◆ Lock()

template<typename Subclass >
std::shared_ptr<Subclass> TrackList::Lock ( const std::weak_ptr< Subclass > &  wTrack)
inline

◆ MakeTrackIterator()

template<typename TrackType >
TrackIter< TrackType > TrackList::MakeTrackIterator ( TrackNodePointer  iter) const
inlineprivate

Definition at line 1581 of file Track.h.

1582  {
1583  auto b = const_cast<TrackList*>(this)->getBegin();
1584  auto e = const_cast<TrackList*>(this)->getEnd();
1585  return { b, iter, e };
1586  }

◆ Move()

bool TrackList::Move ( Track t,
bool  up 
)
inline

Definition at line 1516 of file Track.h.

1516 { return up ? MoveUp(t) : MoveDown(t); }

◆ MoveDown()

bool TrackList::MoveDown ( Track t)

Definition at line 965 of file Track.cpp.

966 {
967  if (t) {
968  Track *n = GetNext(t, true);
969  if (n) {
970  SwapNodes(t->GetNode(), n->GetNode());
971  return true;
972  }
973  }
974 
975  return false;
976 }

References GetNext(), Track::GetNode(), and SwapNodes().

Here is the call graph for this function:

◆ MoveUp()

bool TrackList::MoveUp ( Track t)

Definition at line 952 of file Track.cpp.

953 {
954  if (t) {
955  Track *p = GetPrev(t, true);
956  if (p) {
957  SwapNodes(p->GetNode(), t->GetNode());
958  return true;
959  }
960  }
961 
962  return false;
963 }

References Track::GetNode(), GetPrev(), and SwapNodes().

Here is the call graph for this function:

◆ operator=() [1/2]

TrackList& TrackList::operator= ( const TrackList )
privatedelete

◆ operator=() [2/2]

TrackList& TrackList::operator= ( TrackList &&  )
privatedelete

◆ PermutationEvent()

void TrackList::PermutationEvent ( TrackNodePointer  node)
private

Definition at line 600 of file Track.cpp.

601 {
602  // wxWidgets will own the event object
603  QueueEvent( safenew TrackListEvent{ EVT_TRACKLIST_PERMUTED, *node.first } );
604 }

References safenew.

Referenced by Permute(), and SwapNodes().

Here is the caller graph for this function:

◆ Permute()

void TrackList::Permute ( const std::vector< TrackNodePointer > &  permutation)

For use in sorting: assume each iterator points into this list, no duplications.

Definition at line 657 of file Track.cpp.

658 {
659  for (const auto iter : permutation) {
660  ListOfTracks::value_type track = *iter.first;
661  erase(iter.first);
662  Track *pTrack = track.get();
663  pTrack->SetOwner(shared_from_this(),
664  { insert(ListOfTracks::end(), track), this });
665  }
666  auto n = getBegin();
667  RecalcPositions(n);
668  PermutationEvent(n);
669 }

References getBegin(), PermutationEvent(), RecalcPositions(), and Track::SetOwner().

Here is the call graph for this function:

◆ RecalcPositions()

void TrackList::RecalcPositions ( TrackNodePointer  node)
private

Definition at line 553 of file Track.cpp.

554 {
555  if ( isNull( node ) )
556  return;
557 
558  Track *t;
559  int i = 0;
560 
561  auto prev = getPrev( node );
562  if ( !isNull( prev ) ) {
563  t = prev.first->get();
564  i = t->GetIndex() + 1;
565  }
566 
567  const auto theEnd = end();
568  for (auto n = Find( node.first->get() ); n != theEnd; ++n) {
569  t = *n;
570  t->SetIndex(i++);
571  }
572 
574 }

References end(), Find(), Track::GetIndex(), getPrev(), isNull(), Track::SetIndex(), and UpdatePendingTracks().

Referenced by ApplyPendingTracks(), ClearPendingTracks(), DoAdd(), DoAddToHead(), Permute(), Remove(), and SwapNodes().

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

◆ RegisterPendingChangedTrack()

std::shared_ptr< Track > TrackList::RegisterPendingChangedTrack ( Updater  updater,
Track src 
)

Definition at line 1032 of file Track.cpp.

1033 {
1034  std::shared_ptr<Track> pTrack;
1035  if (src) {
1036  pTrack = src->Clone(); // not duplicate
1037  // Share the satellites with the original, though they do not point back
1038  // to the pending track
1039  pTrack->mpView = src->mpView;
1040  pTrack->mpControls = src->mpControls;
1041  }
1042 
1043  if (pTrack) {
1044  mUpdaters.push_back( updater );
1045  mPendingUpdates.push_back( pTrack );
1046  auto n = mPendingUpdates.end();
1047  --n;
1048  pTrack->SetOwner(shared_from_this(), {n, &mPendingUpdates});
1049  }
1050 
1051  return pTrack;
1052 }

References Track::Clone(), Track::mpControls, mPendingUpdates, Track::mpView, mUpdaters, and Track::SetOwner().

Referenced by ProjectAudioManager::DoRecord().

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

◆ RegisterPendingNewTrack()

void TrackList::RegisterPendingNewTrack ( const std::shared_ptr< Track > &  pTrack)

Definition at line 1054 of file Track.cpp.

1055 {
1056  Add<Track>( pTrack );
1057  pTrack->SetId( TrackId{} );
1058 }

References Track::SetId().

Referenced by ProjectAudioManager::DoRecord().

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

◆ Remove()

TrackNodePointer TrackList::Remove ( Track t)

Remove the Track and return an iterator to what followed it.

Definition at line 780 of file Track.cpp.

781 {
782  auto result = getEnd();
783  if (t) {
784  auto node = t->GetNode();
785  t->SetOwner({}, {});
786 
787  if ( !isNull( node ) ) {
788  ListOfTracks::value_type holder = *node.first;
789 
790  result = getNext( node );
791  erase(node.first);
792  if ( !isNull( result ) )
793  RecalcPositions(result);
794 
795  DeletionEvent(result);
796  }
797  }
798  return result;
799 }

References DeletionEvent(), getEnd(), getNext(), Track::GetNode(), isNull(), RecalcPositions(), and Track::SetOwner().

Referenced by Effect::DoEffect(), and Effect::ReplaceProcessedTracks().

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

◆ Replace()

auto TrackList::Replace ( Track t,
const ListOfTracks::value_type &  with 
)

Replace first track with second track, give back a holder Give the replacement the same id as the replaced

Definition at line 758 of file Track.cpp.

760 {
761  ListOfTracks::value_type holder;
762  if (t && with) {
763  auto node = t->GetNode();
764  t->SetOwner({}, {});
765 
766  holder = *node.first;
767 
768  Track *pTrack = with.get();
769  *node.first = with;
770  pTrack->SetOwner(shared_from_this(), node);
771  pTrack->SetId( t->GetId() );
772  RecalcPositions(node);
773 
774  DeletionEvent(node);
775  AdditionEvent(node);
776  }
777  return holder;
778 }

References Track::SetId(), and Track::SetOwner().

Referenced by ApplyPendingTracks(), Effect::ModifiedAnalysisTrack::ModifiedAnalysisTrack(), and Effect::ReplaceProcessedTracks().

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

◆ ResizingEvent()

void TrackList::ResizingEvent ( TrackNodePointer  node)
private

Definition at line 623 of file Track.cpp.

624 {
625  // wxWidgets will own the event object
626  QueueEvent( safenew TrackListEvent{ EVT_TRACKLIST_RESIZING, *node.first } );
627 }

References safenew.

◆ Selected() [1/2]

template<typename TrackType = Track>
auto TrackList::Selected ( ) -> TrackIterRange< TrackType >
inline

◆ Selected() [2/2]

template<typename TrackType = const Track>
auto TrackList::Selected ( ) const -> typename std::enable_if< std::is_const<TrackType>::value, TrackIterRange< TrackType > >::type
inline

Definition at line 1379 of file Track.h.

1383  {
1384  return Tracks< TrackType >( &Track::IsSelected );
1385  }

References Track::IsSelected().

Here is the call graph for this function:

◆ SelectedLeaders() [1/2]

template<typename TrackType = Track>
auto TrackList::SelectedLeaders ( ) -> TrackIterRange< TrackType >
inline

Definition at line 1406 of file Track.h.

1408  {
1409  return Tracks< TrackType >( &Track::IsSelectedLeader );
1410  }

References Track::IsSelectedLeader().

Referenced by Effect::CountWaveTracks(), ContrastDialog::GetDB(), and TrackPanel::GetSelectedTrackCount().

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

◆ SelectedLeaders() [2/2]

template<typename TrackType = const Track>
auto TrackList::SelectedLeaders ( ) const -> typename std::enable_if< std::is_const<TrackType>::value, TrackIterRange< TrackType > >::type
inline

Definition at line 1413 of file Track.h.

1417  {
1418  return Tracks< TrackType >( &Track::IsSelectedLeader );
1419  }

References Track::IsSelectedLeader().

Here is the call graph for this function:

◆ SelectionEvent()

void TrackList::SelectionEvent ( const std::shared_ptr< Track > &  pTrack)
private

Definition at line 576 of file Track.cpp.

577 {
578  // wxWidgets will own the event object
579  QueueEvent(
580  safenew TrackListEvent{ EVT_TRACKLIST_SELECTION_CHANGE, pTrack } );
581 }

References safenew.

◆ SingletonRange()

template<typename TrackType >
static auto TrackList::SingletonRange ( TrackType *  pTrack) -> TrackIterRange< TrackType >
inlinestatic

Definition at line 1423 of file Track.h.

1425  {
1426  return pTrack->GetOwner()->template Any<TrackType>()
1427  .StartingWith( pTrack ).EndingAfter( pTrack );
1428  }

References TrackIterRange< TrackType >::EndingAfter(), and TrackIterRange< TrackType >::StartingWith().

Referenced by anonymous_namespace{ClipMenus.cpp}::FindClipBoundaries(), anonymous_namespace{ClipMenus.cpp}::FindClips(), EffectLoudness::Process(), and EffectNormalize::Process().

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

◆ size()

size_t TrackList::size ( ) const

Definition at line 988 of file Track.cpp.

989 {
990  int cnt = 0;
991 
992  if (!empty())
993  cnt = getPrev( getEnd() ).first->get()->GetIndex() + 1;
994 
995  return cnt;
996 }

References empty(), getEnd(), and getPrev().

Referenced by ScreenshotCommand::Apply(), and ProjectSettings::UpdatePrefs().

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

◆ Swap()

void TrackList::Swap ( TrackList that)

Definition at line 528 of file Track.cpp.

529 {
530  auto SwapLOTs = [](
531  ListOfTracks &a, const std::weak_ptr< TrackList > &aSelf,
532  ListOfTracks &b, const std::weak_ptr< TrackList > &bSelf )
533  {
534  a.swap(b);
535  for (auto it = a.begin(), last = a.end(); it != last; ++it)
536  (*it)->SetOwner(aSelf, {it, &a});
537  for (auto it = b.begin(), last = b.end(); it != last; ++it)
538  (*it)->SetOwner(bSelf, {it, &b});
539  };
540 
541  const auto self = shared_from_this();
542  const auto otherSelf = that.shared_from_this();
543  SwapLOTs( *this, self, that, otherSelf );
544  SwapLOTs( this->mPendingUpdates, self, that.mPendingUpdates, otherSelf );
545  mUpdaters.swap(that.mUpdaters);
546 }

◆ SwapNodes()

void TrackList::SwapNodes ( TrackNodePointer  s1,
TrackNodePointer  s2 
)
private

Definition at line 893 of file Track.cpp.

894 {
895  // if a null pointer is passed in, we want to know about it
896  wxASSERT(!isNull(s1));
897  wxASSERT(!isNull(s2));
898 
899  // Deal with first track in each team
900  s1 = ( * FindLeader( s1.first->get() ) )->GetNode();
901  s2 = ( * FindLeader( s2.first->get() ) )->GetNode();
902 
903  // Safety check...
904  if (s1 == s2)
905  return;
906 
907  // Be sure s1 is the earlier iterator
908  if ((*s1.first)->GetIndex() >= (*s2.first)->GetIndex())
909  std::swap(s1, s2);
910 
911  // For saving the removed tracks
912  using Saved = std::vector< ListOfTracks::value_type >;
913  Saved saved1, saved2;
914 
915  auto doSave = [&] ( Saved &saved, TrackNodePointer &s ) {
916  size_t nn = Channels( s.first->get() ).size();
917  saved.resize( nn );
918  // Save them in backwards order
919  while( nn-- )
920  saved[nn] = *s.first, s.first = erase(s.first);
921  };
922 
923  doSave( saved1, s1 );
924  // The two ranges are assumed to be disjoint but might abut
925  const bool same = (s1 == s2);
926  doSave( saved2, s2 );
927  if (same)
928  // Careful, we invalidated s1 in the second doSave!
929  s1 = s2;
930 
931  // Reinsert them
932  auto doInsert = [&] ( Saved &saved, TrackNodePointer &s ) {
933  Track *pTrack;
934  for (auto & pointer : saved)
935  pTrack = pointer.get(),
936  // Insert before s, and reassign s to point at the new node before
937  // old s; which is why we saved pointers in backwards order
938  pTrack->SetOwner(shared_from_this(),
939  s = { insert(s.first, pointer), this } );
940  };
941  // This does not invalidate s2 even when it equals s1:
942  doInsert( saved2, s1 );
943  // Even if s2 was same as s1, this correctly inserts the saved1 range
944  // after the saved2 range, when done after:
945  doInsert( saved1, s2 );
946 
947  // Now correct the Index in the tracks, and other things
948  RecalcPositions(s1);
949  PermutationEvent(s1);
950 }

References Channels(), FindLeader(), isNull(), PermutationEvent(), RecalcPositions(), Track::SetOwner(), and anonymous_namespace{NoteTrack.cpp}::swap().

Referenced by MoveDown(), and MoveUp().

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

◆ SyncLockGroup() [1/2]

static TrackIterRange< const Track > TrackList::SyncLockGroup ( const Track pTrack)
inlinestatic

Definition at line 1435 of file Track.h.

1436  {
1437  return SyncLockGroup(const_cast<Track*>(pTrack)).Filter<const Track>();
1438  }

◆ SyncLockGroup() [2/2]

auto TrackList::SyncLockGroup ( Track pTrack)
static

Definition at line 639 of file Track.cpp.

641 {
642  auto pList = pTrack->GetOwner();
643  auto tracks =
644  pList->FindSyncLockGroup( const_cast<Track*>( pTrack ) );
645  return pList->Any().StartingWith(tracks.first).EndingAfter(tracks.second);
646 }

References TrackIterRange< TrackType >::EndingAfter(), and TrackIterRange< TrackType >::StartingWith().

Referenced by ClipMoveState::Init(), Track::IsSyncLockSelected(), NyquistEffect::Process(), EffectTruncSilence::ProcessIndependently(), NyquistEffect::ProcessOne(), StretchHandle::Release(), and SelectionState::SelectTrackLength().

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

◆ Tracks() [1/2]

template<typename TrackType = Track, typename Pred = typename TrackIterRange< TrackType >::iterator::FunctionType>
auto TrackList::Tracks ( const Pred &  pred = {}) -> TrackIterRange< TrackType >
inlineprivate

Definition at line 1551 of file Track.h.

1551  {} )
1553  {
1554  auto b = getBegin(), e = getEnd();
1555  return { { b, b, e, pred }, { b, e, e, pred } };
1556  }

◆ Tracks() [2/2]

template<typename TrackType = const Track, typename Pred = typename TrackIterRange< TrackType >::iterator::FunctionType>
auto TrackList::Tracks ( const Pred &  pred = {}) const -> typename std::enable_if< std::is_const<TrackType>::value, TrackIterRange< TrackType > >::type
inlineprivate

Definition at line 1564 of file Track.h.

1564  {} ) const
1565  -> typename std::enable_if< std::is_const<TrackType>::value,
1567  >::type
1568  {
1569  auto b = const_cast<TrackList*>(this)->getBegin();
1570  auto e = const_cast<TrackList*>(this)->getEnd();
1571  return { { b, b, e, pred }, { b, e, e, pred } };
1572  }

◆ UpdatePendingTracks()

void TrackList::UpdatePendingTracks ( )

Definition at line 1060 of file Track.cpp.

1061 {
1062  auto pUpdater = mUpdaters.begin();
1063  for (const auto &pendingTrack : mPendingUpdates) {
1064  // Copy just a part of the track state, according to the update
1065  // function
1066  const auto &updater = *pUpdater;
1067  auto src = FindById( pendingTrack->GetId() );
1068  if (pendingTrack && src) {
1069  if (updater)
1070  updater( *pendingTrack, *src );
1071  pendingTrack->DoSetLinked(src->GetLinked());
1072  }
1073  ++pUpdater;
1074  }
1075 }

References FindById(), mPendingUpdates, and mUpdaters.

Referenced by ApplyPendingTracks(), ProjectAudioManager::DoRecord(), TrackPanel::ProcessUIHandleResult(), and RecalcPositions().

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

Friends And Related Function Documentation

◆ Track

friend class Track
friend

Definition at line 1474 of file Track.h.

Member Data Documentation

◆ mOwner

AudacityProject* TrackList::mOwner
private

Definition at line 1693 of file Track.h.

◆ mPendingUpdates

ListOfTracks TrackList::mPendingUpdates
private

Shadow tracks holding append-recording in progress; need to put them into a list so that GetLink() works.

Beware, they are in a disjoint iteration sequence from ordinary tracks

Definition at line 1697 of file Track.h.

Referenced by ApplyPendingTracks(), Clear(), ClearPendingTracks(), HasPendingTracks(), RegisterPendingChangedTrack(), and UpdatePendingTracks().

◆ mUpdaters

std::vector< Updater > TrackList::mUpdaters
private

This is in correspondence with mPendingUpdates.

Definition at line 1699 of file Track.h.

Referenced by Clear(), ClearPendingTracks(), RegisterPendingChangedTrack(), and UpdatePendingTracks().

◆ sCounter

long TrackList::sCounter = -1
staticprivate

Definition at line 1645 of file Track.h.

Referenced by ApplyPendingTracks(), DoAdd(), and DoAddToHead().


The documentation for this class was generated from the following files:
TrackList::isNull
bool isNull(TrackNodePointer p) const
Definition: Track.h:1598
key
static const AudacityProject::AttachedObjects::RegisteredFactory key
Definition: Track.cpp:491
anonymous_namespace{Track.cpp}::IsGoodNextSyncLockTrack
bool IsGoodNextSyncLockTrack(const Track *t, bool inLabelSection)
Definition: Track.cpp:231
Track::SetId
void SetId(TrackId id)
Definition: Track.h:272
make_iterator_range
IteratorRange< Iterator > make_iterator_range(const Iterator &i1, const Iterator &i2)
Definition: MemoryX.h:549
Track::RightChannel
static const auto RightChannel
Definition: Track.h:267
TrackList::FindById
Track * FindById(TrackId id)
Definition: Track.cpp:671
TrackList::PermutationEvent
void PermutationEvent(TrackNodePointer node)
Definition: Track.cpp:600
TrackList::getEnd
TrackNodePointer getEnd() const
Definition: Track.h:1601
Track::SetOwner
void SetOwner(const std::weak_ptr< TrackList > &list, TrackNodePointer node)
Update mNode when Track is added to TrackList, or removed from it.
Definition: Track.cpp:137
TrackList::GetNext
Track * GetNext(Track *t, bool linked=false) const
Return a track in the list that comes after Track t.
Definition: Track.cpp:824
Track::GetEndTime
virtual double GetEndTime() const =0
TrackList::Channels
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
Definition: Track.h:1468
TrackList
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition: Track.h:1264
Track::GetLinked
bool GetLinked() const
Definition: Track.h:372
anonymous_namespace{Track.cpp}::IsSyncLockableNonLabelTrack
bool IsSyncLockableNonLabelTrack(const Track *pTrack)
Definition: Track.cpp:226
Track::GetOwner
std::shared_ptr< TrackList > GetOwner() const
Definition: Track.h:368
TrackList::Add
TrackKind * Add(const std::shared_ptr< TrackKind > &t)
Definition: Track.h:1487
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:1317
Track::mNode
TrackNodePointer mNode
Holds iterator to self, so that TrackList::Find can be constant-time.
Definition: Track.h:249
TrackList::RecalcPositions
void RecalcPositions(TrackNodePointer node)
Definition: Track.cpp:553
Track::Any
bool Any() const
Definition: Track.cpp:361
Track::mpControls
std::shared_ptr< CommonTrackCell > mpControls
Definition: Track.h:817
anonymous_namespace{Track.cpp}::Accumulate
double Accumulate(const TrackList &list, double(Track::*memfn)() const, double ident, const double &(*combine)(const double &, const double &))
Definition: Track.cpp:1001
TrackList::end
iterator end()
Definition: Track.h:1309
Track::GetStartTime
virtual double GetStartTime() const =0
TrackList::mUpdaters
std::vector< Updater > mUpdaters
This is in correspondence with mPendingUpdates.
Definition: Track.h:1699
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:1697
TrackList::FindLeader
TrackIter< Track > FindLeader(Track *pTrack)
Definition: Track.cpp:648
Track::mList
std::weak_ptr< TrackList > mList
Definition: Track.h:246
Track::GetId
TrackId GetId() const
Definition: Track.h:270
TrackListEvent
Notification of changes in individual tracks of TrackList, or of TrackList's composition.
Definition: Track.h:1206
TrackList::AdditionEvent
void AdditionEvent(TrackNodePointer node)
Definition: Track.cpp:617
TrackList::mOwner
AudacityProject * mOwner
Definition: Track.h:1693
TrackList::begin
iterator begin()
Definition: Track.h:1308
TrackList::ClearPendingTracks
void ClearPendingTracks(ListOfTracks *pAdded=nullptr)
Definition: Track.cpp:1078
ListOfTracks
std::list< std::shared_ptr< Track > > ListOfTracks
Definition: Track.h:53
Track::MonoChannel
static const auto MonoChannel
Definition: Track.h:268
Track::GetOffset
virtual double GetOffset() const =0
Track::mpView
std::shared_ptr< CommonTrackCell > mpView
Definition: Track.h:816
TrackNodePointer
std::pair< ListOfTracks::iterator, ListOfTracks * > TrackNodePointer
Pairs a std::list iterator and a pointer to a list, for comparison purposes.
Definition: Track.h:59
Track::GetLink
Track * GetLink() const
Definition: Track.cpp:199
Track::Clone
virtual Holder Clone() const =0
TrackList::DoAddToHead
Track * DoAddToHead(const std::shared_ptr< Track > &t)
Definition: Track.cpp:682
Track::IsSelected
bool IsSelected() const
Definition: Track.cpp:364
THROW_INCONSISTENCY_EXCEPTION
#define THROW_INCONSISTENCY_EXCEPTION
Throw InconsistencyException, using C++ preprocessor to identify the source code location.
Definition: InconsistencyException.h:79
Track::LeftChannel
static const auto LeftChannel
Definition: Track.h:266
TrackIter::Filter
TrackIter Filter(const Predicate2 &pred2) const
Return an iterator that replaces the predicate.
Definition: Track.h:950
anonymous_namespace{NoteTrack.cpp}::swap
void swap(std::unique_ptr< Alg_seq > &a, std::unique_ptr< Alg_seq > &b)
Definition: NoteTrack.cpp:735
Track::IsSelectedLeader
bool IsSelectedLeader() const
Definition: Track.cpp:373
TrackIterRange
Range between two TrackIters, usable in range-for statements, and with Visit member functions.
Definition: Track.h:1085
TrackList::MoveUp
bool MoveUp(Track *t)
Definition: Track.cpp:952
TrackList::DeletionEvent
void DeletionEvent(TrackNodePointer node={})
Definition: Track.cpp:606
TrackList::getBegin
TrackNodePointer getBegin() const
Definition: Track.h:1604
TrackList::UpdatePendingTracks
void UpdatePendingTracks()
Definition: Track.cpp:1060
TrackList::Clear
void Clear(bool sendEvent=true)
Make the list empty.
Definition: Track.cpp:801
TrackKind
TrackKind
Enumerates all subclasses of Track (not just the leaf classes) and the None value.
Definition: Track.h:69
min
int min(int a, int b)
Definition: CompareAudioCommand.cpp:106
TrackId
An in-session identifier of track objects across undo states. It does not persist between sessions.
Definition: Track.h:165
Track::GetIndex
int GetIndex() const
Definition: Track.cpp:165
TrackList::Get
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:495
TrackList::GetPrev
Track * GetPrev(Track *t, bool linked=false) const
Definition: Track.cpp:843
TrackList::sCounter
static long sCounter
Definition: Track.h:1645
Track
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:239
Track::IsLeader
bool IsLeader() const
Definition: Track.cpp:370
TrackList::SwapNodes
void SwapNodes(TrackNodePointer s1, TrackNodePointer s2)
Definition: Track.cpp:893
TrackList::DoAdd
Track * DoAdd(const std::shared_ptr< Track > &t)
Definition: Track.cpp:694
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:113
TrackList::Replace
ListOfTracks::value_type Replace(Track *t, const ListOfTracks::value_type &with)
Definition: Track.cpp:758
TrackList::getNext
TrackNodePointer getNext(TrackNodePointer p) const
Move an iterator to the next node, if any; else stay at end.
Definition: Track.h:1609
TrackList::getPrev
TrackNodePointer getPrev(TrackNodePointer p) const
Move an iterator to the previous node, if any; else wrap to end.
Definition: Track.h:1619
TrackList::MoveDown
bool MoveDown(Track *t)
Definition: Track.cpp:965
Track::SetIndex
void SetIndex(int index)
Definition: Track.cpp:170
TrackList::Any
auto Any() -> TrackIterRange< TrackType >
Definition: Track.h:1355
safenew
#define safenew
Definition: MemoryX.h:10
TrackList::SyncLockGroup
static TrackIterRange< Track > SyncLockGroup(Track *pTrack)
Definition: Track.cpp:639
TrackList::empty
bool empty() const
Definition: Track.cpp:983
Track::GetNode
TrackNodePointer GetNode() const
Retrieve mNode with debug checks.
Definition: Track.cpp:130