Audacity 3.2.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PlayableTrack Class Reference

AudioTrack subclass that can also be audibly replayed by the program. More...

#include <Track.h>

Inheritance diagram for PlayableTrack:
[legend]
Collaboration diagram for PlayableTrack:
[legend]

Public Member Functions

 PlayableTrack ()
 
 PlayableTrack (const PlayableTrack &orig)
 
bool GetMute () const
 
bool GetSolo () const
 
bool GetNotMute () const
 
bool GetNotSolo () const
 
void SetMute (bool m)
 
void SetSolo (bool s)
 
void Init (const PlayableTrack &init)
 
void Merge (const Track &init) override
 
void WriteXMLAttributes (XMLWriter &xmlFile) const
 
bool HandleXMLAttribute (const std::string_view &attr, const XMLAttributeValueView &value)
 
- Public Member Functions inherited from AudioTrack
 AudioTrack ()
 
 AudioTrack (const Track &orig)
 
void WriteXMLAttributes (XMLWriter &WXUNUSED(xmlFile)) const
 
bool HandleXMLAttribute (const std::string_view &, const XMLAttributeValueView &)
 
- Public Member Functions inherited from Track
TrackId GetId () const
 
template<typename Subclass = Track>
std::shared_ptr< Subclass > SharedPointer ()
 
template<typename Subclass = const Track>
auto SharedPointer () const -> std::enable_if_t< std::is_const_v< Subclass >, std::shared_ptr< Subclass > >
 
std::shared_ptr< TrackSubstitutePendingChangedTrack ()
 
std::shared_ptr< const TrackSubstitutePendingChangedTrack () const
 
std::shared_ptr< const TrackSubstituteOriginalTrack () const
 
virtual const TypeInfoGetTypeInfo () const =0
 
virtual const TypeNamesGetTypeNames () const
 
virtual bool SupportsBasicEditing () const
 Whether this track type implements cut-copy-paste; by default, true. More...
 
virtual Holder PasteInto (AudacityProject &) const =0
 Find or create the destination track for a paste, maybe in a different project. More...
 
virtual ConstIntervals GetIntervals () const
 Report times on the track where important intervals begin and end, for UI to snap to. More...
 
virtual Intervals GetIntervals ()
 
int GetIndex () const
 
void SetIndex (int index)
 
virtual bool LinkConsistencyFix (bool doFix=true, bool completeList=true)
 Check consistency of channel groups, and maybe fix it. More...
 
bool LinkConsistencyCheck (bool completeList)
 Do the non-mutating part of consistency fix only and return status. More...
 
bool HasOwner () const
 
std::shared_ptr< TrackListGetOwner () const
 
LinkType GetLinkType () const noexcept
 
bool IsAlignedWithLeader () const
 Returns true if the leader track has link type LinkType::Aligned. More...
 
ChannelGroupDataGetGroupData ()
 
const ChannelGroupDataGetGroupData () const
 
 Track ()
 
 Track (const Track &orig)
 
virtual ~Track ()
 
void Init (const Track &orig)
 
virtual Holder Duplicate () const
 
virtual void Merge (const Track &orig)
 
wxString GetName () const
 
void SetName (const wxString &n)
 
bool GetSelected () const
 
virtual void SetSelected (bool s)
 
void EnsureVisible (bool modifyState=false)
 
virtual ChannelType GetChannel () const
 
virtual double GetOffset () const =0
 
void Offset (double t)
 
virtual void SetOffset (double o)
 
virtual void SetPan (float)
 
virtual void SetPanFromChannelType ()
 
virtual Holder Cut (double WXUNUSED(t0), double WXUNUSED(t1))=0
 
virtual Holder Copy (double WXUNUSED(t0), double WXUNUSED(t1), bool forClipboard=true) const =0
 
virtual void Clear (double WXUNUSED(t0), double WXUNUSED(t1))=0
 
virtual void Paste (double WXUNUSED(t), const Track *WXUNUSED(src))=0
 
virtual void SyncLockAdjust (double oldT1, double newT1)
 
virtual void Silence (double WXUNUSED(t0), double WXUNUSED(t1))=0
 
virtual void InsertSilence (double WXUNUSED(t), double WXUNUSED(len))=0
 
bool SameKindAs (const Track &track) const
 
template<typename R = void, typename ... Functions>
TypeSwitch (const Functions &...functions)
 Use this function rather than testing track type explicitly and making down-casts. More...
 
template<typename R = void, typename ... Functions>
TypeSwitch (const Functions &...functions) const
 Use this function rather than testing track type explicitly and making down-casts. More...
 
virtual void WriteXML (XMLWriter &xmlFile) const =0
 
virtual bool GetErrorOpening ()
 
virtual double GetStartTime () const =0
 
virtual double GetEndTime () const =0
 
void Notify (int code=-1)
 
bool Any () const
 
bool IsSelected () const
 
bool IsLeader () const
 
bool IsSelectedLeader () const
 
void AdjustPositions ()
 
void WriteCommonXMLAttributes (XMLWriter &xmlFile, bool includeNameAndSelected=true) const
 
bool HandleCommonXMLAttribute (const std::string_view &attr, const XMLAttributeValueView &valueView)
 
- Public Member Functions inherited from XMLTagHandler
 XMLTagHandler ()
 
virtual ~XMLTagHandler ()
 
virtual bool HandleXMLTag (const std::string_view &tag, const AttributesList &attrs)=0
 
virtual void HandleXMLEndTag (const std::string_view &WXUNUSED(tag))
 
virtual void HandleXMLContent (const std::string_view &WXUNUSED(content))
 
virtual XMLTagHandlerHandleXMLChild (const std::string_view &tag)=0
 
void ReadXMLEndTag (const char *tag)
 
void ReadXMLContent (const char *s, int len)
 
XMLTagHandlerReadXMLChild (const char *tag)
 
- Public Member Functions inherited from ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >
 ~Site ()
 
 Site ()
 
 Site (const Site &other)
 
Siteoperator= (const Site &other)
 
 Site (Site &&other)
 
Siteoperator= (Site &&other)
 
size_t size () const
 How many attachment pointers are in the Site. More...
 
template<typename Subclass = ClientData>
Subclass & Get (const RegisteredFactory &key)
 Get reference to an attachment, creating on demand if not present, down-cast it to Subclass. More...
 
template<typename Subclass = const ClientData>
auto Get (const RegisteredFactory &key) const -> std::enable_if_t< std::is_const< Subclass >::value, Subclass & >
 Get reference to an attachment, creating on demand if not present, down-cast it to Subclass. More...
 
template<typename Subclass = ClientData>
Subclass * Find (const RegisteredFactory &key)
 Get a (bare) pointer to an attachment, or null, down-cast it to Subclass *; will not create on demand. More...
 
template<typename Subclass = const ClientData>
auto Find (const RegisteredFactory &key) const -> std::enable_if_t< std::is_const< Subclass >::value, Subclass * >
 Get a (bare) pointer to an attachment, or null, down-cast it to Subclass *; will not create on demand. More...
 
template<typename ReplacementPointer >
void Assign (const RegisteredFactory &key, ReplacementPointer &&replacement)
 Reassign Site's pointer to ClientData. More...
 

Static Public Member Functions

static const TypeInfoClassTypeInfo ()
 
- Static Public Member Functions inherited from AudioTrack
static const TypeInfoClassTypeInfo ()
 
- Static Public Member Functions inherited from Track
template<typename Subclass = Track>
static std::shared_ptr< Subclass > SharedPointer (Track *pTrack)
 
template<typename Subclass = const Track>
static std::shared_ptr< Subclass > SharedPointer (const Track *pTrack)
 
static const TypeInfoClassTypeInfo ()
 
static void FinishCopy (const Track *n, Track *dest)
 
template<typename TrackType >
static void checkTrackType ()
 
template<typename R , typename TrackType , typename... Functions>
static R CallExecutor (R *, std::tuple<> *, TrackType &, const Functions &...)
 
template<typename R , typename TrackType , typename... Functions, typename Executor , typename... Executors>
static R CallExecutor (R *, std::tuple< Executor, Executors... > *, TrackType &track, const Functions &...functions)
 
template<typename ... Executors>
static constexpr unsigned UsedCases (std::tuple< Executors... > *)
 
template<typename Tag , bool IsConst, typename R , typename ... TrackTypes, typename ... Functions>
static R DoTypeSwitch (std::conditional_t< IsConst, const Track, Track > &track, std::tuple< TrackTypes... > *, const Functions &...functions)
 
- Static Public Member Functions inherited from ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >
static size_t slots ()
 How many static factories have been registered with this specialization of Site. More...
 

Protected Member Functions

bool DoGetMute () const
 
void DoSetMute (bool value)
 
bool DoGetSolo () const
 
void DoSetSolo (bool value)
 
- Protected Member Functions inherited from Track
void SetLinkType (LinkType linkType, bool completeList=true)
 
void SetChannel (ChannelType c) noexcept
 
- Protected Member Functions inherited from ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >
template<typename Function >
void ForEach (const Function &function)
 Invoke function on each ClientData object that has been created in this. More...
 
template<typename Function >
void ForEach (const Function &function) const
 Invoke function on each ClientData object that has been created in this. More...
 
template<typename Function >
ClientData * FindIf (const Function &function)
 Return pointer to first attachment in this that is not null and satisfies a predicate, or nullptr. More...
 
template<typename Function >
const ClientData * FindIf (const Function &function) const
 Return pointer to first attachment in this that is not null and satisfies a predicate, or nullptr. More...
 
void BuildAll ()
 For each RegisteredFactory, if the corresponding attachment is absent in this, build and store it. More...
 

Protected Attributes

std::atomic< bool > mMute { false }
 Atomic because it may be read by worker threads in playback. More...
 
std::atomic< bool > mSolo { false }
 Atomic because it may be read by worker threads in playback. More...
 
- Protected Attributes inherited from Track
std::weak_ptr< TrackListmList
 
TrackNodePointer mNode {}
 Holds iterator to self, so that TrackList::Find can be constant-time. More...
 
int mIndex
 0-based position of this track in its TrackList More...
 
wxString mName
 
ChannelType mChannel
 
double mOffset
 

Additional Inherited Members

- Public Types inherited from Track
enum class  LinkType : int { None = 0 , Group = 2 , Aligned }
 For two tracks describes the type of the linkage. More...
 
enum  ChannelType { LeftChannel = 0 , RightChannel = 1 , MonoChannel = 2 }
 
using ChannelGroupAttachments = ClientData::Site< ChannelGroupData, ClientData::Cloneable<>, ClientData::DeepCopying >
 Hosting of objects attached by higher level code. More...
 
using AttachedObjects = ::AttachedTrackObjects
 Alias for my base type. More...
 
using IntervalData = TrackIntervalData
 
using Interval = TrackInterval
 
using Intervals = std::vector< Interval >
 
using ConstInterval = ConstTrackInterval
 
using ConstIntervals = std::vector< ConstInterval >
 
using Holder = std::shared_ptr< Track >
 
template<typename R = void>
using Continuation = std::function< R() >
 Type of arguments passed as optional second parameter to TypeSwitch() cases. More...
 
using Fallthrough = Continuation<>
 Type of arguments passed as optional second parameter to TypeSwitch<void>() cases. More...
 
- Public Types inherited from ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >
using DataType = ClientData
 
using DataPointer = Pointer< ClientData >
 
using DataFactory = std::function< DataPointer(Host &) >
 Type of function from which RegisteredFactory is constructed; it builds attachments. More...
 
- Public Attributes inherited from Track
std::pair< int, int > vrulerSize
 

Detailed Description

AudioTrack subclass that can also be audibly replayed by the program.

An AudioTrack that can be played and stopped.

Definition at line 908 of file Track.h.

Constructor & Destructor Documentation

◆ PlayableTrack() [1/2]

PlayableTrack::PlayableTrack ( )
inline

Definition at line 911 of file Track.h.

912 : AudioTrack{} {}
Track subclass holding data representing sound (as notes, or samples, or ...)
Definition: Track.h:889

◆ PlayableTrack() [2/2]

PlayableTrack::PlayableTrack ( const PlayableTrack orig)
inline

Definition at line 913 of file Track.h.

913: AudioTrack{ orig } {}

Member Function Documentation

◆ ClassTypeInfo()

auto PlayableTrack::ClassTypeInfo ( )
static

Definition at line 1304 of file Track.cpp.

1305{
1306 static Track::TypeInfo info{
1307 { "playable", "playable", XO("Playable Track") },
1308 false, &AudioTrack::ClassTypeInfo() };
1309 return info;
1310}
#define XO(s)
Definition: Internat.h:31
static const TypeInfo & ClassTypeInfo()
Definition: Track.cpp:1296

References AudioTrack::ClassTypeInfo(), and XO.

Referenced by typeInfo().

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

◆ DoGetMute()

bool PlayableTrack::DoGetMute ( ) const
protected

Definition at line 336 of file Track.cpp.

337{
338 return mMute.load(std::memory_order_relaxed);
339}
std::atomic< bool > mMute
Atomic because it may be read by worker threads in playback.
Definition: Track.h:941

References mMute.

Referenced by Init(), SetMute(), and WriteXMLAttributes().

Here is the caller graph for this function:

◆ DoGetSolo()

bool PlayableTrack::DoGetSolo ( ) const
protected

Definition at line 346 of file Track.cpp.

347{
348 return mSolo.load(std::memory_order_relaxed);
349}
std::atomic< bool > mSolo
Atomic because it may be read by worker threads in playback.
Definition: Track.h:943

References mSolo.

Referenced by Init(), SetSolo(), and WriteXMLAttributes().

Here is the caller graph for this function:

◆ DoSetMute()

void PlayableTrack::DoSetMute ( bool  value)
protected

Definition at line 341 of file Track.cpp.

342{
343 mMute.store(value, std::memory_order_relaxed);
344}

References mMute.

Referenced by HandleXMLAttribute(), Init(), Merge(), and SetMute().

Here is the caller graph for this function:

◆ DoSetSolo()

void PlayableTrack::DoSetSolo ( bool  value)
protected

Definition at line 351 of file Track.cpp.

352{
353 mSolo.store(value, std::memory_order_relaxed);
354}

References mSolo.

Referenced by HandleXMLAttribute(), Init(), Merge(), and SetSolo().

Here is the caller graph for this function:

◆ GetMute()

bool PlayableTrack::GetMute ( ) const
inline

Definition at line 917 of file Track.h.

917{ return DoGetMute(); }
bool DoGetMute() const
Definition: Track.cpp:336

Referenced by ExportMultipleDialog::CountTracksAndLabels(), ExportPlugin::CreateMixer(), TrackUtilities::DoTrackMute(), Exporter::ExamineTracks(), ExportMixerDialog::ExportMixerDialog(), ExportMultipleDialog::ExportMultipleByTrack(), GetNumExportChannels(), GetInfoCommand::SendTracks(), and AudioIoCallback::TrackShouldBeSilent().

Here is the caller graph for this function:

◆ GetNotMute()

bool PlayableTrack::GetNotMute ( ) const
inline

Definition at line 919 of file Track.h.

919{ return !DoGetMute(); }

◆ GetNotSolo()

bool PlayableTrack::GetNotSolo ( ) const
inline

Definition at line 920 of file Track.h.

920{ return !DoGetSolo(); }
bool DoGetSolo() const
Definition: Track.cpp:346

Referenced by ExportMultipleDialog::CountTracksAndLabels(), ExportPlugin::CreateMixer(), Exporter::ExamineTracks(), ExportMixerDialog::ExportMixerDialog(), ExportMultipleDialog::ExportMultipleByTrack(), and GetNumExportChannels().

Here is the caller graph for this function:

◆ GetSolo()

bool PlayableTrack::GetSolo ( ) const
inline

◆ HandleXMLAttribute()

bool PlayableTrack::HandleXMLAttribute ( const std::string_view &  attr,
const XMLAttributeValueView value 
)

Definition at line 365 of file Track.cpp.

