Ardour  9.0-pre0-350-gf17a656217
PBD::Controllable Class Referenceabstract

#include <controllable.h>

Inheritance diagram for PBD::Controllable:
[legend]

Public Types

enum  Flag {
  Toggle = 0x01 , GainLike = 0x02 , RealTime = 0x04 , NotAutomatable = 0x08 ,
  InlineControl = 0x10 , HiddenControl = 0x20 , MonitorControl = 0x40
}
 
enum  GroupControlDisposition { InverseGroup , NoGroup , UseGroup , ForGroup }
 

Public Member Functions

 Controllable (const std::string &name, Flag f=Flag(0))
 
virtual void set_value (double value, GroupControlDisposition group_override)=0
 
virtual double get_value (void) const =0
 
virtual double get_save_value () const
 
virtual double internal_to_interface (double i, bool rotary=false) const
 
virtual double interface_to_internal (double i, bool rotary=false) const
 
virtual float get_interface (bool rotary=false) const
 
virtual void set_interface (float fraction, bool rotary=false, GroupControlDisposition gcd=NoGroup)
 
virtual std::string get_user_string () const
 
int set_state (const XMLNode &, int version)
 
virtual XMLNodeget_state () const
 
std::string name () const
 
bool touching () const
 
bool is_toggle () const
 
bool is_gain_like () const
 
virtual double lower () const
 
virtual double upper () const
 
virtual double normal () const
 
Flag flags () const
 
void set_flags (Flag f)
 
void set_flag (Flag f)
 _flags |= f; More...
 
void clear_flag (Flag f)
 _flags &= ~f; More...
 
- Public Member Functions inherited from PBD::Stateful
 Stateful ()
 
virtual ~Stateful ()
 
virtual bool apply_change (PropertyBase const &)
 
PropertyChange apply_changes (PropertyList const &)
 
const OwnedPropertyListproperties () const
 
void add_property (PropertyBase &s)
 
void add_extra_xml (XMLNode &)
 
XMLNodeextra_xml (const std::string &str, bool add_if_missing=false)
 
void save_extra_xml (const XMLNode &)
 
const PBD::IDid () const
 
bool set_id (const XMLNode &)
 
void set_id (const std::string &)
 
void reset_id ()
 
void clear_changes ()
 
virtual void clear_owned_changes ()
 
PropertyListget_changes_as_properties (PBD::Command *) const
 
virtual void rdiff (std::vector< PBD::Command * > &) const
 
bool changed () const
 
virtual PropertyListproperty_factory (const XMLNode &) const
 
virtual void suspend_property_changes ()
 
virtual void resume_property_changes ()
 
bool property_changes_suspended () const
 
- Public Member Functions inherited from PBD::Destructible
virtual ~Destructible ()
 
virtual void drop_references ()
 

Static Public Member Functions

static std::shared_ptr< Controllableby_id (const PBD::ID &)
 
static void dump_registry ()
 
static ControllableSet registered_controllables ()
 

Public Attributes

PBD::Signal< void()> LearningFinished
 
PBD::Signal< void(bool, PBD::Controllable::GroupControlDisposition)> Changed
 
PBD::Signal< void()> TouchChanged
 
- Public Attributes inherited from PBD::Stateful
PBD::Signal< void(const PropertyChange &)> PropertyChanged
 
- Public Attributes inherited from PBD::Destructible
PBD::Signal< void()> Destroyed
 
PBD::Signal< void()> DropReferences
 

Static Public Attributes

static PBD::Signal< bool(std::weak_ptr< PBD::Controllable >)> StartLearning
 
static PBD::Signal< void(std::weak_ptr< PBD::Controllable >)> StopLearning
 
static PBD::Signal< void(std::weak_ptr< PBD::Controllable >)> GUIFocusChanged
 
static PBD::Signal< void(std::weak_ptr< PBD::Controllable >)> ControlTouched
 
static const std::string xml_node_name
 
- Static Public Attributes inherited from PBD::Stateful
static int current_state_version
 
static int loading_state_version
 

Protected Member Functions

void set_touching (bool yn)
 
- Protected Member Functions inherited from PBD::Stateful
void add_instant_xml (XMLNode &, const std::string &directory_path)
 
XMLNodeinstant_xml (const std::string &str, const std::string &directory_path)
 
void add_properties (XMLNode &) const
 
PropertyChange set_values (XMLNode const &)
 
virtual void post_set (const PropertyChange &)
 
virtual void send_change (const PropertyChange &)
 
virtual void mid_thaw (const PropertyChange &)
 
bool regenerate_xml_or_string_ids () const
 

Private Types

