Audacity 3.2.0
Classes | Namespaces | Macros | Typedefs | Functions | Variables
WaveTrack.h File Reference
#include "Prefs.h"
#include "SampleCount.h"
#include "SampleFormat.h"
#include "SampleTrack.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  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::IntervalData
 
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 >
 
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 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 46 of file WaveTrack.h.

Typedef Documentation

◆ BlockInspector

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

Definition at line 548 of file WaveTrack.h.

◆ BlockVisitor

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

Definition at line 547 of file WaveTrack.h.

◆ SampleBlockFactoryPtr

using SampleBlockFactoryPtr = std::shared_ptr<SampleBlockFactory>

Definition at line 27 of file WaveTrack.h.

◆ SampleBlockID

using SampleBlockID = long long

Definition at line 544 of file WaveTrack.h.

◆ SampleBlockIDSet

using SampleBlockIDSet = std::unordered_set<SampleBlockID>

Definition at line 545 of file WaveTrack.h.

◆ WaveClipConstHolders

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

Definition at line 37 of file WaveTrack.h.

◆ WaveClipConstPointers

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

Definition at line 41 of file WaveTrack.h.

◆ WaveClipHolder

using WaveClipHolder = std::shared_ptr< WaveClip >

Definition at line 35 of file WaveTrack.h.

◆ WaveClipHolders

using WaveClipHolders = std::vector < WaveClipHolder >

Definition at line 36 of file WaveTrack.h.

◆ WaveClipPointers

using WaveClipPointers = std::vector < WaveClip* >

Definition at line 40 of file WaveTrack.h.

◆ WaveTrackIORegistry

Definition at line 614 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 2586 of file WaveTrack.cpp.

2587{
2588 bool mIsSyncLocked = SyncLockTracks.Read();
2589 if( mIsSyncLocked )
2590 return true;
2591 bool editClipsCanMove;
2592 return EditClipsCanMove.Read();
2593}
BoolSetting SyncLockTracks
Definition: SyncLock.cpp:172
BoolSetting EditClipsCanMove
Definition: WaveTrack.cpp:2595
bool Read(T *pVar) const
overload of Read returning a boolean that is true if the value was previously defined *‍/
Definition: Prefs.h:200

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

Referenced by WaveTrack::ExpandCutLine(), WaveTrack::HandleClear(), WaveTrack::PasteWaveTrack(), 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 2517 of file WaveTrack.cpp.

2519{
2521 const_cast<TrackList &>(tracks), std::move( inspector ), pIDs );
2522}
void VisitBlocks(TrackList &tracks, BlockVisitor visitor, SampleBlockIDSet *pIDs)
Definition: WaveTrack.cpp:2496
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition: Track.h:1339

References 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 2496 of file WaveTrack.cpp.

2498{
2499 for (auto wt : tracks.Any< const WaveTrack >()) {
2500 // Scan all clips within current track
2501 for(const auto &clip : wt->GetAllClips()) {
2502 // Scan all sample blocks within current clip
2503 auto blocks = clip->GetSequenceBlockArray();
2504 for (const auto &block : *blocks) {
2505 auto &pBlock = block.sb;
2506 if ( pBlock ) {
2507 if ( pIDs && !pIDs->insert(pBlock->GetBlockID()).second )
2508 continue;
2509 if ( visitor )
2510 visitor( *pBlock );
2511 }
2512 }
2513 }
2514 }
2515}
auto Any() -> TrackIterRange< TrackType >
Definition: Track.h:1440
A Track that contains audio waveform data.
Definition: WaveTrack.h:51

References TrackList::Any().

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