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 UnlinkChannels (Track &track)
 Removes linkage if track belongs to a group. More...
 
bool MakeMultiChannelTrack (Track &first, int nChannels, bool aligned)
 Converts channels to a multichannel 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 1275 of file Track.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 1322 of file Track.h.

◆ iterator

Definition at line 1321 of file Track.h.

◆ Updater

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

Definition at line 1666 of file Track.h.

◆ value_type

Definition at line 1323 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 516 of file Track.cpp.

517 : wxEvtHandler()
518 , mOwner{ pOwner }
519 {
520 }

◆ ~TrackList()

TrackList::~TrackList ( )
virtual

Definition at line 559 of file Track.cpp.

560 {
561  Clear(false);
562 }

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 628 of file Track.cpp.

629 {
630  // wxWidgets will own the event object
631  QueueEvent( safenew TrackListEvent{ EVT_TRACKLIST_ADDITION, *node.first } );
632 }

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 1499 of file Track.h.

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

◆ Any() [1/2]

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

Definition at line 1371 of file Track.h.

1373  {
1374  return Tracks< TrackType >();
1375  }

Referenced by anonymous_namespace{Track.cpp}::Accumulate(), ImportCommand::Apply(), LabelDefaultClickHandle::Click(), Effect::CopyInputTracks(), ExportMultipleDialog::CountTracksAndLabels(), ExportPlugin::CreateMixer(), CutCopyAvailableFlag(), DefaultPlayOptions(), 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(), LabelTracksExistFlag(), anonymous_namespace{FileMenus.cpp}::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().

Here is the caller graph for this function:

◆ 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 1378 of file Track.h.

1382  {
1383  return Tracks< TrackType >();
1384  }

◆ ApplyPendingTracks()

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

Definition at line 1131 of file Track.cpp.

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

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 1324 of file Track.h.