typedef std::set< PBD::Controllable * > Controllables
 

Static Private Member Functions

static void add (Controllable &)
 
static void remove (Controllable *)
 

Private Attributes

std::string _name
 
std::string _units
 
Flag _flags
 
bool _touching
 

Static Private Attributes

static ScopedConnectionList registry_connections
 
static Glib::Threads::RWLock registry_lock
 
static Controllables registry
 

Additional Inherited Members

- Protected Attributes inherited from PBD::Stateful
XMLNode_extra_xml
 
XMLNode_instant_xml
 
PBD::PropertyChange _pending_changed
 
Glib::Threads::Mutex _lock
 
std::string _xml_node_name
 name of node to use for this object in XML More...
 
OwnedPropertyList_properties
 

Detailed Description

This is a pure virtual class to represent a scalar control.

Note that it contains no storage/state for the controllable thing that it represents. Derived classes must provide set_value()/get_value() methods, which will involve (somehow) an actual location to store the value.

In essence, this is an interface, not a class.

Without overriding upper() and lower(), a derived class will function as a control whose value can range between 0 and 1.0.

We express Controllable values in one of three ways:

  1. ‘user’ — as presented to the user (e.g. dB, Hz, etc.)
  2. ‘interface’ — as used in some cases for the UI representation (in order to make controls behave logarithmically).
  3. ‘internal’ — as passed to a processor, track, plugin, or whatever.

Note that in some cases user and internal may be the same (and interface different) e.g. frequency, which is presented to the user and passed to the processor in linear terms, but which needs log scaling in the interface.

In other cases, user and interface may be the same (and internal different) e.g. gain, which is presented to the user in log terms (dB) but passed to the processor as a linear quantity.

Definition at line 71 of file controllable.h.

Member Typedef Documentation

◆ Controllables

Definition at line 191 of file controllable.h.

Member Enumeration Documentation

◆ Flag

Enumerator
Toggle 
GainLike 
RealTime 
NotAutomatable 
InlineControl 
HiddenControl 
MonitorControl 

Definition at line 74 of file controllable.h.

◆ GroupControlDisposition

Within an application, various Controllables might be considered to be "grouped" in a way that implies that setting 1 of them also modifies others in the group.

Enumerator
InverseGroup 

set all controls in the same "group" as this one

NoGroup 

set only this control

UseGroup 

use group settings to decide which group controls are altered

ForGroup 

this setting is being done for the group (i.e. UseGroup was set in the callchain somewhere).

Definition at line 90 of file controllable.h.

Constructor & Destructor Documentation

◆ Controllable()

PBD::Controllable::Controllable ( const std::string &  name,
Flag  f = Flag(0) 
)

Member Function Documentation

◆ add()

static void PBD::Controllable::add ( Controllable )
staticprivate

◆ by_id()

static std::shared_ptr<Controllable> PBD::Controllable::by_id ( const PBD::ID )
static

◆ clear_flag()

void PBD::Controllable::clear_flag ( Flag  f)

_flags &= ~f;

◆ dump_registry()

static void PBD::Controllable::dump_registry ( )
static

◆ flags()

Flag PBD::Controllable::flags ( ) const
inline

Definition at line 166 of file controllable.h.

◆ get_interface()

virtual float PBD::Controllable::get_interface ( bool  rotary = false) const
inlinevirtual

Get and Set ‘interface’ value (typically, fraction of knob travel)

Definition at line 135 of file controllable.h.

◆ get_save_value()

virtual double PBD::Controllable::get_save_value ( ) const
inlinevirtual

This is used when saving state. By default it just calls get_value(), but a class with more complex semantics might override this to save some value that differs from what get_value() would return.

Reimplemented in ARDOUR::SoloControl, ARDOUR::MuteControl, and ARDOUR::AutomationControl.

Definition at line 121 of file controllable.h.

◆ get_state()

◆ get_user_string()

◆ get_value()

◆ interface_to_internal()

virtual double PBD::Controllable::interface_to_internal ( double  i,
bool  rotary = false 
) const
inlinevirtual

Reimplemented in ARDOUR::AutomationControl, and TimeCtlGUIControllable.

Definition at line 130 of file controllable.h.

◆ internal_to_interface()

virtual double PBD::Controllable::internal_to_interface ( double  i,
bool  rotary = false 
) const
inlinevirtual

Conversions between ‘internal’, 'interface', and 'user' values

Reimplemented in ARDOUR::AutomationControl, and TimeCtlGUIControllable.

Definition at line 124 of file controllable.h.

◆ is_gain_like()

bool PBD::Controllable::is_gain_like ( ) const
inline

Definition at line 160 of file controllable.h.

◆ is_toggle()

bool PBD::Controllable::is_toggle ( ) const
inline

Definition at line 159 of file controllable.h.

◆ lower()

◆ name()

std::string PBD::Controllable::name ( ) const
inline

Definition at line 154 of file controllable.h.

◆ normal()

virtual double PBD::Controllable::normal ( ) const
inlinevirtual

◆ registered_controllables()

static ControllableSet PBD::Controllable::registered_controllables ( )
static

◆ remove()

static void PBD::Controllable::remove ( Controllable )
staticprivate

◆ set_flag()

void PBD::Controllable::set_flag ( Flag  f)

_flags |= f;

◆ set_flags()

void PBD::Controllable::set_flags ( Flag  f)

◆ set_interface()

virtual void PBD::Controllable::set_interface ( float  fraction,
bool  rotary = false,
GroupControlDisposition  gcd = NoGroup 
)
virtual

◆ set_state()

int PBD::Controllable::set_state ( const XMLNode ,
int  version 
)
virtual

Implements PBD::Stateful.

◆ set_touching()

void PBD::Controllable::set_touching ( bool  yn)
inlineprotected

Definition at line 179 of file controllable.h.

◆ set_value()

virtual void PBD::Controllable::set_value ( double  value,
GroupControlDisposition  group_override 
)
pure virtual

Set ‘internal’ value

All derived classes must implement this.

Basic derived classes will ignore group_override but more sophisticated children, notably those that proxy the value setting logic via an object that is aware of group relationships between this control and others, will find it useful.

Parameters
valueraw numeric value to set
group_overrideif and how to propagate value to grouped controls

Implemented in ARDOUR::RecordEnableControl, TransportControlProvider::TransportControllable, ShuttleControl::ShuttleControllable, ARDOUR::AutomationControl, TimeCtlGUIControllable, ARDOUR::ProxyControllable, ARDOUR::MPControl< T >, ARDOUR::MPControl< gain_t >, ARDOUR::MPControl< bool >, ARDOUR::MPControl< volatile gain_t >, ARDOUR::MPControl< T >, ARDOUR::MPControl< gain_t >, ARDOUR::MPControl< bool >, ARDOUR::MPControl< volatile gain_t >, and VKBDControl.

◆ touching()

bool PBD::Controllable::touching ( ) const
inline

Definition at line 156 of file controllable.h.

◆ upper()

Member Data Documentation

◆ _flags

Flag PBD::Controllable::_flags
private

Definition at line 188 of file controllable.h.

◆ _name

std::string PBD::Controllable::_name
private

Definition at line 186 of file controllable.h.

◆ _touching

bool PBD::Controllable::_touching
private

Definition at line 189 of file controllable.h.

◆ _units

std::string PBD::Controllable::_units
private

Definition at line 187 of file controllable.h.

◆ Changed

PBD::Signal<void(bool,PBD::Controllable::GroupControlDisposition)> PBD::Controllable::Changed

Definition at line 149 of file controllable.h.

◆ ControlTouched

PBD::Signal<void(std::weak_ptr<PBD::Controllable> )> PBD::Controllable::ControlTouched
static

Definition at line 147 of file controllable.h.

◆ GUIFocusChanged

PBD::Signal<void(std::weak_ptr<PBD::Controllable> )> PBD::Controllable::GUIFocusChanged
static

Definition at line 146 of file controllable.h.

◆ LearningFinished

PBD::Signal<void()> PBD::Controllable::LearningFinished

Definition at line 141 of file controllable.h.

◆ registry

Controllables PBD::Controllable::registry
staticprivate

Definition at line 195 of file controllable.h.

◆ registry_connections

ScopedConnectionList PBD::Controllable::registry_connections
staticprivate

Definition at line 193 of file controllable.h.

◆ registry_lock

Glib::Threads::RWLock PBD::Controllable::registry_lock
staticprivate

Definition at line 194 of file controllable.h.

◆ StartLearning

PBD::Signal<bool(std::weak_ptr<PBD::Controllable> )> PBD::Controllable::StartLearning
static

Definition at line 143 of file controllable.h.

◆ StopLearning

PBD::Signal<void(std::weak_ptr<PBD::Controllable> )> PBD::Controllable::StopLearning
static

Definition at line 144 of file controllable.h.

◆ TouchChanged

PBD::Signal<void()> PBD::Controllable::TouchChanged

Definition at line 157 of file controllable.h.

◆ xml_node_name

const std::string PBD::Controllable::xml_node_name
static

Definition at line 176 of file controllable.h.


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