Audacity 3.2.0
Functions
anonymous_namespace{LadspaEffect.cpp} Namespace Reference

Functions

bool LoadUseLatency (const EffectDefinitionInterface &effect)
 
bool SaveUseLatency (const EffectDefinitionInterface &effect, bool value)
 
std::pair< float, float > InputControlPortBounds (const LADSPA_PortRangeHint &hint, double sampleRate)
 
float ClampInputControlValue (const LADSPA_PortRangeHint &hint, float val, float lower, float upper)
 
float InputControlPortDefaultValue (const LADSPA_PortRangeHint &hint, double sampleRate)
 

Function Documentation

◆ ClampInputControlValue()

float anonymous_namespace{LadspaEffect.cpp}::ClampInputControlValue ( const LADSPA_PortRangeHint hint,
float  val,
float  lower,
float  upper 
)

Definition at line 807 of file LadspaEffect.cpp.

809{
810 if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor) && val < lower)
811 val = lower;
812 if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor) && val > upper)
813 val = upper;
814 return val;
815}
#define LADSPA_IS_HINT_BOUNDED_BELOW(x)
Definition: ladspa.h:310
#define LADSPA_IS_HINT_BOUNDED_ABOVE(x)
Definition: ladspa.h:311
LADSPA_PortRangeHintDescriptor HintDescriptor
Definition: ladspa.h:340

References _LADSPA_PortRangeHint::HintDescriptor, LADSPA_IS_HINT_BOUNDED_ABOVE, and LADSPA_IS_HINT_BOUNDED_BELOW.

Referenced by InputControlPortDefaultValue().

Here is the caller graph for this function:

◆ InputControlPortBounds()

std::pair< float, float > anonymous_namespace{LadspaEffect.cpp}::InputControlPortBounds ( const LADSPA_PortRangeHint hint,
double  sampleRate 
)

Definition at line 800 of file LadspaEffect.cpp.

801{
802 // Find lower and upper bound values for ths hint
803 const auto multiplier =
804 LADSPA_IS_HINT_SAMPLE_RATE(hint.HintDescriptor) ? sampleRate : 1.0;
805 return { hint.LowerBound * multiplier, hint.UpperBound * multiplier };
806}
#define LADSPA_IS_HINT_SAMPLE_RATE(x)
Definition: ladspa.h:313
LADSPA_Data LowerBound
Definition: ladspa.h:345
LADSPA_Data UpperBound
Definition: ladspa.h:350

References _LADSPA_PortRangeHint::HintDescriptor, LADSPA_IS_HINT_SAMPLE_RATE, _LADSPA_PortRangeHint::LowerBound, and _LADSPA_PortRangeHint::UpperBound.

Referenced by InputControlPortDefaultValue().

Here is the caller graph for this function:

◆ InputControlPortDefaultValue()

float anonymous_namespace{LadspaEffect.cpp}::InputControlPortDefaultValue ( const LADSPA_PortRangeHint hint,
double  sampleRate 
)

Definition at line 816 of file LadspaEffect.cpp.

818{
819 // See comments in library header ladspa.h about interpretation of macros
820 const auto bounds = InputControlPortBounds(hint, sampleRate);
821
822 // Function to find low, middle, or high default values
823 const auto combine = [bounds,
825 ](float lowWeight, float highWeight){
826 auto [lower, upper] = bounds;
827 return logarithmic
828 ? exp(log(lower) * lowWeight + log(upper) * highWeight)
829 : lower * lowWeight + upper * highWeight;
830 };
831
832 auto [lower, upper] = bounds;
833 auto val = 1.0f;
834 // Four bits of the descriptor describe mutually exclusive cases
837 default:
838 break;
840 val = lower; break;
842 val = combine(0.75, 0.25); break;
844 val = combine(0.5, 0.5); break;
846 val = combine(0.25, 0.75); break;
848 val = upper; break;
850 val = 0.0f; break;
852 val = 1.0f; break;
854 val = 100.0f; break;
856 val = 440.0f; break;
857 }
858
859 return ClampInputControlValue(hint, val, lower, upper);
860}
#define LADSPA_HINT_DEFAULT_100
Definition: ladspa.h:303
#define LADSPA_HINT_DEFAULT_MAXIMUM
Definition: ladspa.h:290
#define LADSPA_HINT_DEFAULT_440
Definition: ladspa.h:308
#define LADSPA_HINT_DEFAULT_LOW
Definition: ladspa.h:272
#define LADSPA_HINT_DEFAULT_0
Definition: ladspa.h:295
#define LADSPA_IS_HINT_LOGARITHMIC(x)
Definition: ladspa.h:314
#define LADSPA_HINT_DEFAULT_HIGH
Definition: ladspa.h:286
#define LADSPA_HINT_DEFAULT_MASK
Definition: ladspa.h:258
#define LADSPA_HINT_DEFAULT_MIDDLE
Definition: ladspa.h:279
#define LADSPA_HINT_DEFAULT_1
Definition: ladspa.h:300
#define LADSPA_HINT_DEFAULT_MINIMUM
Definition: ladspa.h:265
#define LADSPA_HINT_DEFAULT_NONE
Definition: ladspa.h:261
std::pair< float, float > InputControlPortBounds(const LADSPA_PortRangeHint &hint, double sampleRate)
float ClampInputControlValue(const LADSPA_PortRangeHint &hint, float val, float lower, float upper)

References ClampInputControlValue(), _LADSPA_PortRangeHint::HintDescriptor, InputControlPortBounds(), LADSPA_HINT_DEFAULT_0, LADSPA_HINT_DEFAULT_1, LADSPA_HINT_DEFAULT_100, LADSPA_HINT_DEFAULT_440, LADSPA_HINT_DEFAULT_HIGH, LADSPA_HINT_DEFAULT_LOW, LADSPA_HINT_DEFAULT_MASK, LADSPA_HINT_DEFAULT_MAXIMUM, LADSPA_HINT_DEFAULT_MIDDLE, LADSPA_HINT_DEFAULT_MINIMUM, LADSPA_HINT_DEFAULT_NONE, and LADSPA_IS_HINT_LOGARITHMIC.

Referenced by LadspaEffect::InitializeControls().

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

◆ LoadUseLatency()

bool anonymous_namespace{LadspaEffect.cpp}::LoadUseLatency ( const EffectDefinitionInterface effect)

Definition at line 501 of file LadspaEffect.cpp.

502{
503 bool result{};
505 OptionsKey, UseLatencyKey, result, true /* default value */);
506 return result;
507}
static const wchar_t * UseLatencyKey
static const wchar_t * OptionsKey
bool GetConfig(const EffectDefinitionInterface &ident, ConfigurationType type, const RegistryPath &group, const RegistryPath &key, Value &var, const Value &defval)

References PluginSettings::GetConfig(), OptionsKey, PluginSettings::Shared, and UseLatencyKey.

Here is the call graph for this function:

◆ SaveUseLatency()

bool anonymous_namespace{LadspaEffect.cpp}::SaveUseLatency ( const EffectDefinitionInterface effect,
bool  value 
)

Definition at line 509 of file LadspaEffect.cpp.

510{
511 return SetConfig(
513}
bool SetConfig(const EffectDefinitionInterface &ident, ConfigurationType type, const RegistryPath &group, const RegistryPath &key, const Value &value)

References OptionsKey, PluginSettings::SetConfig(), PluginSettings::Shared, and UseLatencyKey.

Referenced by LadspaEffectOptionsDialog::OnOk().

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