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 VSTEffectValidator::Flush(), VSTEffectValidator::OnClose(), VST3UIValidator::OnClose(), LV2Validator::OnIdle(), VSTEffectValidator::OnIdle(), and VST3UIValidator::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:87
virtual const EffectSettings & Get()=0
virtual void Set(EffectSettings &&settings, std::unique_ptr< Message > pMessage=nullptr)=0

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

Referenced by LV2Validator::OnChoice(), VST3UIValidator::OnClose(), VST3UIValidator::OnIdle(), AudioUnitValidator::OnIdle(), VSTEffectValidator::OnIdle(), LV2Validator::OnSlider(), LV2Validator::OnText(), LV2Validator::OnToggle(), LV2Validator::OnTrigger(), EffectBase::Preview(), NyquistEffect::ShowHostInterface(), LV2Validator::suil_port_write(), VST3UIValidator::UpdateUI(), AudioUnitValidator::ValidateUI(), EffectDistortion::Validator::ValidateUI(), DefaultEffectUIValidator::ValidateUI(), LV2Validator::ValidateUI(), EffectReverb::Validator::ValidateUI(), VSTEffectValidator::ValidateUI(), VST3UIValidator::ValidateUI(), EffectWahwah::Validator::ValidateUI(), and VSTEffectValidator::VSTEffectValidator().

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 VSTEffectValidator::Automate(), AudioUnitValidator::EventListener(), and VSTEffectValidator::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: