Audacity  3.0.3
Public 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 Track &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 wxChar *attr, const wxChar *value)
 
- Public Member Functions inherited from AudioTrack
 AudioTrack ()
 
 AudioTrack (const Track &orig)
 
void WriteXMLAttributes (XMLWriter &WXUNUSED(xmlFile)) const
 
bool HandleXMLAttribute (const wxChar *, const wxChar *)
 
- 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 -> typename std::enable_if< std::is_const< Subclass >::value, std::shared_ptr< Subclass > >::type
 
std::shared_ptr< TrackSubstitutePendingChangedTrack ()
 
std::shared_ptr< const TrackSubstitutePendingChangedTrack () const
 
std::shared_ptr< const TrackSubstituteOriginalTrack () 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 ()
 
const std::shared_ptr< CommonTrackCell > & GetTrackView ()
 
void SetTrackView (const std::shared_ptr< CommonTrackCell > &pView)
 
const std::shared_ptr< CommonTrackCell > & GetTrackControls ()
 
void SetTrackControls (const std::shared_ptr< CommonTrackCell > &pControls)
 
int GetIndex () const
 
void SetIndex (int index)
 
virtual bool LinkConsistencyCheck ()
 
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...
 
 Track ()
 
 Track (const Track &orig)
 
virtual ~ Track ()
 
void Init (const Track &orig)
 
virtual Holder Duplicate () const
 
wxString GetName () const
 
void SetName (const wxString &n)
 
wxString GetDefaultName () const
 
void SetDefaultName (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
 
bool IsSyncLockSelected () const
 
void Notify (int code=-1)
 
bool Any () const
 
bool IsSelected () const
 
bool IsSelectedOrSyncLockSelected () const
 
bool IsLeader () const
 
bool IsSelectedLeader () const
 
void AdjustPositions ()
 
void WriteCommonXMLAttributes (XMLWriter &xmlFile, bool includeNameAndSelected=true) const
 
bool HandleCommonXMLAttribute (const wxChar *attr, const wxChar *value)
 
- Public Member Functions inherited from XMLTagHandler
 XMLTagHandler ()
 
virtual ~XMLTagHandler ()
 
virtual bool HandleXMLTag (const wxChar *tag, const wxChar **attrs)=0
 
virtual void HandleXMLEndTag (const wxChar *WXUNUSED(tag))
 
virtual void HandleXMLContent (const wxString &WXUNUSED(content))
 
virtual XMLTagHandlerHandleXMLChild (const wxChar *tag)=0
 
bool ReadXMLTag (const char *tag, const char **attrs)
 
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 -> typename std::enable_if< std::is_const< Subclass >::value, Subclass & >::type
 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 -> typename std::enable_if< std::is_const< Subclass >::value, Subclass * >::type
 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...
 

Protected Attributes

bool mMute { false }
 
bool mSolo { false }
 
- 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
 
wxString mDefaultName
 
ChannelType mChannel
 
double mOffset
 
std::shared_ptr< CommonTrackCellmpView
 
std::shared_ptr< CommonTrackCellmpControls
 

Additional Inherited Members

- Public Types inherited from Track
enum  LinkType : int { LinkType::None = 0, LinkType::Group = 2, LinkType::Aligned }
 For two tracks describes the type of the linkage. More...
 
enum  ChannelType { LeftChannel = 0, RightChannel = 1, MonoChannel = 2 }
 
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...
 
- 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 void FinishCopy (const Track *n, Track *dest)
 
- 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...
 
- Public Attributes inherited from Track
wxSize vrulerSize
 
- Protected Member Functions inherited from Track
void SetLinkType (LinkType linkType)
 
void DoSetLinkType (LinkType linkType) noexcept
 
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...
 

Detailed Description

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

An AudioTrack that can be played and stopped.

Definition at line 853 of file Track.h.

Constructor & Destructor Documentation

◆ PlayableTrack() [1/2]

PlayableTrack::PlayableTrack ( )
inline

Definition at line 856 of file Track.h.

857  : AudioTrack{} {}

◆ PlayableTrack() [2/2]

PlayableTrack::PlayableTrack ( const Track orig)
inline

Definition at line 858 of file Track.h.

858 : AudioTrack{ orig } {}

Member Function Documentation

◆ GetMute()

bool PlayableTrack::GetMute ( ) const
inline

Definition at line 860 of file Track.h.

860 { return mMute; }

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 862 of file Track.h.

862 { return !mMute; }

◆ GetNotSolo()

bool PlayableTrack::GetNotSolo ( ) const
inline

Definition at line 863 of file Track.h.

863 { return !mSolo; }

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 wxChar *  attr,
const wxChar *  value 
)

Definition at line 352 of file Track.cpp.

353 {
354  const wxString strValue{ value };
355  long nValue;
356  if (!wxStrcmp(attr, wxT("mute")) &&
357  XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) {
358  mMute = (nValue != 0);
359  return true;
360  }
361  else if (!wxStrcmp(attr, wxT("solo")) &&
362  XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) {
363  mSolo = (nValue != 0);
364  return true;
365  }
366 
367  return AudioTrack::HandleXMLAttribute(attr, value);
368 }

References AudioTrack::HandleXMLAttribute(), XMLValueChecker::IsGoodInt(), mMute, and mSolo.

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 311 of file Track.cpp.

312 {
313  mMute = orig.mMute;
314  mSolo = orig.mSolo;
315  AudioTrack::Init( orig );
316 }

References Track::Init(), mMute, and mSolo.

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.

Reimplemented in WaveTrack.

Definition at line 318 of file Track.cpp.

319 {
320  auto pOrig = dynamic_cast<const PlayableTrack *>(&orig);
321  wxASSERT( pOrig );
322  mMute = pOrig->mMute;
323  mSolo = pOrig->mSolo;
324  AudioTrack::Merge( *pOrig );
325 }

References Track::Merge(), mMute, and mSolo.

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 327 of file Track.cpp.

328 {
329  if ( mMute != m ) {
330  mMute = m;
331  Notify();
332  }
333 }

References mMute, 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 335 of file Track.cpp.

336 {
337  if ( mSolo != s ) {
338  mSolo = s;
339  Notify();
340  }
341 }

References mSolo, and Track::Notify().

Here is the call graph for this function:

◆ WriteXMLAttributes()

void PlayableTrack::WriteXMLAttributes ( XMLWriter xmlFile) const

Definition at line 344 of file Track.cpp.

345 {
346  xmlFile.WriteAttr(wxT("mute"), mMute);
347  xmlFile.WriteAttr(wxT("solo"), mSolo);
349 }

References mMute, mSolo, 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

bool PlayableTrack::mMute { false }
protected

Definition at line 877 of file Track.h.

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

◆ mSolo

bool PlayableTrack::mSolo { false }
protected

Definition at line 878 of file Track.h.

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


The documentation for this class was generated from the following files:
XMLValueChecker::IsGoodInt
static bool IsGoodInt(const wxString &strInt)
Check that the supplied string can be converted to a long (32bit) integer.
Definition: XMLTagHandler.cpp:157
Track::Merge
virtual void Merge(const Track &orig)
Definition: Track.cpp:107
AudioTrack::HandleXMLAttribute
bool HandleXMLAttribute(const wxChar *, const wxChar *)
Definition: Track.h:848
AudioTrack::WriteXMLAttributes
void WriteXMLAttributes(XMLWriter &WXUNUSED(xmlFile)) const
Definition: Track.h:845
AudioTrack
Track subclass holding data representing sound (as notes, or samples, or ...)
Definition: Track.h:838
PlayableTrack::mSolo
bool mSolo
Definition: Track.h:878
PlayableTrack
AudioTrack subclass that can also be audibly replayed by the program.
Definition: Track.h:854
Track::Notify
void Notify(int code=-1)
Definition: Track.cpp:286
Track::Init
void Init(const Track &orig)
Definition: Track.cpp:70
XMLWriter::WriteAttr
void WriteAttr(const wxString &name, const Identifier &value)
Definition: XMLWriter.h:34
PlayableTrack::mMute
bool mMute
Definition: Track.h:877