Audacity  3.0.3
Classes | Macros | Typedefs | Functions
WaveTrack.h File Reference
#include "Track.h"
#include "SampleCount.h"
#include <vector>
#include <functional>
#include <wx/longlong.h>
#include "WaveTrackLocation.h"
#include <unordered_set>
Include dependency graph for WaveTrack.h:

Go to the source code of this file.

Classes

struct  Region
 Structure to hold region of a wavetrack and a comparison function for sortability. More...
 
class  WaveTrack
 A Track that contains audio waveform data. More...
 
class  WaveTrack::AllClipsIterator
 
class  WaveTrack::AllClipsConstIterator
 
class  WaveTrack::IntervalData
 
class  WaveTrackCache
 A short-lived object, during whose lifetime, the contents of the WaveTrack are assumed not to change. More...
 
struct  WaveTrackCache::Buffer
 
class  WaveTrackFactory
 Used to create or clone a WaveTrack, with appropriate context from the project that will own the track. More...
 

Macros

#define WAVETRACK_MERGE_POINT_TOLERANCE   0.01
 

Typedefs

using SampleBlockFactoryPtr = std::shared_ptr< SampleBlockFactory >
 
using WaveClipHolder = std::shared_ptr< WaveClip >
 
using WaveClipHolders = std::vector< WaveClipHolder >
 
using WaveClipConstHolders = std::vector< std::shared_ptr< const WaveClip > >
 
using WaveClipPointers = std::vector< WaveClip * >
 
using WaveClipConstPointers = std::vector< const WaveClip * >
 
using Regions = std::vector< Region >
 
using SampleBlockID = long long
 
using SampleBlockIDSet = std::unordered_set< SampleBlockID >
 
using BlockVisitor = std::function< void(SampleBlock &) >
 
using BlockInspector = std::function< void(const SampleBlock &) >
 

Functions

void VisitBlocks (TrackList &tracks, BlockVisitor visitor, SampleBlockIDSet *pIDs=nullptr)
 
void InspectBlocks (const TrackList &tracks, BlockInspector inspector, SampleBlockIDSet *pIDs=nullptr)
 

Macro Definition Documentation

◆ WAVETRACK_MERGE_POINT_TOLERANCE

#define WAVETRACK_MERGE_POINT_TOLERANCE   0.01

Definition at line 47 of file WaveTrack.h.

Typedef Documentation

◆ BlockInspector

using BlockInspector = std::function< void(const SampleBlock&) >

Definition at line 693 of file WaveTrack.h.

◆ BlockVisitor

using BlockVisitor = std::function< void(SampleBlock&) >

Definition at line 692 of file WaveTrack.h.

◆ Regions

using Regions = std::vector < Region >

Definition at line 65 of file WaveTrack.h.

◆ SampleBlockFactoryPtr

using SampleBlockFactoryPtr = std::shared_ptr<SampleBlockFactory>

Definition at line 26 of file WaveTrack.h.

◆ SampleBlockID

using SampleBlockID = long long

Definition at line 689 of file WaveTrack.h.

◆ SampleBlockIDSet

using SampleBlockIDSet = std::unordered_set<SampleBlockID>

Definition at line 690 of file WaveTrack.h.

◆ WaveClipConstHolders

using WaveClipConstHolders = std::vector < std::shared_ptr< const WaveClip > >

Definition at line 38 of file WaveTrack.h.

◆ WaveClipConstPointers

using WaveClipConstPointers = std::vector < const WaveClip* >

Definition at line 42 of file WaveTrack.h.

◆ WaveClipHolder

using WaveClipHolder = std::shared_ptr< WaveClip >

Definition at line 36 of file WaveTrack.h.

◆ WaveClipHolders

using WaveClipHolders = std::vector < WaveClipHolder >

Definition at line 37 of file WaveTrack.h.

◆ WaveClipPointers

using WaveClipPointers = std::vector < WaveClip* >

Definition at line 41 of file WaveTrack.h.

Function Documentation

◆ InspectBlocks()

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

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:

◆ VisitBlocks()

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

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 = block.sb;
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:
WaveTrack
A Track that contains audio waveform data.
Definition: WaveTrack.h:69
VisitBlocks
void VisitBlocks(TrackList &tracks, BlockVisitor visitor, SampleBlockIDSet *pIDs)
Definition: WaveTrack.cpp:2861
TrackList
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition: Track.h:1280
TrackList::Any
auto Any() -> TrackIterRange< TrackType >
Definition: Track.h:1371