mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-19 21:26:26 +01:00
fix ladpsa default value.
because get_parameter_descriptor() is const, also wrap default_value() in a const function.
This commit is contained in:
parent
cf859270e0
commit
bd85c8ec43
2 changed files with 15 additions and 3 deletions
|
|
@ -49,7 +49,7 @@ class LIBARDOUR_API LadspaPlugin : public ARDOUR::Plugin
|
||||||
const char* name() const { return _descriptor->Name; }
|
const char* name() const { return _descriptor->Name; }
|
||||||
const char* maker() const { return _descriptor->Maker; }
|
const char* maker() const { return _descriptor->Maker; }
|
||||||
uint32_t parameter_count() const { return _descriptor->PortCount; }
|
uint32_t parameter_count() const { return _descriptor->PortCount; }
|
||||||
float default_value (uint32_t port);
|
float default_value (uint32_t port) { return _default_value (port); }
|
||||||
framecnt_t signal_latency() const;
|
framecnt_t signal_latency() const;
|
||||||
void set_parameter (uint32_t port, float val);
|
void set_parameter (uint32_t port, float val);
|
||||||
float get_parameter (uint32_t port) const;
|
float get_parameter (uint32_t port) const;
|
||||||
|
|
@ -121,6 +121,7 @@ class LIBARDOUR_API LadspaPlugin : public ARDOUR::Plugin
|
||||||
void connect_port (uint32_t port, float *ptr) { _descriptor->connect_port (_handle, port, ptr); }
|
void connect_port (uint32_t port, float *ptr) { _descriptor->connect_port (_handle, port, ptr); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
float _default_value (uint32_t port) const;
|
||||||
std::string _module_path;
|
std::string _module_path;
|
||||||
Glib::Module* _module;
|
Glib::Module* _module;
|
||||||
const LADSPA_Descriptor* _descriptor;
|
const LADSPA_Descriptor* _descriptor;
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ LadspaPlugin::init (string module_path, uint32_t index, framecnt_t rate)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
_shadow_data[i] = default_value (i);
|
_shadow_data[i] = _default_value (i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -173,7 +173,7 @@ LadspaPlugin::unique_id() const
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
LadspaPlugin::default_value (uint32_t port)
|
LadspaPlugin::_default_value (uint32_t port) const
|
||||||
{
|
{
|
||||||
const LADSPA_PortRangeHint *prh = port_range_hints();
|
const LADSPA_PortRangeHint *prh = port_range_hints();
|
||||||
float ret = 0.0f;
|
float ret = 0.0f;
|
||||||
|
|
@ -515,6 +515,17 @@ LadspaPlugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor& des
|
||||||
desc.largestep = delta/10.0f;
|
desc.largestep = delta/10.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (LADSPA_IS_HINT_HAS_DEFAULT (prh.HintDescriptor)) {
|
||||||
|
desc.normal = _default_value(which);
|
||||||
|
} else {
|
||||||
|
/* if there is no explicit hint for the default
|
||||||
|
* value, use lower bound. This is not great but
|
||||||
|
* better than just assuming '0' which may be out-of range.
|
||||||
|
*/
|
||||||
|
desc.normal = desc.lower;
|
||||||
|
}
|
||||||
|
|
||||||
desc.toggled = LADSPA_IS_HINT_TOGGLED (prh.HintDescriptor);
|
desc.toggled = LADSPA_IS_HINT_TOGGLED (prh.HintDescriptor);
|
||||||
desc.logarithmic = LADSPA_IS_HINT_LOGARITHMIC (prh.HintDescriptor);
|
desc.logarithmic = LADSPA_IS_HINT_LOGARITHMIC (prh.HintDescriptor);
|
||||||
desc.sr_dependent = LADSPA_IS_HINT_SAMPLE_RATE (prh.HintDescriptor);
|
desc.sr_dependent = LADSPA_IS_HINT_SAMPLE_RATE (prh.HintDescriptor);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue