Audacity 3.2.0
Classes | 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 <optional>
#include "float_cast.h"
#include "Envelope.h"
#include "Sequence.h"
#include "Project.h"
#include "ProjectRate.h"
#include "Prefs.h"
#include "TimeWarper.h"
#include "QualitySettings.h"
#include "prefs/SpectrogramSettings.h"
#include "prefs/WaveformSettings.h"
#include "InconsistencyException.h"
#include "ProjectFormatExtensionsRegistry.h"
#include "SampleBlock.h"
Include dependency graph for WaveTrack.cpp:

Go to the source code of this file.

Classes

struct  anonymous_namespace{WaveTrack.cpp}::SplitInfo
 

Namespaces

namespace  anonymous_namespace{WaveTrack.cpp}
 

Functions

bool anonymous_namespace{WaveTrack.cpp}::AreAligned (const WaveClipPointers &a, const WaveClipPointers &b)
 
Track::LinkType anonymous_namespace{WaveTrack.cpp}::ToLinkType (int value)
 
static const Track::TypeInfotypeInfo ()
 
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)
 
bool GetEditClipsCanMove ()
 
 DEFINE_XML_METHOD_REGISTRY (WaveTrackIORegistry)
 

Variables

static auto DefaultName = XO("Audio")
 
static ProjectFileIORegistry::ObjectReaderEntry readerEntry
 
static auto TrackFactoryFactory
 
static const AudacityProject::AttachedObjects::RegisteredFactory key2
 
ProjectFormatExtensionsRegistry::Extension smartClipsExtension ([](const AudacityProject &project) -> ProjectFormatVersion { const TrackList &trackList=TrackList::Get(project);for(auto wt :trackList.Any< const WaveTrack >()) { for(const auto &clip :wt->GetAllClips()) { if(clip->GetTrimLeft() > 0.0||clip->GetTrimRight() > 0.0) return { 3, 1, 0, 0 };} } return BaseProjectFormatVersion;})
 
StringSetting AudioTrackNameSetting
 
BoolSetting EditClipsCanMove
 

Function Documentation

◆ DEFINE_XML_METHOD_REGISTRY()

DEFINE_XML_METHOD_REGISTRY ( WaveTrackIORegistry  )

◆ GetEditClipsCanMove()

bool GetEditClipsCanMove ( )

Definition at line 2850 of file WaveTrack.cpp.

2851{
2852 bool mIsSyncLocked;
2853 gPrefs->Read(wxT("/GUI/SyncLockTracks"), &mIsSyncLocked, false);
2854 if( mIsSyncLocked )
2855 return true;
2856 bool editClipsCanMove;
2857 return EditClipsCanMove.Read();
2858}
FileConfig * gPrefs
Definition: Prefs.cpp:71
BoolSetting EditClipsCanMove
Definition: WaveTrack.cpp:2860
bool Read(T *pVar) const
overload of Read returning a boolean that is true if the value was previously defined *‍/
Definition: Prefs.h:185

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

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

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

Definition at line 2781 of file WaveTrack.cpp.

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

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:

◆ MakeIntervals()

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

Definition at line 413 of file WaveTrack.cpp.

414{
415 Container result;
416 for (const auto &clip: clips) {
417 result.emplace_back( clip->GetPlayStartTime(), clip->GetPlayEndTime(),
418 std::make_unique<WaveTrack::IntervalData>( clip ) );
419 }
420 return result;
421}

◆ typeInfo()

static const Track::TypeInfo & typeInfo ( )
static

Definition at line 316 of file WaveTrack.cpp.

317{
318 static const Track::TypeInfo info{
319 { "wave", "wave", XO("Wave Track") },
321 return info;
322}
#define XO(s)
Definition: Internat.h:31
static const TypeInfo & ClassTypeInfo()
Definition: SampleTrack.cpp:55

References WritableSampleTrack::ClassTypeInfo(), and XO.

Referenced by WaveTrack::ClassTypeInfo(), and WaveTrack::GetTypeInfo().

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 
)

Definition at line 2760 of file WaveTrack.cpp.

2762{
2763 for (auto wt : tracks.Any< const WaveTrack >()) {
2764 // Scan all clips within current track
2765 for(const auto &clip : wt->GetAllClips()) {
2766 // Scan all sample blocks within current clip
2767 auto blocks = clip->GetSequenceBlockArray();
2768 for (const auto &block : *blocks) {
2769 auto &pBlock = block.sb;
2770 if ( pBlock ) {
2771 if ( pIDs && !pIDs->insert(pBlock->GetBlockID()).second )
2772 continue;
2773 if ( visitor )
2774 visitor( *pBlock );
2775 }
2776 }
2777 }
2778 }
2779}
auto Any() -> TrackIterRange< TrackType >
Definition: Track.h:1429
A Track that contains audio waveform data.
Definition: WaveTrack.h:57

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

StringSetting AudioTrackNameSetting
Initial value:
{
L"/GUI/TrackNames/DefaultTrackName",
[]{ return DefaultName.Translation(); }
}
static auto DefaultName
Definition: WaveTrack.cpp:98

Definition at line 2840 of file WaveTrack.cpp.

Referenced by TracksPrefs::Commit(), WaveTrack::GetDefaultAudioTrackNamePreference(), and TracksPrefs::PopulateOrExchange().

◆ DefaultName

auto DefaultName = XO("Audio")
static

Definition at line 98 of file WaveTrack.cpp.

Referenced by WaveTrack::GetDefaultAudioTrackNamePreference().

◆ EditClipsCanMove

BoolSetting EditClipsCanMove
Initial value:
{
L"/GUI/EditClipCanMove", false }

Definition at line 2860 of file WaveTrack.cpp.

Referenced by GetEditClipsCanMove(), BenchmarkDialog::OnRun(), TracksBehaviorsPrefs::PopulateOrExchange(), and WaveTrack::SyncLockAdjust().

◆ key2

◆ readerEntry

Initial value:
{
"wavetrack",
}
static WaveTrack * New(AudacityProject &project)
Definition: WaveTrack.cpp:128

Definition at line 113 of file WaveTrack.cpp.

◆ smartClipsExtension

ProjectFormatExtensionsRegistry::Extension smartClipsExtension([](const AudacityProject &project) -> ProjectFormatVersion { const TrackList &trackList=TrackList::Get(project);for(auto wt :trackList.Any< const WaveTrack >()) { for(const auto &clip :wt->GetAllClips()) { if(clip->GetTrimLeft() > 0.0||clip->GetTrimRight() > 0.0) return { 3, 1, 0, 0 };} } return BaseProjectFormatVersion;}) ( [] (const AudacityProject &project) -> ProjectFormatVersion { const TrackList &trackList=TrackList::Get(project);for(auto wt :trackList.Any< const WaveTrack >()) { for(const auto &clip :wt->GetAllClips()) { if(clip->GetTrimLeft() > 0.0||clip->GetTrimRight() > 0.0) return { 3, 1, 0, 0 };} } return BaseProjectFormatVersion;}  )

◆ TrackFactoryFactory

auto TrackFactoryFactory
static
Initial value:
= []( AudacityProject &project ) {
return std::make_shared< WaveTrackFactory >(
ProjectRate::Get( project ),
}
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:89
static ProjectRate & Get(AudacityProject &project)
Definition: ProjectRate.cpp:28
static SampleBlockFactoryPtr New(AudacityProject &project)
Definition: SampleBlock.cpp:16

Definition at line 2790 of file WaveTrack.cpp.

Referenced by WaveTrackFactory::Reset().