Audacity 3.2.0
Classes | Namespaces | Macros | Typedefs | Functions | Variables
WaveTrack.h File Reference
#include "ClipInterface.h"
#include "PlaybackDirection.h"
#include "Prefs.h"
#include "SampleCount.h"
#include "SampleFormat.h"
#include "SampleTrack.h"
#include "WideSampleSequence.h"
#include <vector>
#include <functional>
#include <wx/thread.h>
#include <wx/longlong.h>
#include <unordered_set>
#include "XMLMethodRegistry.h"
Include dependency graph for WaveTrack.h:

Go to the source code of this file.

Classes

class  WaveChannelInterval
 
class  WaveChannel
 
class  WaveTrack
 A Track that contains audio waveform data. More...
 
struct  WaveTrack::Region
 Structure to hold region of a wavetrack and a comparison function for sortability. More...
 
class  WaveTrack::AllClipsIterator
 
class  WaveTrack::AllClipsConstIterator
 
class  WaveTrack::Interval
 
class  WaveTrackFactory
 Used to create or clone a WaveTrack, with appropriate context from the project that will own the track. More...
 

Namespaces

namespace  BasicUI
 

Macros

#define WAVETRACK_MERGE_POINT_TOLERANCE   0.01
 

Typedefs

using SampleBlockFactoryPtr = std::shared_ptr< SampleBlockFactory >
 
using WaveClipHolder = std::shared_ptr< WaveClip >
 Clips are held by shared_ptr, not for sharing, but to allow weak_ptr. More...
 
using WaveClipHolders = std::vector< WaveClipHolder >
 
using WaveClipConstHolders = std::vector< std::shared_ptr< const WaveClip > >
 
using ClipConstHolders = std::vector< std::shared_ptr< const ClipInterface > >
 
using WaveClipPointers = std::vector< WaveClip * >
 
using WaveClipConstPointers = std::vector< const WaveClip * >
 
using ChannelSampleView = std::vector< AudioSegmentSampleView >
 
using ChannelGroupSampleView = std::vector< ChannelSampleView >
 
using TimeInterval = std::pair< double, double >
 
using ProgressReporter = std::function< void(double)>
 
using SampleBlockID = long long
 
using SampleBlockIDSet = std::unordered_set< SampleBlockID >
 
using BlockVisitor = std::function< void(SampleBlock &) >
 
using BlockInspector = std::function< void(const SampleBlock &) >
 
using WaveTrackIORegistry = XMLMethodRegistry< WaveTrack >
 

Functions

 ENUMERATE_TRACK_TYPE (WaveTrack)
 
void VisitBlocks (TrackList &tracks, BlockVisitor visitor, SampleBlockIDSet *pIDs=nullptr)
 
WAVE_TRACK_API void InspectBlocks (const TrackList &tracks, BlockInspector inspector, SampleBlockIDSet *pIDs=nullptr)
 
WAVE_TRACK_API bool GetEditClipsCanMove ()
 
 DECLARE_XML_METHOD_REGISTRY (WAVE_TRACK_API, WaveTrackIORegistry)
 

Variables

WAVE_TRACK_API BoolSetting EditClipsCanMove
 
WAVE_TRACK_API StringSetting AudioTrackNameSetting
 

Macro Definition Documentation

◆ WAVETRACK_MERGE_POINT_TOLERANCE

#define WAVETRACK_MERGE_POINT_TOLERANCE   0.01

Definition at line 59 of file WaveTrack.h.

Typedef Documentation

◆ BlockInspector

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

Definition at line 1149 of file WaveTrack.h.

◆ BlockVisitor

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

Definition at line 1148 of file WaveTrack.h.

◆ ChannelGroupSampleView

Definition at line 51 of file WaveTrack.h.

◆ ChannelSampleView

Definition at line 50 of file WaveTrack.h.

◆ ClipConstHolders

using ClipConstHolders = std::vector<std::shared_ptr<const ClipInterface> >

Definition at line 44 of file WaveTrack.h.

◆ ProgressReporter

using ProgressReporter = std::function<void(double)>

Definition at line 54 of file WaveTrack.h.

◆ SampleBlockFactoryPtr

using SampleBlockFactoryPtr = std::shared_ptr<SampleBlockFactory>

Definition at line 30 of file WaveTrack.h.

◆ SampleBlockID