1324 { 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 1326 of file Track.h.

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

◆ CanMoveDown()

bool TrackList::CanMoveDown ( Track t) const

Definition at line 896 of file Track.cpp.

897 {
898  return GetNext(t, true) != NULL;
899 }

References GetNext().

Here is the call graph for this function:

◆ CanMoveUp()

bool TrackList::CanMoveUp ( Track t) const

Definition at line 891 of file Track.cpp.

892 {
893  return GetPrev(t, true) != NULL;
894 }

References GetPrev().

Here is the call graph for this function:

◆ cbegin()

const_iterator TrackList::cbegin ( ) const
inline

Definition at line 1328 of file Track.h.

1328 { return begin(); }

◆ cend()

const_iterator TrackList::cend ( ) const
inline

Definition at line 1329 of file Track.h.

1329 { return end(); }

◆ Channels()

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

Definition at line 1484 of file Track.h.

1486  {
1487  return Channels_<TrackType>( pTrack->GetOwner()->FindLeader(pTrack) );
1488  }

Referenced by AppendItem(), SelectTracksCommand::Apply(), SetTrackBase::Apply(), WaveTrackView::CaptureKey(), 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{TrackPanel.cpp}::FindAdjustedChannelHeights(), anonymous_namespace{ClipMenus.cpp}::FindClipBoundaries(), anonymous_namespace{ClipMenus.cpp}::FindClips(), anonymous_namespace{WaveClipTrimHandle.cpp}::FindClipsInChannels(), 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(), EditActions::Handler::OnSplit(), WaveTrackMenuTable::OnSwapChannels(), WaveColorMenuTable::OnWaveColorChange(), WaveformVRulerMenuTable::OnWaveformScaleType(), SpectrumPrefs::Preview(), EffectLoudness::Process(), EffectNormalize::Process(), NyquistEffect::Process(), EffectSBSMS::Process(), EffectStereoToMono::Process(), VampEffect::Process(), EffectTruncSilence::ProcessIndependently(), NyquistEffect::ProcessOne(), Effect::ProcessPass(), TrackPanel::RefreshTrack(), SpectrumPrefs::Rollback(), anonymous_namespace{WaveTrackAffordanceControls.cpp}::SelectedClipOfFocusedTrack(), 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(), UnlinkChannels(), and TrackPanel::UpdateTrackVRuler().

◆ Channels_()

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

Definition at line 1462 of file Track.h.

1463  {
1464  // Assume iterator filters leader tracks
1465  if (*iter1) {
1466  return {
1467  iter1.Filter( &Track::Any )
1468  .template Filter<TrackType>(),
1469  (++iter1).Filter( &Track::Any )
1470  .template Filter<TrackType>()
1471  };
1472  }
1473  else
1474  // empty range
1475  return {
1476  iter1.template Filter<TrackType>(),
1477  iter1.template Filter<TrackType>()
1478  };
1479  }

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 813 of file Track.cpp.

814 {
815  // Null out the back-pointers to this in tracks, in case there
816  // are outstanding shared_ptrs to those tracks, making them outlive
817  // the temporary ListOfTracks below.
818  for ( auto pTrack: *this )
819  pTrack->SetOwner( {}, {} );
820  for ( auto pTrack: mPendingUpdates )
821  pTrack->SetOwner( {}, {} );
822 
823  ListOfTracks tempList;
824  tempList.swap( *this );
825 
826  ListOfTracks updating;
827  updating.swap( mPendingUpdates );
828 
829  mUpdaters.clear();
830 
831  if (sendEvent)
832  DeletionEvent();
833 }

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 1090 of file Track.cpp.

1091 {
1092  for (const auto &pTrack: mPendingUpdates)
1093  pTrack->SetOwner( {}, {} );
1094  mPendingUpdates.clear();
1095  mUpdaters.clear();
1096 
1097  if (pAdded)
1098  pAdded->clear();
1099 
1100  // To find the first node that remains after the first deleted one
1101  TrackNodePointer node;
1102  bool foundNode = false;
1103 
1104  for (auto it = ListOfTracks::begin(), stop = ListOfTracks::end();
1105  it != stop;) {
1106  if (it->get()->GetId() == TrackId{}) {
1107  do {
1108  if (pAdded)
1109  pAdded->push_back( *it );
1110  (*it)->SetOwner( {}, {} );
1111  it = erase( it );
1112  }
1113  while (it != stop && it->get()->GetId() == TrackId{});
1114 
1115  if (!foundNode && it != stop) {
1116  node = (*it)->GetNode();
1117  foundNode = true;
1118  }
1119  }
1120  else
1121  ++it;
1122  }
1123 
1124  if (!empty()) {
1126  DeletionEvent( node );
1127  }
1128 }

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 990 of file Track.cpp.

991 {
992  return make_iterator_range( *this ).contains( t );
993 }

References make_iterator_range().

Here is the call graph for this function:

◆ Create()

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

Definition at line 523 of file Track.cpp.

524 {
525  return std::make_shared<TrackList>( pOwner );
526 }

Referenced by Clipboard::Clipboard(), Effect::CopyInputTracks(), ProjectFileManager::DoSave(), anonymous_namespace{LabelMenus.cpp}::EditClipboardByLabel(), UndoManager::ModifyState(), EditActions::Handler::OnCopy(), EditActions::Handler::OnCut(), EditActions::Handler::OnSplitCut(), Effect::Preview(), EffectTwoPassSimpleMono::Process(), UndoManager::PushState(), ProjectFileManager::ReadProjectFile(), and ProjectFileIO::SaveProject().

Here is the caller graph for this function:

◆ DataEvent()

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

Definition at line 594 of file Track.cpp.

595 {
596  // wxWidgets will own the event object
597  QueueEvent(
598  safenew TrackListEvent{ EVT_TRACKLIST_TRACK_DATA_CHANGE, pTrack, code } );
599 }

References safenew.

◆ DeletionEvent()

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

Definition at line 617 of file Track.cpp.

618 {
619  // wxWidgets will own the event object
620  QueueEvent( safenew TrackListEvent{
621  EVT_TRACKLIST_DELETION,
622  node.second && node.first != node.second->end()
623  ? *node.first
624  : nullptr
625  } );
626 }

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 705 of file Track.cpp.

706 {
707  push_back(t);
708 
709  auto n = getPrev( getEnd() );
710 
711  t->SetOwner(shared_from_this(), n);
712  t->SetId( TrackId{ ++sCounter } );
713  RecalcPositions(n);
714  AdditionEvent(n);
715  return back().get();
716 }

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 693 of file Track.cpp.

694 {
695  Track *pTrack = t.get();
696  push_front(ListOfTracks::value_type(t));
697  auto n = getBegin();
698  pTrack->SetOwner(shared_from_this(), n);
699  pTrack->SetId( TrackId{ ++sCounter } );
700  RecalcPositions(n);
701  AdditionEvent(n);
702  return front().get();
703 }

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 995 of file Track.cpp.

996 {
997  return begin() == end();
998 }

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 640 of file Track.cpp.

642 {
643  auto it = const_cast<TrackList*>(this)->getEnd();
644  return {
645  { it, it, it, &Track::Any },
646  { it, it, it, &Track::Any }
647  };
648 }

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

Here is the call graph for this function:

◆ end() [1/2]

iterator TrackList::end ( )
inline

Definition at line 1325 of file Track.h.

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

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

Here is the caller graph for this function:

◆ end() [2/2]

const_iterator TrackList::end ( ) const
inline

Definition at line 1327 of file Track.h.

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

◆ EndIterator()

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

Definition at line 1608 of file Track.h.

1609  {
1610  auto e = const_cast<TrackList*>(this)->getEnd();
1611  return { e, e, e };
1612  }

◆ EnsureVisibleEvent()

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

Definition at line 601 of file Track.cpp.

603 {
604  auto pEvent = std::make_unique<TrackListEvent>(
605  EVT_TRACKLIST_TRACK_REQUEST_VISIBLE, pTrack, 0 );
606  pEvent->SetInt( modifyState ? 1 : 0 );
607  // wxWidgets will own the event object
608  QueueEvent( pEvent.release() );
609 }

◆ 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 1345 of file Track.h.

1349  {
1350  if (!pTrack || pTrack->GetOwner().get() != this)
1351  return EndIterator<TrackType>();
1352  else
1353  return MakeTrackIterator<TrackType>( pTrack->GetNode() );
1354  }

◆ 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 1333 of file Track.h.

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

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 682 of file Track.cpp.

683 {
684  // Linear search. Tracks in a project are usually very few.
685  // Search only the non-pending tracks.
686  auto it = std::find_if( ListOfTracks::begin(), ListOfTracks::end(),
687  [=](const ListOfTracks::value_type &ptr){ return ptr->GetId() == id; } );
688  if (it == ListOfTracks::end())
689  return {};
690  return it->get();
691 }

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 1363 of file Track.h.

1364  {
1365  return const_cast<TrackList*>(this)->
1366  FindLeader( const_cast<Track*>(pTrack) ).Filter< const Track >();
1367  }

◆ FindLeader() [2/2]

auto TrackList::FindLeader ( Track pTrack)

Definition at line 659 of file Track.cpp.

661 {
662  auto iter = Find(pTrack);
663  while( *iter && ! ( *iter )->IsLeader() )
664  --iter;
665  return iter.Filter( &Track::IsLeader );
666 }

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

Referenced by TrackPanel::FindTrackRect(), 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 444 of file Track.cpp.

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

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 506 of file Track.cpp.

507 {
508  return project.AttachedObjects::Get< TrackList >( key );
509 }

References key.

Referenced by SelectUtilities::ActivatePlayRegion(), ProjectFileManager::AddImportedTracks(), SelectHandle::AdjustSelection(), AdornedRulerPanel::AdornedRulerPanel(), AnyTracksSelectedPred(), AppendItem(), ImportCommand::Apply(), ScreenshotCommand::Apply(), SelectTimeCommand::Apply(), SelectTracksCommand::Apply(), SetLabelCommand::Apply(), SetTrackBase::Apply(), BrushHandleHitTest(), TrackSelectHandle::CalculateRearrangingThresholds(), TrackPanelResizeHandle::Cancel(), ProjectAudioManager::CancelRecording(), Exporter::CheckMix(), ProjectAudioManager::ChooseExistingRecordingTracks(), ButtonHandle::Click(), TrackPanelResizeHandle::Click(), LabelDefaultClickHandle::Click(), LabelGlyphHandle::Click(), BrushHandle::Click(), SelectHandle::Click(), TimeShiftHandle::Click(), BackgroundHandle::Click(), CutCopyAvailableFlag(), DefaultPlayOptions(), 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(), BrushHandle::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(), SpectrumView::ForAll(), 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(), anonymous_namespace{LabelMenus.cpp}::LabelsSelectedFlag(), LabelTracksExistFlag(), LOFImportFileHandle::lofOpenFiles(), MixerBoard::MixerBoard(), ProjectHistory::ModifyState(), anonymous_namespace{SelectMenus.cpp}::MoveWhenAudioInactive(), TrackActions::Handler::MuteTracks(), anonymous_namespace{SelectMenus.cpp}::NearestZeroCrossing(), anonymous_namespace{FileMenus.cpp}::NoteTracksExistFlag(), 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(), anonymous_namespace{MixerBoard.cpp}::PlayableTracksExistFlag(), TranscriptionToolBar::PlayAtSpeed(), ProjectAudioManager::PlayPlayRegion(), ProjectHistory::PopState(), TrackSelectHandle::Preview(), NyquistEffect::Process(), SpectralDataManager::ProcessTracks(), 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(), SelectUtilities::SelectNone(), GetInfoCommand::SendClips(), GetInfoCommand::SendEnvelopes(), GetInfoCommand::SendLabels(), GetInfoCommand::SendTracks(), TrackFocus::Set(), ScreenshotBigDialog::SizeTracks(), ProjectWindow::SkipEnd(), WaveTrackMenuTable::SplitStereo(), ProjectSelectionManager::SSBL_GetRate(), StereoRequiredFlag(), TracksExistFlag(), ProjectHistory::UndoAvailable(), LyricsPanel::UpdateLyrics(), ProjectSettings::UpdatePrefs(), WaveTracksExistFlag(), WaveTracksSelectedFlag(), ProjectFileIO::WriteXML(), ProjectWindow::ZoomAfterImport(), ZoomInAvailableFlag(), and ZoomOutAvailableFlag().

◆ Get() [2/2]

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

Definition at line 511 of file Track.cpp.

512 {
513  return Get( const_cast< AudacityProject & >( project ) );
514 }

References Get().

Here is the call graph for this function:

◆ getBegin()

TrackNodePointer TrackList::getBegin ( ) const
inlineprivate

Definition at line 1622 of file Track.h.

1623  { return { const_cast<TrackList*>(this)->ListOfTracks::begin(),
1624  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 1619 of file Track.h.

1620  { return { const_cast<TrackList*>(this)->ListOfTracks::end(),
1621  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 1038 of file Track.cpp.

1039 {
1040  return Accumulate(*this, &Track::GetEndTime, -DBL_MAX, std::max);
1041 }

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

Referenced by SelectTimeCommand::Apply(), LOFImportFileHandle::doDurationAndScrollOffset(), ExportMultipleDialog::ExportMultipleByLabel(), 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 1028 of file Track.cpp.

1029 {
1030  return Accumulate(*this, &Track::GetOffset, DBL_MAX, std::min);
1031 }

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 836 of file Track.cpp.

837 {
838  if (t) {
839  auto node = t->GetNode();
840  if ( !isNull( node ) ) {
841  if ( linked && t->HasLinkedTrack() )
842  node = getNext( node );
843 
844  if ( !isNull( node ) )
845  node = getNext( node );
846 
847  if ( !isNull( node ) )
848  return node.first->get();
849  }
850  }
851 
852  return nullptr;
853 }

References getNext(), Track::GetNode(), Track::HasLinkedTrack(), 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 1627 of file Track.h.

1628  {
1629  if ( isNull(p) )
1630  return p;
1631  auto q = p;
1632  ++q.first;
1633  return q;
1634  }

Referenced by GetNext(), and Remove().

Here is the caller graph for this function:

◆ GetOwner() [1/2]

AudacityProject* TrackList::GetOwner ( )
inline

Definition at line 1315 of file Track.h.

1315 { 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 1316 of file Track.h.

1316 { return mOwner; }

◆ GetPrev()

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

Definition at line 855 of file Track.cpp.

856 {
857  if (t) {
858  TrackNodePointer prev;
859  auto node = t->GetNode();
860  if ( !isNull( node ) ) {
861  // linked is true and input track second in team?
862  if (linked) {
863  prev = getPrev( node );
864  if( !isNull( prev ) &&
865  !t->HasLinkedTrack() && t->GetLinkedTrack() )
866  // Make it the first
867  node = prev;
868  }
869 
870  prev = getPrev( node );
871  if ( !isNull( prev ) ) {
872  // Back up once
873  node = prev;
874 
875  // Back up twice sometimes when linked is true
876  if (linked) {
877  prev = getPrev( node );
878  if( !isNull( prev ) &&
879  !(*node.first)->HasLinkedTrack() && (*node.first)->GetLinkedTrack() )
880  node = prev;
881  }
882 
883  return node.first->get();
884  }
885  }
886  }
887 
888  return nullptr;
889 }

References Track::GetLinkedTrack(), Track::GetNode(), getPrev(), Track::HasLinkedTrack(), 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 1637 of file Track.h.

1638  {
1639  if (p == getBegin())
1640  return getEnd();
1641  else {
1642  auto q = p;
1643  --q.first;
1644  return q;
1645  }
1646  }

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

Here is the caller graph for this function:

◆ GetStartTime()

double TrackList::GetStartTime ( ) const

Definition at line 1033 of file Track.cpp.

1034 {
1035  return Accumulate(*this, &Track::GetStartTime, DBL_MAX, std::min);
1036 }

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

Referenced by AdornedRulerPanel::StartQPPlay().

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

◆ HasPendingTracks()

bool TrackList::HasPendingTracks ( ) const

Definition at line 1301 of file Track.cpp.

1302 {
1303  if ( !mPendingUpdates.empty() )
1304  return true;
1305  if (end() != std::find_if(begin(), end(), [](const Track *t){
1306  return t->GetId() == TrackId{};
1307  }))
1308  return true;
1309  return false;
1310 }

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 1616 of file Track.h.

1617  { return (p.second == this && p.first == ListOfTracks::end())
1618  || (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 1405 of file Track.h.

1407  {
1408  return Tracks< TrackType >( &Track::IsLeader );
1409  }

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 1412 of file Track.h.

1416  {
1417  return Tracks< TrackType >( &Track::IsLeader );
1418  }

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

◆ MakeMultiChannelTrack()

bool TrackList::MakeMultiChannelTrack ( Track first,
int  nChannels,
bool  aligned 
)

Converts channels to a multichannel track.

Parameters
firstand the following must be in this list. Tracks should not be a part of another group (not linked)
nChannelsnumber of channels, for now only 2 channels supported
alignedif true, the link type will be set to Track::LinkType::Aligned, or Track::LinkType::Group otherwise
Returns
true on success, false if some prerequisites do not met

Definition at line 756 of file Track.cpp.

757 {
758  if (nChannels != 2)
759  return false;
760 
761  auto list = track.mList.lock();
762  if (list.get() == this)
763  {
764  if (*list->FindLeader(&track) != &track)
765  return false;
766 
767  auto first = list->Find(&track);
768  auto canLink = [&]() -> bool {
769  int count = nChannels;
770  for (auto it = first, end = TrackList::end(); it != end && count; ++it)
771  {
772  if ((*it)->HasLinkedTrack())
773  return false;
774  --count;
775  }
776  return count == 0;
777  }();
778 
779  if (!canLink)
780  return false;
781 
782  (*first)->SetLinkType(aligned ? Track::LinkType::Aligned : Track::LinkType::Group);
783  (*first)->SetChannel(Track::LeftChannel);
784  auto second = std::next(first);
785  (*second)->SetChannel(Track::RightChannel);
786  }
787  else
789  return true;
790 }

References Track::Aligned, end(), Track::Group, Track::LeftChannel, Track::mList, Track::RightChannel, and THROW_INCONSISTENCY_EXCEPTION.

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

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

◆ MakeTrackIterator()

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

Definition at line 1599 of file Track.h.

1600  {
1601  auto b = const_cast<TrackList*>(this)->getBegin();
1602  auto e = const_cast<TrackList*>(this)->getEnd();
1603  return { b, iter, e };
1604  }

◆ Move()

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

Definition at line 1534 of file Track.h.

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

◆ MoveDown()

bool TrackList::MoveDown ( Track t)

Definition at line 977 of file Track.cpp.

978 {
979  if (t) {
980  Track *n = GetNext(t, true);
981  if (n) {
982  SwapNodes(t->GetNode(), n->GetNode());
983  return true;
984  }
985  }
986 
987  return false;
988 }

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

Here is the call graph for this function:

◆ MoveUp()

bool TrackList::MoveUp ( Track t)

Definition at line 964 of file Track.cpp.

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

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 611 of file Track.cpp.

612 {
613  // wxWidgets will own the event object
614  QueueEvent( safenew TrackListEvent{ EVT_TRACKLIST_PERMUTED, *node.first } );
615 }

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 668 of file Track.cpp.

669 {
670  for (const auto iter : permutation) {
671  ListOfTracks::value_type track = *iter.first;
672  erase(iter.first);
673  Track *pTrack = track.get();
674  pTrack->SetOwner(shared_from_this(),
675  { insert(ListOfTracks::end(), track), this });
676  }
677  auto n = getBegin();
678  RecalcPositions(n);
679  PermutationEvent(n);
680 }

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 564 of file Track.cpp.

565 {
566  if ( isNull( node ) )
567  return;
568 
569  Track *t;
570  int i = 0;
571 
572  auto prev = getPrev( node );
573  if ( !isNull( prev ) ) {
574  t = prev.first->get();
575  i = t->GetIndex() + 1;
576  }
577 
578  const auto theEnd = end();
579  for (auto n = Find( node.first->get() ); n != theEnd; ++n) {
580  t = *n;
581  t->SetIndex(i++);
582  }
583 
585 }

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 1044 of file Track.cpp.

1045 {
1046  std::shared_ptr<Track> pTrack;
1047  if (src) {
1048  pTrack = src->Clone(); // not duplicate
1049  // Share the satellites with the original, though they do not point back
1050  // to the pending track
1051  pTrack->mpView = src->mpView;
1052  pTrack->mpControls = src->mpControls;
1053  }
1054 
1055  if (pTrack) {
1056  mUpdaters.push_back( updater );
1057  mPendingUpdates.push_back( pTrack );
1058  auto n = mPendingUpdates.end();
1059  --n;
1060  pTrack->SetOwner(shared_from_this(), {n, &mPendingUpdates});
1061  }
1062 
1063  return pTrack;
1064 }

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 1066 of file Track.cpp.

1067 {
1068  Add<Track>( pTrack );
1069  pTrack->SetId( TrackId{} );
1070 }

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 792 of file Track.cpp.

793 {
794  auto result = getEnd();
795  if (t) {
796  auto node = t->GetNode();
797  t->SetOwner({}, {});
798 
799  if ( !isNull( node ) ) {
800  ListOfTracks::value_type holder = *node.first;
801 
802  result = getNext( node );
803  erase(node.first);
804  if ( !isNull( result ) )
805  RecalcPositions(result);
806 
807  DeletionEvent(result);
808  }
809  }
810  return result;
811 }

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 718 of file Track.cpp.

720 {
721  ListOfTracks::value_type holder;
722  if (t && with) {
723  auto node = t->GetNode();
724  t->SetOwner({}, {});
725 
726  holder = *node.first;
727 
728  Track *pTrack = with.get();
729  *node.first = with;
730  pTrack->SetOwner(shared_from_this(), node);
731  pTrack->SetId( t->GetId() );
732  RecalcPositions(node);
733 
734  DeletionEvent(node);
735  AdditionEvent(node);
736  }
737  return holder;
738 }

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 634 of file Track.cpp.

635 {
636  // wxWidgets will own the event object
637  QueueEvent( safenew TrackListEvent{ EVT_TRACKLIST_RESIZING, *node.first } );
638 }

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 1395 of file Track.h.

1399  {
1400  return Tracks< TrackType >( &Track::IsSelected );
1401  }

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 1422 of file Track.h.

1424  {
1425  return Tracks< TrackType >( &Track::IsSelectedLeader );
1426  }

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 1429 of file Track.h.

1433  {
1434  return Tracks< TrackType >( &Track::IsSelectedLeader );
1435  }

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 587 of file Track.cpp.

588 {
589  // wxWidgets will own the event object
590  QueueEvent(
591  safenew TrackListEvent{ EVT_TRACKLIST_SELECTION_CHANGE, pTrack } );
592 }

References safenew.

◆ SingletonRange()

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

Definition at line 1439 of file Track.h.

1441  {
1442  return pTrack->GetOwner()->template Any<TrackType>()
1443  .StartingWith( pTrack ).EndingAfter( pTrack );
1444  }

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 1000 of file Track.cpp.

1001 {
1002  int cnt = 0;
1003 
1004  if (!empty())
1005  cnt = getPrev( getEnd() ).first->get()->GetIndex() + 1;
1006 
1007  return cnt;
1008 }

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 539 of file Track.cpp.

540 {
541  auto SwapLOTs = [](
542  ListOfTracks &a, const std::weak_ptr< TrackList > &aSelf,
543  ListOfTracks &b, const std::weak_ptr< TrackList > &bSelf )
544  {
545  a.swap(b);
546  for (auto it = a.begin(), last = a.end(); it != last; ++it)
547  (*it)->SetOwner(aSelf, {it, &a});
548  for (auto it = b.begin(), last = b.end(); it != last; ++it)
549  (*it)->SetOwner(bSelf, {it, &b});
550  };
551 
552  const auto self = shared_from_this();
553  const auto otherSelf = that.shared_from_this();
554  SwapLOTs( *this, self, that, otherSelf );
555  SwapLOTs( this->mPendingUpdates, self, that.mPendingUpdates, otherSelf );
556  mUpdaters.swap(that.mUpdaters);
557 }

◆ SwapNodes()

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

Definition at line 905 of file Track.cpp.

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

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 1451 of file Track.h.

1452  {
1453  return SyncLockGroup(const_cast<Track*>(pTrack)).Filter<const Track>();
1454  }

◆ SyncLockGroup() [2/2]

auto TrackList::SyncLockGroup ( Track pTrack)
static

Definition at line 650 of file Track.cpp.

652 {
653  auto pList = pTrack->GetOwner();
654  auto tracks =
655  pList->FindSyncLockGroup( const_cast<Track*>( pTrack ) );
656  return pList->Any().StartingWith(tracks.first).EndingAfter(tracks.second);
657 }

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 1569 of file Track.h.

1569  {} )
1571  {
1572  auto b = getBegin(), e = getEnd();
1573  return { { b, b, e, pred }, { b, e, e, pred } };
1574  }

◆ 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 1582 of file Track.h.

1582  {} ) const
1583  -> typename std::enable_if< std::is_const<TrackType>::value,
1585  >::type
1586  {
1587  auto b = const_cast<TrackList*>(this)->getBegin();
1588  auto e = const_cast<TrackList*>(this)->getEnd();
1589  return { { b, b, e, pred }, { b, e, e, pred } };
1590  }

◆ UnlinkChannels()

void TrackList::UnlinkChannels ( Track track)

Removes linkage if track belongs to a group.

Definition at line 740 of file Track.cpp.

741 {
742  auto list = track.mList.lock();
743  if (list.get() == this)
744  {
745  auto channels = TrackList::Channels(&track);
746  for (auto c : channels)
747  {
748  c->SetLinkType(Track::LinkType::None);
749  c->SetChannel(Track::ChannelType::MonoChannel);
750  }
751  }
752  else
754 }

References Channels(), Track::mList, Track::None, and THROW_INCONSISTENCY_EXCEPTION.

Referenced by WaveTrackMenuTable::SplitStereo().

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

◆ UpdatePendingTracks()

void TrackList::UpdatePendingTracks ( )

Definition at line 1072 of file Track.cpp.

1073 {
1074  auto pUpdater = mUpdaters.begin();
1075  for (const auto &pendingTrack : mPendingUpdates) {
1076  // Copy just a part of the track state, according to the update
1077  // function
1078  const auto &updater = *pUpdater;
1079  auto src = FindById( pendingTrack->GetId() );
1080  if (pendingTrack && src) {
1081  if (updater)
1082  updater( *pendingTrack, *src );
1083  pendingTrack->DoSetLinkType(src->GetLinkType());
1084  }
1085  ++pUpdater;
1086  }
1087 }

References FindById(), mPendingUpdates, mUpdaters, and anonymous_namespace{LogWindow.cpp}::pUpdater.

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 1490 of file Track.h.

Member Data Documentation

◆ mOwner

AudacityProject* TrackList::mOwner
private

Definition at line 1711 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 1715 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 1717 of file Track.h.

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

◆ sCounter

long TrackList::sCounter = -1
staticprivate

Definition at line 1663 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:1616
Track::LinkType::Aligned
@ Aligned
key
static const AudacityProject::AttachedObjects::RegisteredFactory key
Definition: Track.cpp:502
anonymous_namespace{Track.cpp}::IsGoodNextSyncLockTrack
bool IsGoodNextSyncLockTrack(const Track *t, bool inLabelSection)
Definition: Track.cpp:240
Track::SetId
void SetId(TrackId id)
Definition: Track.h:283
make_iterator_range
IteratorRange< Iterator > make_iterator_range(const Iterator &i1, const Iterator &i2)
Definition: MemoryX.h:551
TrackList::FindById
Track * FindById(TrackId id)
Definition: Track.cpp:682
TrackList::PermutationEvent
void PermutationEvent(TrackNodePointer node)
Definition: Track.cpp:611
ClientData::Site::Find
Subclass * Find(const RegisteredFactory &key)
Get a (bare) pointer to an attachment, or null, down-cast it to Subclass *; will not create on demand...
Definition: ClientData.h:333
TrackList::getEnd
TrackNodePointer getEnd() const
Definition: Track.h:1619
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:136
TrackList::GetNext
Track * GetNext(Track *t, bool linked=false) const
Return a track in the list that comes after Track t.
Definition: Track.cpp:836
Track::GetEndTime
virtual double GetEndTime() const =0
TrackList::Channels
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
Definition: Track.h:1484
TrackList
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition: Track.h:1280
anonymous_namespace{Track.cpp}::IsSyncLockableNonLabelTrack
bool IsSyncLockableNonLabelTrack(const Track *pTrack)
Definition: Track.cpp:235
Track::GetOwner
std::shared_ptr< TrackList > GetOwner() const
Definition: Track.h:379
TrackList::Add
TrackKind * Add(const std::shared_ptr< TrackKind > &t)
Definition: Track.h:1503
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:1333
TrackList::RecalcPositions
void RecalcPositions(TrackNodePointer node)
Definition: Track.cpp:564
Track::Any
bool Any() const
Definition: Track.cpp:370
Track::mpControls
std::shared_ptr< CommonTrackCell > mpControls
Definition: Track.h:833
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:1013
TrackList::end
iterator end()
Definition: Track.h:1325
Track::GetStartTime
virtual double GetStartTime() const =0
TrackList::mUpdaters
std::vector< Updater > mUpdaters
This is in correspondence with mPendingUpdates.
Definition: Track.h:1717
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:1715
TrackList::FindLeader
TrackIter< Track > FindLeader(Track *pTrack)
Definition: Track.cpp:659
Track::mList
std::weak_ptr< TrackList > mList
Definition: Track.h:258
Track::GetId
TrackId GetId() const
Definition: Track.h:281
TrackListEvent
Notification of changes in individual tracks of TrackList, or of TrackList's composition.
Definition: Track.h:1222
anonymous_namespace{LogWindow.cpp}::pUpdater
std::optional< LogWindowUpdater > pUpdater
Definition: LogWindow.cpp:53
TrackList::AdditionEvent
void AdditionEvent(TrackNodePointer node)
Definition: Track.cpp:628
TrackList::mOwner
AudacityProject * mOwner
Definition: Track.h:1711
TrackList::begin
iterator begin()
Definition: Track.h:1324
TrackList::ClearPendingTracks
void ClearPendingTracks(ListOfTracks *pAdded=nullptr)
Definition: Track.cpp:1090
ListOfTracks
std::list< std::shared_ptr< Track > > ListOfTracks
Definition: Track.h:53
Track::LinkType::Group
@ Group
Track::GetOffset
virtual double GetOffset() const =0
Track::mpView
std::shared_ptr< CommonTrackCell > mpView
Definition: Track.h:832
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::Clone
virtual Holder Clone() const =0
Track::RightChannel
@ RightChannel
Definition: Track.h:277
TrackList::DoAddToHead
Track * DoAddToHead(const std::shared_ptr< Track > &t)
Definition: Track.cpp:693
Track::IsSelected
bool IsSelected() const
Definition: Track.cpp:373
THROW_INCONSISTENCY_EXCEPTION
#define THROW_INCONSISTENCY_EXCEPTION
Throw InconsistencyException, using C++ preprocessor to identify the source code location.
Definition: InconsistencyException.h:79
Track::HasLinkedTrack
bool HasLinkedTrack() const noexcept
Returns true for leaders of multichannel groups.
Definition: Track.cpp:229
TrackIter::Filter
TrackIter Filter(const Predicate2 &pred2) const
Return an iterator that replaces the predicate.
Definition: Track.h:966
Track::LinkType::None
@ None
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:384
TrackIterRange
Range between two TrackIters, usable in range-for statements, and with Visit member functions.
Definition: Track.h:1101
TrackList::MoveUp
bool MoveUp(Track *t)
Definition: Track.cpp:964
TrackList::DeletionEvent
void DeletionEvent(TrackNodePointer node={})
Definition: Track.cpp:617
TrackList::getBegin
TrackNodePointer getBegin() const
Definition: Track.h:1622
TrackList::UpdatePendingTracks
void UpdatePendingTracks()
Definition: Track.cpp:1072
TrackList::Clear
void Clear(bool sendEvent=true)
Make the list empty.
Definition: Track.cpp:813
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:164
TrackList::Get
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:506
TrackList::GetPrev
Track * GetPrev(Track *t, bool linked=false) const
Definition: Track.cpp:855
TrackList::sCounter
static long sCounter
Definition: Track.h:1663
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:379
TrackList::SwapNodes
void SwapNodes(TrackNodePointer s1, TrackNodePointer s2)
Definition: Track.cpp:905
TrackList::DoAdd
Track * DoAdd(const std::shared_ptr< Track > &t)
Definition: Track.cpp:705
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:92
TrackList::Replace
ListOfTracks::value_type Replace(Track *t, const ListOfTracks::value_type &with)
Definition: Track.cpp:718
TrackList::getNext
TrackNodePointer getNext(TrackNodePointer p) const
Move an iterator to the next node, if any; else stay at end.
Definition: Track.h:1627
TrackList::getPrev
TrackNodePointer getPrev(TrackNodePointer p) const
Move an iterator to the previous node, if any; else wrap to end.
Definition: Track.h:1637
Track::GetLinkedTrack
Track * GetLinkedTrack() const
Definition: Track.cpp:203
TrackList::MoveDown
bool MoveDown(Track *t)
Definition: Track.cpp:977
Track::SetIndex
void SetIndex(int index)
Definition: Track.cpp:169
TrackList::Any
auto Any() -> TrackIterRange< TrackType >
Definition: Track.h:1371
safenew
#define safenew
Definition: MemoryX.h:10
TrackList::SyncLockGroup
static TrackIterRange< Track > SyncLockGroup(Track *pTrack)
Definition: Track.cpp:650
Track::LeftChannel
@ LeftChannel
Definition: Track.h:276
TrackList::empty
bool empty() const
Definition: Track.cpp:995
Track::GetNode
TrackNodePointer GetNode() const
Retrieve mNode with debug checks.
Definition: Track.cpp:129