Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions Source/Components/Label.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ bool Label::keyPressed (const juce::KeyPress& key)
{
showEditor();

juce::String keyChar{key.getTextCharacter()};
const double valueAsDouble = value.getValue();

juce::String keyChar;
if (valueAsDouble < 0.0 && key.getTextCharacter() != '-')
keyChar << "-";

keyChar << key.getTextCharacter();

getCurrentTextEditor()->setText (keyChar, false);
Expand All @@ -46,12 +51,13 @@ bool Label::keyPressed (const juce::KeyPress& key)

void Label::editorShown (juce::TextEditor* labelEditor)
{
auto& textEditor = dynamic_cast<TextEditor&> (*labelEditor);

textEditor.clearCharacters();
const double valueAsDouble = value.getValue();
const juce::String str(valueAsDouble, 2);

const juce::String str = textEditor.getText();
textEditor.setHighlightedRegion ({str.contains ("-")? 1 : 0, str.length()});
auto& editor = dynamic_cast<TextEditor&> (*labelEditor);
editor.clearCharacters();
editor.setText(str);
editor.setHighlightedRegion ({str.contains ("-")? 1 : 0, str.length()});
}


Expand Down
8 changes: 7 additions & 1 deletion Source/Helpers/ParameterHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,13 @@ inline std::unique_ptr<juce::RangedAudioParameter> makePrmDb
defaultValue,
attributes
.withLabel(label)
.withStringFromValueFunction([] (const float value, int) { return juce::String (value, 2) + " dB"; })
.withStringFromValueFunction([] (float value, int)
{
// Not a fan of "-0.00 dB"
if (std::abs(value) < 0.005f)
value = 0.0f;
return juce::String (value, 2) + " dB";
})
.withValueFromStringFunction([] (const juce::String& text) { return text.getFloatValue(); })
);
}
Expand Down
2 changes: 1 addition & 1 deletion cmake/pluginval.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function(add_pluginval target)
COMMAND ${PLUGINVAL_WRAPPER} "${PLUGINVAL_EXE}"
--validate "$<GENEX_EVAL:$<TARGET_PROPERTY:${target}_VST3,JUCE_PLUGIN_ARTEFACT_FILE>>"
--strictness-level 5
--timeout-ms 60000
--timeout-ms 120000
DEPENDS "${PLUGINVAL_EXE}" ${target}_VST3
COMMENT "Running pluginval on ${target} VST3"
)
Expand Down
Loading