using SampleBlockID = long long

Definition at line 1145 of file WaveTrack.h.

◆ SampleBlockIDSet

using SampleBlockIDSet = std::unordered_set<SampleBlockID>

Definition at line 1146 of file WaveTrack.h.

◆ TimeInterval

using TimeInterval = std::pair<double, double>

Definition at line 53 of file WaveTrack.h.

◆ WaveClipConstHolders

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

Definition at line 42 of file WaveTrack.h.

◆ WaveClipConstPointers

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

Definition at line 48 of file WaveTrack.h.

◆ WaveClipHolder

using WaveClipHolder = std::shared_ptr<WaveClip>

Clips are held by shared_ptr, not for sharing, but to allow weak_ptr.

Definition at line 40 of file WaveTrack.h.

◆ WaveClipHolders

using WaveClipHolders = std::vector<WaveClipHolder>

Definition at line 41 of file WaveTrack.h.

◆ WaveClipPointers

using WaveClipPointers = std::vector < WaveClip* >

Definition at line 47 of file WaveTrack.h.

◆ WaveTrackIORegistry

Definition at line 1237 of file WaveTrack.h.

Function Documentation

◆ DECLARE_XML_METHOD_REGISTRY()

DECLARE_XML_METHOD_REGISTRY ( WAVE_TRACK_API  ,
WaveTrackIORegistry   
)

◆ ENUMERATE_TRACK_TYPE()

ENUMERATE_TRACK_TYPE ( WaveTrack  )

◆ GetEditClipsCanMove()

WAVE_TRACK_API bool GetEditClipsCanMove ( )

Definition at line 4141 of file WaveTrack.cpp.

4142{
4143 bool mIsSyncLocked = SyncLockTracks.Read();
4144 if( mIsSyncLocked )
4145 return true;
4146 bool editClipsCanMove;
4147 return EditClipsCanMove.Read();
4148}
BoolSetting SyncLockTracks
Definition: SyncLock.cpp:173
BoolSetting EditClipsCanMove
Definition: WaveTrack.cpp:4150
bool Read(T *pVar) const
overload of Read returning a boolean that is true if the value was previously defined *‍/
Definition: Prefs.h:205

References EditClipsCanMove, Setting< T >::Read(), and SyncLockTracks.

Referenced by WaveTrack::ExpandOneCutLine(), WaveTrack::HandleClear(), WaveTrack::PasteOne(), and Generator::Process().

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

◆ InspectBlocks()

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

Definition at line 4062 of file WaveTrack.cpp.

4064{
4066 const_cast<TrackList &>(tracks), std::move( inspector ), pIDs );
4067}
const auto tracks
void VisitBlocks(TrackList &tracks, BlockVisitor visitor, SampleBlockIDSet *pIDs)
Definition: WaveTrack.cpp:4040
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition: Track.h:987

References tracks, and VisitBlocks().

Referenced by anonymous_namespace{HistoryWindow.cpp}::SpaceUsageCalculator::CalculateUsage(), ProjectFileIO::CopyTo(), 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 4040 of file WaveTrack.cpp.

4042{
4043 for (auto wt : tracks.Any<const WaveTrack>())
4044 for (const auto pChannel : TrackList::Channels(wt))
4045 // Scan all clips within current track
4046 for (const auto &clip : pChannel->GetAllClips())
4047 // Scan all sample blocks within current clip
4048 for (size_t ii = 0, width = clip->GetWidth(); ii < width; ++ii) {
4049 auto blocks = clip->GetSequenceBlockArray(ii);
4050 for (const auto &block : *blocks) {
4051 auto &pBlock = block.sb;
4052 if (pBlock) {
4053 if (pIDs && !pIDs->insert(pBlock->GetBlockID()).second)
4054 continue;
4055 if (visitor)
4056 visitor(*pBlock);
4057 }
4058 }
4059 }
4060}
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
Definition: Track.h:1158
A Track that contains audio waveform data.
Definition: WaveTrack.h:220

References TrackList::Channels(), and tracks.

Referenced by InspectBlocks().

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

Variable Documentation

◆ AudioTrackNameSetting

WAVE_TRACK_API StringSetting AudioTrackNameSetting
extern

◆ EditClipsCanMove

WAVE_TRACK_API BoolSetting EditClipsCanMove
extern