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 <float.h>
#include <math.h>
#include <algorithm>
#include "float_cast.h"
#include "Envelope.h"
#include "Sequence.h"
#include "ProjectFileIORegistry.h"
#include "ProjectSettings.h"
#include "Prefs.h"
#include "effects/TimeWarper.h"
#include "prefs/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 "Project.h"
Include dependency graph for WaveTrack.cpp:

Go to the source code of this file.

Namespaces

 anonymous_namespace{WaveTrack.cpp}
 

Functions

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)
 
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)
 

Variables

static ProjectFileIORegistry::Entry registerFactory
 
static auto TrackFactoryFactory
 
static const AudacityProject::AttachedObjects::RegisteredFactory key2
 

Function Documentation

◆ InspectBlocks()

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

Definition at line 2784 of file WaveTrack.cpp.

2786 {
2787  VisitBlocks(
2788  const_cast<TrackList &>(tracks), std::move( inspector ), pIDs );
2789 }

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)
static

Definition at line 326 of file WaveTrack.cpp.

327 {
328  Container result;
329  for (const auto &clip: clips) {
330  result.emplace_back( clip->GetStartTime(), clip->GetEndTime(),
331  std::make_unique<WaveTrack::IntervalData>( clip ) );
332  }
333  return result;
334 }

◆ VisitBlocks()

void VisitBlocks ( TrackList tracks,
BlockVisitor  visitor,
SampleBlockIDSet pIDs 
)

Definition at line 2763 of file WaveTrack.cpp.

2765 {
2766  for (auto wt : tracks.Any< const WaveTrack >()) {
2767  // Scan all clips within current track
2768  for(const auto &clip : wt->GetAllClips()) {
2769  // Scan all sample blocks within current clip
2770  auto blocks = clip->GetSequenceBlockArray();
2771  for (const auto &block : *blocks) {
2772  auto &pBlock = block.sb;
2773  if ( pBlock ) {
2774  if ( pIDs && !pIDs->insert(pBlock->GetBlockID()).second )
2775  continue;
2776  if ( visitor )
2777  visitor( *pBlock );
2778  }
2779  }
2780  }
2781  }
2782 }

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

◆ registerFactory

ProjectFileIORegistry::Entry registerFactory
static
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 67 of file WaveTrack.cpp.

◆ TrackFactoryFactory

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

Definition at line 2793 of file WaveTrack.cpp.

Referenced by WaveTrackFactory::Reset().

WaveTrackFactory::Get
static WaveTrackFactory & Get(AudacityProject &project)
Definition: WaveTrack.cpp:2803
WaveTrack
A Track that contains audio waveform data.
Definition: WaveTrack.h:68
VisitBlocks
void VisitBlocks(TrackList &tracks, BlockVisitor visitor, SampleBlockIDSet *pIDs)
Definition: WaveTrack.cpp:2763
TrackView::Get
static TrackView & Get(Track &)
Definition: TrackView.cpp:63
TrackControls::Get
static TrackControls & Get(Track &track)
Definition: TrackControls.cpp:25
TrackList
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition: Track.h:1263
ProjectSettings::Get
static ProjectSettings & Get(AudacityProject &project)
Definition: ProjectSettings.cpp:40
SampleBlockFactory::New
static SampleBlockFactoryPtr New(AudacityProject &project)
Definition: SampleBlock.cpp:31
TrackList::Get
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:495
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:112
TrackFactoryFactory
static auto TrackFactoryFactory
Definition: WaveTrack.cpp:2793
TrackList::Any
auto Any() -> TrackIterRange< TrackType >
Definition: Track.h:1354