Audacity  3.0.3
Namespaces | Functions | Variables
WaveTrack.cpp File Reference
#include "WaveTrack.h"
#include "WaveClip.h"
#include <wx/defs.h>
#include <wx/intl.h>
#include <wx/debug.h>
#include <wx/log.h>
#include <float.h>
#include <math.h>
#include <algorithm>
#include "float_cast.h"
#include "Envelope.h"
#include "Sequence.h"
#include "Project.h"
#include "ProjectRate.h"
#include "Prefs.h"
#include "effects/TimeWarper.h"
#include "QualitySettings.h"
#include "prefs/SpectrogramSettings.h"
#include "prefs/TracksPrefs.h"
#include "prefs/TracksBehaviorsPrefs.h"
#include "prefs/WaveformSettings.h"
#include "InconsistencyException.h"
#include "tracks/ui/TrackView.h"
#include "tracks/ui/TrackControls.h"
#include "SampleBlock.h"
Include dependency graph for WaveTrack.cpp:

Go to the source code of this file.




bool anonymous_namespace{WaveTrack.cpp}::AreAligned (const WaveClipPointers &a, const WaveClipPointers &b)
Track::LinkType anonymous_namespace{WaveTrack.cpp}::ToLinkType (int value)
template<typename Container >
static Container MakeIntervals (const std::vector< WaveClipHolder > &clips)
WaveClipHolders::const_iterator anonymous_namespace{WaveTrack.cpp}::FindClip (const WaveClipHolders &list, const WaveClip *clip, int *distance=nullptr)
WaveClipHolders::iterator anonymous_namespace{WaveTrack.cpp}::FindClip (WaveClipHolders &list, const WaveClip *clip, int *distance=nullptr)
bool anonymous_namespace{WaveTrack.cpp}::IsValidChannel (const int nValue)
template<typename Cont1 , typename Cont2 >
Cont1 anonymous_namespace{WaveTrack.cpp}::FillSortedClipArray (const Cont2 &mClips)
void VisitBlocks (TrackList &tracks, BlockVisitor visitor, SampleBlockIDSet *pIDs)
void InspectBlocks (const TrackList &tracks, BlockInspector inspector, SampleBlockIDSet *pIDs)


static ProjectFileIORegistry::ObjectReaderEntry readerEntry
static auto TrackFactoryFactory
static const AudacityProject::AttachedObjects::RegisteredFactory key2

Function Documentation

◆ InspectBlocks()

void InspectBlocks ( const TrackList tracks,
BlockInspector  inspector,
SampleBlockIDSet pIDs 

Definition at line 2882 of file WaveTrack.cpp.

2884 {
2885  VisitBlocks(
2886  const_cast<TrackList &>(tracks), std::move( inspector ), pIDs );
2887 }

References VisitBlocks().

Referenced by anonymous_namespace{UndoManager.cpp}::CalculateUsage(), ProjectFileIO::CopyTo(), UndoManager::EstimateRemovedBlocks(), ProjectFileIO::GetCurrentUsage(), ProjectFileIO::SaveProject(), and ProjectFileIO::ShouldCompact().

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

◆ MakeIntervals()

template<typename Container >
static Container MakeIntervals ( const std::vector< WaveClipHolder > &  clips)

Definition at line 384 of file WaveTrack.cpp.

385 {
386  Container result;
387  for (const auto &clip: clips) {
388  result.emplace_back( clip->GetStartTime(), clip->GetEndTime(),
389  std::make_unique<WaveTrack::IntervalData>( clip ) );
390  }
391  return result;
392 }

◆ VisitBlocks()

void VisitBlocks ( TrackList tracks,
BlockVisitor  visitor,
SampleBlockIDSet pIDs 

Definition at line 2861 of file WaveTrack.cpp.

2863 {
2864  for (auto wt : tracks.Any< const WaveTrack >()) {
2865  // Scan all clips within current track
2866  for(const auto &clip : wt->GetAllClips()) {
2867  // Scan all sample blocks within current clip
2868  auto blocks = clip->GetSequenceBlockArray();
2869  for (const auto &block : *blocks) {
2870  auto &pBlock =;
2871  if ( pBlock ) {
2872  if ( pIDs && !pIDs->insert(pBlock->GetBlockID()).second )
2873  continue;
2874  if ( visitor )
2875  visitor( *pBlock );
2876  }
2877  }
2878  }
2879  }
2880 }

References TrackList::Any().

Referenced by InspectBlocks().

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

Variable Documentation

◆ key2

◆ readerEntry

Initial value:
wxT( "wavetrack" ),
[]( AudacityProject &project ){
auto &trackFactory = WaveTrackFactory::Get( project );
auto &tracks = TrackList::Get( project );
auto result = tracks.Add(trackFactory.NewWaveTrack());
TrackView::Get( *result );
TrackControls::Get( *result );
return result;

Definition at line 95 of file WaveTrack.cpp.

◆ TrackFactoryFactory

auto TrackFactoryFactory
Initial value:
= []( AudacityProject &project ) {
return std::make_shared< WaveTrackFactory >(
ProjectRate::Get( project ),

Definition at line 2891 of file WaveTrack.cpp.

Referenced by WaveTrackFactory::Reset().

static WaveTrackFactory & Get(AudacityProject &project)
Definition: WaveTrack.cpp:2901
A Track that contains audio waveform data.
Definition: WaveTrack.h:69
void VisitBlocks(TrackList &tracks, BlockVisitor visitor, SampleBlockIDSet *pIDs)
Definition: WaveTrack.cpp:2861
static TrackView & Get(Track &)
Definition: TrackView.cpp:63
static ProjectRate & Get(AudacityProject &project)
Definition: ProjectRate.cpp:42
static TrackControls & Get(Track &track)
Definition: TrackControls.cpp:25
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition: Track.h:1280
static SampleBlockFactoryPtr New(AudacityProject &project)
Definition: SampleBlock.cpp:31
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:506
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:92
static auto TrackFactoryFactory
Definition: WaveTrack.cpp:2891
auto Any() -> TrackIterRange< TrackType >
Definition: Track.h:1371