mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
APVTS: Avoid calling null function when unspecified
This commit is contained in:
parent
8ec8e36f5c
commit
34341bc597
1 changed files with 9 additions and 1 deletions
|
|
@ -498,7 +498,7 @@ public:
|
|||
valueRange,
|
||||
defaultParameterValue,
|
||||
AudioProcessorValueTreeStateParameterAttributes().withLabel (labelText)
|
||||
.withStringFromValueFunction ([valueToTextFunction] (float v, int) { return valueToTextFunction (v); })
|
||||
.withStringFromValueFunction (adaptSignature (std::move (valueToTextFunction)))
|
||||
.withValueFromStringFunction (std::move (textToValueFunction))
|
||||
.withMeta (isMetaParameter)
|
||||
.withAutomatable (isAutomatableParameter)
|
||||
|
|
@ -515,6 +515,14 @@ public:
|
|||
bool isBoolean() const override;
|
||||
|
||||
private:
|
||||
static std::function<String (float, int)> adaptSignature (std::function<String (float)> func)
|
||||
{
|
||||
if (func == nullptr)
|
||||
return nullptr;
|
||||
|
||||
return [func = std::move (func)] (float v, int) { return func (v); };
|
||||
}
|
||||
|
||||
void valueChanged (float) override;
|
||||
|
||||
std::function<void()> onValueChanged;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue