13#ifndef __AUDACITY_CHANNEL_ATTACHMENTS__
14#define __AUDACITY_CHANNEL_ATTACHMENTS__
37 virtual void Reparent(
const std::shared_ptr<Track> &parent,
size_t iChannel);
45 virtual bool HandleXMLAttribute(
55 std::function<std::shared_ptr<ChannelAttachment>(
Track &,
size_t)>;
74 size_t Size()
const {
return mAttachments.size(); }
77 void CopyTo(
Track &track)
const override;
78 void Reparent(
const std::shared_ptr<Track> &parent)
override;
79 void WriteXMLAttributes(
XMLWriter &writer)
const override;
80 bool HandleXMLAttribute(
92 void MakeStereo(
const std::shared_ptr<Track> &parent,
99 void SwapChannels(
const std::shared_ptr<Track> &parent);
106 void Erase(
const std::shared_ptr<Track> &parent,
size_t index);
128template<
typename Attachment>
131 static_assert(std::is_base_of_v<ChannelAttachment, Attachment>);
142 return static_cast<Attachment&
>(
152 return static_cast<Attachment*
>(
166 typename sfinae = std::enable_if_t<std::is_convertible_v<
167 std::invoke_result_t<F, Track&, size_t>, std::shared_ptr<Attachment>
declares abstract base class Track, TrackList, and iterators over TrackList
virtual ~ChannelAttachment()
Holds multiple objects as a single attachment to Track.
ChannelAttachmentsBase(const ChannelAttachmentsBase &)=delete
std::vector< std::shared_ptr< ChannelAttachment > > mAttachments
~ChannelAttachmentsBase() override
ChannelAttachmentsBase & operator=(const ChannelAttachmentsBase &)=delete
static ChannelAttachment & Get(const AttachedTrackObjects::RegisteredFactory &key, Track &track, size_t iChannel)
std::function< std::shared_ptr< ChannelAttachment >(Track &, size_t)> Factory
static ChannelAttachment * Find(const AttachedTrackObjects::RegisteredFactory &key, Track *pTrack, size_t iChannel)
ChannelAttachmentsBase(ChannelAttachmentsBase &)=delete
Holds multiple objects of the parameter type as a single attachment to Track.
~ChannelAttachments() override=default
static Attachment * Find(const AttachedTrackObjects::RegisteredFactory &key, Track *pTrack, size_t iChannel)
ChannelAttachments(Track &track, F &&f)
Type-erasing constructor.
static Attachment & Get(const AttachedTrackObjects::RegisteredFactory &key, Track &track, size_t iChannel)
Client code makes static instance from a factory of attachments; passes it to Get or Find as a retrie...
Abstract base class for an object holding data associated with points on a time axis.
A view into an attribute value. The class does not take the ownership of the data.
Base class for XMLFileWriter and XMLStringWriter that provides the general functionality for creating...
PROJECT_FILE_IO_API wxString Find(const FilePath &path)
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.