366{
367 long nValue;
368
369 if (attr == "mute" && value.TryGet(nValue)) {
370 DoSetMute(nValue != 0);
371 return true;
372 }
373 else if (attr == "solo" && value.TryGet(nValue)) {
374 DoSetSolo(nValue != 0);
375 return true;
376 }
377
378 return AudioTrack::HandleXMLAttribute(attr, value);
379}
bool HandleXMLAttribute(const std::string_view &, const XMLAttributeValueView &)
Definition: Track.h:901
void DoSetSolo(bool value)
Definition: Track.cpp:351
void DoSetMute(bool value)
Definition: Track.cpp:341
bool TryGet(bool &value) const noexcept
Try to get a boolean value from the view.

References DoSetMute(), DoSetSolo(), AudioTrack::HandleXMLAttribute(), and XMLAttributeValueView::TryGet().

Referenced by WaveTrack::HandleXMLTag().

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

◆ Init()

void PlayableTrack::Init ( const PlayableTrack init)

Definition at line 304 of file Track.cpp.

305{
306 DoSetMute(orig.DoGetMute());
307 DoSetSolo(orig.DoGetSolo());
308 AudioTrack::Init( orig );
309}
void Init(const Track &orig)
Definition: Track.cpp:65

References DoGetMute(), DoGetSolo(), DoSetMute(), DoSetSolo(), and Track::Init().

Referenced by WaveTrack::Init().

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

◆ Merge()

void PlayableTrack::Merge ( const Track init)
overridevirtual

Reimplemented from Track.

Definition at line 311 of file Track.cpp.

312{
313 auto pOrig = dynamic_cast<const PlayableTrack *>(&orig);
314 wxASSERT( pOrig );
315 DoSetMute(pOrig->DoGetMute());
316 DoSetSolo(pOrig->DoGetSolo());
317 AudioTrack::Merge( *pOrig );
318}
AudioTrack subclass that can also be audibly replayed by the program.
Definition: Track.h:909
virtual void Merge(const Track &orig)
Definition: Track.cpp:105

References DoSetMute(), DoSetSolo(), and Track::Merge().

Referenced by WaveTrack::Merge().

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

◆ SetMute()

void PlayableTrack::SetMute ( bool  m)

Definition at line 320 of file Track.cpp.

321{
322 if ( DoGetMute() != m ) {
323 DoSetMute(m);
324 Notify();
325 }
326}
void Notify(int code=-1)
Definition: Track.cpp:279

References DoGetMute(), DoSetMute(), and Track::Notify().

Referenced by TrackActions::Handler::MuteTracks().

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

◆ SetSolo()

void PlayableTrack::SetSolo ( bool  s)

Definition at line 328 of file Track.cpp.

329{
330 if ( DoGetSolo() != s ) {
331 DoSetSolo(s);
332 Notify();
333 }
334}

References DoGetSolo(), DoSetSolo(), and Track::Notify().

Here is the call graph for this function:

◆ WriteXMLAttributes()

void PlayableTrack::WriteXMLAttributes ( XMLWriter xmlFile) const

Definition at line 357 of file Track.cpp.

358{
359 xmlFile.WriteAttr(wxT("mute"), DoGetMute());
360 xmlFile.WriteAttr(wxT("solo"), DoGetSolo());
362}
void WriteXMLAttributes(XMLWriter &WXUNUSED(xmlFile)) const
Definition: Track.h:898
void WriteAttr(const wxString &name, const Identifier &value)
Definition: XMLWriter.h:37

References DoGetMute(), DoGetSolo(), XMLWriter::WriteAttr(), and AudioTrack::WriteXMLAttributes().

Referenced by WaveTrack::WriteXML().

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

Member Data Documentation

◆ mMute

std::atomic<bool> PlayableTrack::mMute { false }
protected

Atomic because it may be read by worker threads in playback.

Definition at line 941 of file Track.h.

Referenced by DoGetMute(), and DoSetMute().

◆ mSolo

std::atomic<bool> PlayableTrack::mSolo { false }
protected

Atomic because it may be read by worker threads in playback.

Definition at line 943 of file Track.h.

Referenced by DoGetSolo(), and DoSetSolo().


The documentation for this class was generated from the following files: