Audacity 3.2.0
Classes | Namespaces | Typedefs | Functions | Variables
WaveTrack.cpp File Reference
#include "WaveTrack.h"
#include "WideClip.h"
#include "WaveClip.h"
#include <wx/defs.h>
#include <wx/debug.h>
#include <wx/log.h>
#include <algorithm>
#include <float.h>
#include <math.h>
#include <numeric>
#include <optional>
#include <type_traits>
#include "float_cast.h"
#include "AudioSegmentSampleView.h"
#include "ClipTimeAndPitchSource.h"
#include "Envelope.h"
#include "Sequence.h"
#include "StaffPadTimeAndPitch.h"
#include "Project.h"
#include "ProjectRate.h"
#include "SampleBlock.h"
#include "BasicUI.h"
#include "Prefs.h"
#include "QualitySettings.h"
#include "SyncLock.h"
#include "TimeWarper.h"
#include "InconsistencyException.h"
#include "ProjectFormatExtensionsRegistry.h"
Include dependency graph for WaveTrack.cpp:

Go to the source code of this file.


struct  anonymous_namespace{WaveTrack.cpp}::WaveTrackData
struct  anonymous_namespace{WaveTrack.cpp}::SplitInfo
struct  anonymous_namespace{WaveTrack.cpp}::SampleAccessArgs< BufferType >


namespace  anonymous_namespace{WaveTrack.cpp}


template<typename FloatType >
using anonymous_namespace{WaveTrack.cpp}::BufferCharType = std::conditional_t< std::is_const_v< std::remove_pointer_t< FloatType > >, constSamplePtr, samplePtr >


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 ()
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)
void anonymous_namespace{WaveTrack.cpp}::RoundToNearestClipSample (const WaveTrack &track, double &t)
template<typename BufferType >
SampleAccessArgs< BufferType > anonymous_namespace{WaveTrack.cpp}::GetSampleAccessArgs (const WaveClip &clip, double startOrEndTime, BufferType buffer, size_t totalToRead, size_t alreadyRead, bool forward)
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 ()


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

Function Documentation



◆ GetEditClipsCanMove()

bool GetEditClipsCanMove ( )

Definition at line 4555 of file WaveTrack.cpp.

4557 bool mIsSyncLocked = SyncLockTracks.Read();
4558 if( mIsSyncLocked )
4559 return true;
4560 bool editClipsCanMove;
4561 return EditClipsCanMove.Read();
BoolSetting SyncLockTracks
Definition: SyncLock.cpp:173
BoolSetting EditClipsCanMove
Definition: WaveTrack.cpp:4564
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()

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

Definition at line 4476 of file WaveTrack.cpp.

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

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:

◆ typeInfo()

static const Track::TypeInfo & typeInfo ( )

Definition at line 960 of file WaveTrack.cpp.

962 static const Track::TypeInfo info{
963 { "wave", "wave", XO("Wave Track") },
965 return info;
static const TypeInfo & ClassTypeInfo()
Definition: SampleTrack.cpp:60

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

4457 for (auto wt : tracks.Any<const WaveTrack>())
4458 for (const auto pChannel : TrackList::Channels(wt))
4459 // Scan all clips within current track
4460 for (const auto &clip : pChannel->GetAllClips())
4461 // Scan all sample blocks within current clip
4462 for (size_t ii = 0, width = clip->GetWidth(); ii < width; ++ii) {
4463 auto blocks = clip->GetSequenceBlockArray(ii);
4464 for (const auto &block : *blocks) {
4465 auto &pBlock =;
4466 if (pBlock) {
4467 if (pIDs && !pIDs->insert(pBlock->GetBlockID()).second)
4468 continue;
4469 if (visitor)
4470 visitor(*pBlock);
4471 }
4472 }
4473 }
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
Definition: Track.h:1146
A Track that contains audio waveform data.
Definition: WaveTrack.h:222

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

StringSetting AudioTrackNameSetting
Initial value:
[]{ return DefaultName.Translation(); }
static auto DefaultName
Definition: WaveTrack.cpp:721

Definition at line 4545 of file WaveTrack.cpp.

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

◆ DefaultName

auto DefaultName = XO("Audio")

Definition at line 721 of file WaveTrack.cpp.

Referenced by WaveTrack::GetDefaultAudioTrackNamePreference().

◆ EditClipsCanMove

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

Definition at line 4564 of file WaveTrack.cpp.

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

◆ key2

Initial value:
static auto TrackFactoryFactory
Definition: WaveTrack.cpp:4483

Definition at line 4489 of file WaveTrack.cpp.

Referenced by WaveTrackFactory::Destroy(), WaveTrackFactory::Get(), and WaveTrackFactory::Reset().

◆ readerEntry

Initial value:
static WaveTrack * New(AudacityProject &project)
Definition: WaveTrack.cpp:784

Definition at line 738 of file WaveTrack.cpp.

◆ TrackFactoryFactory

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

Definition at line 4483 of file WaveTrack.cpp.

Referenced by WaveTrackFactory::Reset().