Audacity 3.2.0
Classes | Public Member Functions | List of all members
EffectSettingsAccess Class Referenceabstract

#include <EffectInterface.h>

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

Classes

class  Message
 Type of messages to send from main thread to processing. More...
 

Public Member Functions

virtual ~EffectSettingsAccess ()
 
virtual const EffectSettingsGet ()=0
 
virtual void Set (EffectSettings &&settings, std::unique_ptr< Message > pMessage=nullptr)=0
 
virtual void Set (std::unique_ptr< Message > pMessage=nullptr)=0
 Message-only overload of Set(). In future, this should be the only one. More...
 
virtual void Flush ()=0
 Make the last Set changes "persistent" in underlying storage. More...
 
virtual bool IsSameAs (const EffectSettingsAccess &other) const =0
 
template<typename Function >
void ModifySettings (Function &&function)
 Do a correct read-modify-write of settings. More...
 

Detailed Description

Interface for accessing an EffectSettings that may change asynchronously in another thread; to be used in the main thread, only.

Updates are communicated atomically both ways. The address of Get() should not be relied on as unchanging between calls.

Definition at line 152 of file EffectInterface.h.

Constructor & Destructor Documentation

◆ ~EffectSettingsAccess()

EffectSettingsAccess::~EffectSettingsAccess ( )
virtualdefault

Member Function Documentation

◆ Flush()

virtual void EffectSettingsAccess::Flush ( )
pure virtual

Make the last Set changes "persistent" in underlying storage.

Precondition
called on the main thread only

Implemented in SimpleEffectSettingsAccess, RealtimeEffectState::Access, and anonymous_namespace{EffectUI.cpp}::EffectSettingsAccessTee.

Referenced by VSTEditor::Flush(), VSTEditor::OnClose(), VST3Editor::OnClose(), LV2Editor::OnIdle(), VSTEditor::OnIdle(), and VST3Editor::UpdateUI().

Here is the caller graph for this function:

◆ Get()

virtual const EffectSettings & EffectSettingsAccess::Get ( )
pure virtual

◆ IsSameAs()

virtual bool EffectSettingsAccess::IsSameAs ( const EffectSettingsAccess other) const
pure virtual
Returns
whether this and the other give access to the same settings

Implemented in SimpleEffectSettingsAccess, RealtimeEffectState::Access, and anonymous_namespace{EffectUI.cpp}::EffectSettingsAccessTee.

◆ ModifySettings()

template<typename Function >
void EffectSettingsAccess::ModifySettings ( Function &&  function)
inline

Do a correct read-modify-write of settings.

Parameters
functiontakes EffectSettings & and its return is a unique pointer to Message, possibly null. If it throws an exception, then the settings will not be updated. Thus, a strong exception safety guarantee.

Definition at line 211 of file EffectInterface.h.

211 {
212 auto settings = this->Get();
213 auto result = std::forward<Function>(function)(settings);
214 this->Set(std::move(settings), std::move(result));
215 }
static Settings & settings()
Definition: TrackInfo.cpp:47
virtual const EffectSettings & Get()=0
virtual void Set(EffectSettings &&settings, std::unique_ptr< Message > pMessage=nullptr)=0

References BasicUI::Get(), and settings().

Referenced by EffectPreview(), LV2Editor::OnChoice(), VST3Editor::OnClose(), VST3Editor::OnIdle(), AudioUnitEditor::OnIdle(), VSTEditor::OnIdle(), LV2Editor::OnSlider(), LV2Editor::OnText(), LV2Editor::OnToggle(), LV2Editor::OnTrigger(), NyquistEffect::ShowHostInterface(), LV2Editor::suil_port_write(), VST3Editor::UpdateUI(), AudioUnitEditor::ValidateUI(), EffectDistortion::Editor::ValidateUI(), LadspaEditor::ValidateUI(), LV2Editor::ValidateUI(), EffectReverb::Editor::ValidateUI(), anonymous_namespace{StatefulEffectUIServices.cpp}::DefaultEffectEditor::ValidateUI(), VSTEditor::ValidateUI(), VST3Editor::ValidateUI(), EffectWahwah::Editor::ValidateUI(), and VSTEditor::VSTEditor().

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

◆ Set() [1/2]

virtual void EffectSettingsAccess::Set ( EffectSettings &&  settings,
std::unique_ptr< Message pMessage = nullptr 
)
pure virtual

Implemented in SimpleEffectSettingsAccess, RealtimeEffectState::Access, and anonymous_namespace{EffectUI.cpp}::EffectSettingsAccessTee.

Referenced by VSTEditor::Automate(), AudioUnitEditor::EventListener(), and VSTEditor::OnSlider().

Here is the caller graph for this function:

◆ Set() [2/2]

virtual void EffectSettingsAccess::Set ( std::unique_ptr< Message pMessage = nullptr)
pure virtual

Message-only overload of Set(). In future, this should be the only one.

Implemented in SimpleEffectSettingsAccess, RealtimeEffectState::Access, and anonymous_namespace{EffectUI.cpp}::EffectSettingsAccessTee.


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