Audacity 3.2.0
|
#include <RealtimeEffectList.h>
Public Types | |
using | Lock = spinlock |
using | States = std::vector< std::shared_ptr< RealtimeEffectState > > |
Public Types inherited from ClientData::Cloneable< Covariant, Owner > | |
using | Base = std::conditional_t< std::is_void_v< Covariant >, Cloneable, Covariant > |
using | PointerType = Owner< Base > |
Public Types inherited from Observer::Publisher< RealtimeEffectListMessage > | |
using | message_type = RealtimeEffectListMessage |
using | CallbackReturn = std::conditional_t< true, void, bool > |
using | Callback = std::function< CallbackReturn(const RealtimeEffectListMessage &) > |
Type of functions that can be connected to the Publisher. More... | |
Public Member Functions | |
RealtimeEffectList () | |
virtual | ~RealtimeEffectList () |
Lock & | GetLock () const |
std::unique_ptr< ClientData::Cloneable<> > | Clone () const override |
template<typename StateVisitor > | |
void | Visit (const StateVisitor &func) |
Apply the function to all states sequentially. More... | |
template<typename StateVisitor > | |
void | Visit (const StateVisitor &func) const |
Apply the function to all states sequentially. More... | |
bool | AddState (std::shared_ptr< RealtimeEffectState > pState) |
bool | ReplaceState (size_t index, std::shared_ptr< RealtimeEffectState > pState) |
void | RemoveState (std::shared_ptr< RealtimeEffectState > pState) |
void | Clear () |
Use only in the main thread. Sends Remove messages. More... | |
std::optional< size_t > | FindState (const std::shared_ptr< RealtimeEffectState > &pState) const |
Report the position of a state in the list. More... | |
size_t | GetStatesCount () const noexcept |
std::shared_ptr< RealtimeEffectState > | GetStateAt (size_t index) noexcept |
std::shared_ptr< const RealtimeEffectState > | GetStateAt (size_t index) const noexcept |
void | MoveEffect (size_t fromIndex, size_t toIndex) |
Use only in the main thread. Changes effect order in the stack. Does nothing if fromIndex equals toIndex. Otherwise effects between fromIndex (exclusive) and toIndex are shifted towards fromIndex. Sends Move event. More... | |
bool | HandleXMLTag (const std::string_view &tag, const AttributesList &attrs) override |
XMLTagHandler * | HandleXMLChild (const std::string_view &tag) override |
Use only in the main thread. May add a state while deserializing. More... | |
void | WriteXML (XMLWriter &xmlFile) const |
Use only in the main thread, to avoid races. More... | |
void | RestoreUndoRedoState (AudacityProject &project) noexcept override |
Modify the project when undoing or redoing to some state in history. More... | |
bool | IsActive () const |
Non-blocking atomic boolean load. More... | |
void | SetActive (bool value) |
Done by main thread only, under a lock guard. More... | |
Public Member Functions inherited from ClientData::Base | |
virtual | ~Base () |
Public Member Functions inherited from ClientData::Cloneable< Covariant, Owner > | |
Cloneable ()=default | |
Cloneable (const Cloneable &)=default | |
Cloneable & | operator= (const Cloneable &)=default |
virtual | ~Cloneable ()=default |
virtual PointerType | Clone () const =0 |
Public Member Functions inherited from UndoStateExtension | |
virtual | ~UndoStateExtension () |
virtual void | RestoreUndoRedoState (AudacityProject &project)=0 |
Modify the project when undoing or redoing to some state in history. More... | |
virtual bool | CanUndoOrRedo (const AudacityProject &project) |
Whether undo or redo is now permitted; default returns true. More... | |
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 XMLTagHandler * | HandleXMLChild (const std::string_view &tag)=0 |
void | ReadXMLEndTag (const char *tag) |
void | ReadXMLContent (const char *s, int len) |
XMLTagHandler * | ReadXMLChild (const char *tag) |
Public Member Functions inherited from Observer::Publisher< RealtimeEffectListMessage > | |
Publisher (ExceptionPolicy *pPolicy=nullptr, Alloc a={}) | |
Constructor supporting type-erased custom allocation/deletion. More... | |
Publisher (Publisher &&)=default | |
Publisher & | operator= (Publisher &&)=default |
Subscription | Subscribe (Callback callback) |
Connect a callback to the Publisher; later-connected are called earlier. More... | |
Subscription | Subscribe (Object &obj, Return(Object::*callback)(Args...)) |
Overload of Subscribe takes an object and pointer-to-member-function. More... | |
Static Public Member Functions | |
static RealtimeEffectList & | Get (AudacityProject &project) |
static const RealtimeEffectList & | Get (const AudacityProject &project) |
static RealtimeEffectList & | Set (AudacityProject &project, const std::shared_ptr< RealtimeEffectList > &list) |
static RealtimeEffectList & | Get (ChannelGroup &group) |
static const RealtimeEffectList & | Get (const ChannelGroup &group) |
static const std::string & | XMLTag () |
Private Types | |
using | LockGuard = std::lock_guard< Lock > |
Private Member Functions | |
RealtimeEffectList (const RealtimeEffectList &)=delete | |
RealtimeEffectList & | operator= (const RealtimeEffectList &)=delete |
Private Attributes | |
States | mStates |
Lock | mLock |
std::atomic< bool > | mActive { true } |
Additional Inherited Members | |
Static Public Attributes inherited from Observer::Publisher< RealtimeEffectListMessage > | |
static constexpr bool | notifies_all |
Protected Member Functions inherited from Observer::Publisher< RealtimeEffectListMessage > | |
CallbackReturn | Publish (const RealtimeEffectListMessage &message) |
Send a message to connected callbacks. More... | |
Definition at line 42 of file RealtimeEffectList.h.
using RealtimeEffectList::Lock = spinlock |
Definition at line 56 of file RealtimeEffectList.h.
|
private |
Definition at line 167 of file RealtimeEffectList.h.
using RealtimeEffectList::States = std::vector<std::shared_ptr<RealtimeEffectState> > |
Definition at line 57 of file RealtimeEffectList.h.
|
privatedelete |
RealtimeEffectList::RealtimeEffectList | ( | ) |
Definition at line 15 of file RealtimeEffectList.cpp.
|
virtual |
Definition at line 19 of file RealtimeEffectList.cpp.
bool RealtimeEffectList::AddState | ( | std::shared_ptr< RealtimeEffectState > | pState | ) |
Use only in the main thread Returns true for success. Sends Insert message on success.
!result || pState->GetEffect() != nullptr
Definition at line 83 of file RealtimeEffectList.cpp.
References RealtimeEffectListMessage::Insert, mLock, mStates, Observer::Publisher< RealtimeEffectListMessage >::Publish(), and anonymous_namespace{NoteTrack.cpp}::swap().
void RealtimeEffectList::Clear | ( | ) |
Use only in the main thread. Sends Remove messages.
Definition at line 164 of file RealtimeEffectList.cpp.
References mLock, mStates, Observer::Publisher< RealtimeEffectListMessage >::Publish(), RealtimeEffectListMessage::Remove, and anonymous_namespace{NoteTrack.cpp}::swap().
Referenced by ProjectFileManager::FixTracks(), MixAndRender(), and StereoToMono::ProcessOne().
|
overridevirtual |
Should be called (for pushing undo states) only from main thread, to avoid races
Implements ClientData::Cloneable< Covariant, Owner >.
Definition at line 24 of file RealtimeEffectList.cpp.
References IsActive(), and mStates.
std::optional< size_t > RealtimeEffectList::FindState | ( | const std::shared_ptr< RealtimeEffectState > & | pState | ) | const |
Report the position of a state in the list.
Definition at line 177 of file RealtimeEffectList.cpp.
References details::begin(), details::end(), and mStates.
|
static |
Definition at line 42 of file RealtimeEffectList.cpp.
References masterEffects, and project.
Referenced by ExportAudioDialog::ExportAudioDialog(), anonymous_namespace{RealtimeEffectManager.cpp}::FindStates(), ProjectFileManager::FixTracks(), Get(), TrackEffectListUIDelegate::GetEffectList(), GetEffectStagesImpl(), MixAndRender(), WaveTrackMenuTable::OnMergeStereo(), anonymous_namespace{FileMenus.cpp}::OnOpen(), StereoToMono::ProcessOne(), ProjectEffectListDelegate::ProjectEffectListDelegate(), RealtimeEffectPanel::RealtimeEffectPanel(), anonymous_namespace{RealtimeEffectPanel.cpp}::ReopenRealtimeEffectUIData(), RealtimeEffectPanel::SetTrack(), anonymous_namespace{RealtimeEffectPanel.cpp}::UpdateRealtimeEffectUIData(), RealtimeEffectManager::VisitAll(), RealtimeEffectManager::VisitGroup(), and anonymous_namespace{RealtimeEffectPanel.cpp}::VisitRealtimeEffectStateUIs().
|
static |
Definition at line 71 of file RealtimeEffectList.cpp.
References channelGroupEffects.
|
static |
Definition at line 56 of file RealtimeEffectList.cpp.
References Get(), and project.
|
static |
Definition at line 76 of file RealtimeEffectList.cpp.
References Get().
|
inline |
Definition at line 62 of file RealtimeEffectList.h.
|
noexcept |
Returns effect state at given position Use only in the main thread, to avoid races
Definition at line 202 of file RealtimeEffectList.cpp.
|
noexcept |
Returns effect state at given position Use only in the main thread, to avoid races
Definition at line 194 of file RealtimeEffectList.cpp.
|
noexcept |
Use only in the main thread, to avoid races Returns total number of effects in this list
Definition at line 188 of file RealtimeEffectList.cpp.
References mStates.
Referenced by ExportAudioDialog::ExportAudioDialog(), and WaveTrackMenuTable::OnMergeStereo().
|
overridevirtual |
Use only in the main thread. May add a state while deserializing.
Implements XMLTagHandler.
Definition at line 260 of file RealtimeEffectList.cpp.
References SharedNonInterfering< RealtimeEffectState >::make_shared(), mStates, and RealtimeEffectState::XMLTag().
|
overridevirtual |
Implements XMLTagHandler.
Definition at line 247 of file RealtimeEffectList.cpp.
References activeAttribute, SetActive(), and XMLTag().
bool RealtimeEffectList::IsActive | ( | ) | const |
Non-blocking atomic boolean load.
Definition at line 284 of file RealtimeEffectList.cpp.
References mActive.
Referenced by Clone(), RealtimeEffectPanel::RealtimeEffectPanel(), RealtimeEffectPanel::SetTrack(), and WriteXML().
void RealtimeEffectList::MoveEffect | ( | size_t | fromIndex, |
size_t | toIndex | ||
) |
Use only in the main thread. Changes effect order in the stack. Does nothing if fromIndex equals toIndex. Otherwise effects between fromIndex (exclusive) and toIndex are shifted towards fromIndex. Sends Move event.
fromIndex | Index of the moved effect |
toIndex | Final position of the moved effect |
Definition at line 207 of file RealtimeEffectList.cpp.
References mLock, RealtimeEffectListMessage::Move, mStates, Observer::Publisher< RealtimeEffectListMessage >::Publish(), staffpad::vo::rotate(), and anonymous_namespace{NoteTrack.cpp}::swap().
|
privatedelete |
void RealtimeEffectList::RemoveState | ( | std::shared_ptr< RealtimeEffectState > | pState | ) |
Use only in the main thread On success sends Remove message.
Definition at line 141 of file RealtimeEffectList.cpp.
References details::end(), mLock, mStates, Observer::Publisher< RealtimeEffectListMessage >::Publish(), RealtimeEffectListMessage::Remove, and anonymous_namespace{NoteTrack.cpp}::swap().
bool RealtimeEffectList::ReplaceState | ( | size_t | index, |
std::shared_ptr< RealtimeEffectState > | pState | ||
) |
Use only in the main thread Returns true for success. Sends Insert message on success.
!result || pState->GetEffect() != nullptr
Definition at line 107 of file RealtimeEffectList.cpp.
References RealtimeEffectListMessage::DidReplace, mLock, mStates, Observer::Publisher< RealtimeEffectListMessage >::Publish(), anonymous_namespace{NoteTrack.cpp}::swap(), and RealtimeEffectListMessage::WillReplace.
|
overridevirtualnoexcept |
Modify the project when undoing or redoing to some state in history.
Implements UndoStateExtension.
Definition at line 278 of file RealtimeEffectList.cpp.
References project.
|
static |
Definition at line 47 of file RealtimeEffectList.cpp.
References masterEffects, and project.
void RealtimeEffectList::SetActive | ( | bool | value | ) |
Done by main thread only, under a lock guard.
Definition at line 289 of file RealtimeEffectList.cpp.
References mActive, and mLock.
Referenced by HandleXMLTag().
|
inline |
Apply the function to all states sequentially.
Definition at line 84 of file RealtimeEffectList.h.
Referenced by RealtimeEffectManager::VisitAll(), RealtimeEffectManager::VisitGroup(), and anonymous_namespace{RealtimeEffectPanel.cpp}::VisitRealtimeEffectStateUIs().
|
inline |
Apply the function to all states sequentially.
Definition at line 92 of file RealtimeEffectList.h.
void RealtimeEffectList::WriteXML | ( | XMLWriter & | xmlFile | ) | const |
Use only in the main thread, to avoid races.
Definition at line 269 of file RealtimeEffectList.cpp.
References activeAttribute, XMLWriter::EndTag(), IsActive(), mStates, XMLWriter::StartTag(), XMLWriter::WriteAttr(), and XMLTag().
|
static |
Definition at line 239 of file RealtimeEffectList.cpp.
Referenced by HandleXMLTag(), and WriteXML().
|
private |
Definition at line 170 of file RealtimeEffectList.h.
Referenced by IsActive(), and SetActive().
|
mutableprivate |
Definition at line 168 of file RealtimeEffectList.h.
Referenced by AddState(), Clear(), MoveEffect(), RemoveState(), ReplaceState(), and SetActive().
|
private |
Definition at line 165 of file RealtimeEffectList.h.
Referenced by AddState(), Clear(), Clone(), FindState(), GetStatesCount(), HandleXMLChild(), MoveEffect(), RemoveState(), ReplaceState(), and WriteXML().