Repository navigation
Conversation
Checks that a discrete parameter has the same value after restoring a state, whatever value it held beforehand. This fails for parameters that keep the raw normalised value from the host instead of mapping it to a step, e.g. juce::AudioParameterBool. See https://forum.juce.com/t/pluginval-can-set-an-audioparameterbools-to-odd-values/50971
Hosted VST3 and AU parameters return the last value sent by the host until a state is restored. The first parameter's original value could therefore be whatever a previous test sent, not the plugin's own value. Restore the original state once before reading any values.
Some plugins keep in-between values for on/off parameters rather than mapping them to a step (e.g. juce::AudioParameterBool), which made the plugin state restoration test fail at level 6. Arbitrary values are still sent to these parameters at level 8 and above. Hosted VST3 parameters don't report isBoolean, so two-step parameters are identified by their number of steps as well.
The check is documented as running at strictness level 8 and above but compared the test's own level (6) rather than the run's, so it was never executed.
juce::AudioParameterBool::setValue keeps the raw value it is given, so the JUCE demo fails the new test at strictness level 8 and above. Skip that one test for the demo until it is fixed in JUCE.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows up the forum thread Pluginval can set an AudioParameterBools to odd values. The sporadic "Plugin state restoration" failures turn out to be two separate problems, one in plugins and one in pluginval's own test.
1. New test: "Discrete parameter state restoration" (strictness 8)
For each discrete parameter: set a random value, save state, then restore that state twice - once untouched and once after setting a different value - and expect the same value both times.
juce::AudioParameterBool::setValuedoes this in JUCE 9.0.3 (Choice, Int and Float snap).tests/test_plugins/discrete_params/is a minimal repro plugin (3 bools, 2 choices, VST3 + AU on macOS), built withPLUGINVAL_BUILD_TEST_PLUGINS. It is not wired into CTest because it is expected to fail at level 8 until the JUCE bool is fixed.2. Fix: false failures in "Plugin state restoration"
Hosted VST3 and AU parameters return the last value the host sent until a state is restored. The first parameter's
originalValuecould therefore be whatever a previous test sent, not the plugin's value, which is why only the first bool or choice failed for some people. The test now restores the original state once before reading any values.3. Only send 0 or 1 to two-step parameters below strictness 8
Every test that randomises parameter values now goes through
getRandomParameterValue(). Below level 8 it returns 0 or 1 for two-step (on/off) parameters; at 8 and above, and for every other parameter at any level, it returns an arbitrary float as before.isBoolean() || getNumSteps() == 2, because JUCE's hosted VST3 parameters never reportisBoolean().4. Fix: the binary state check in "Plugin state restoration" never ran
The test documents an exact binary state comparison at strictness 8 and above, but the condition read the test's own level (6) instead of the run's, so it has never executed. It now uses
ut.getOptions().strictnessLevel.Results
Against the repro plugin on stock JUCE 9.0.3, 12 seeds x 5 randomised repeats, VST3 and AU:
Before change 3, with 20 randomised repeats at strictness 10:
With the choices declared first and the bool patched, the unfixed existing test failed on Choice 1 in 8 of 12 seeds (VST3).
Notes for review
AudioParameterBoolfails at strictness 8 and above. Both thresholds are open to discussion.--disabled-tests "Discrete parameter state restoration"for that plugin only (VST3 and AU), to be removed once JUCE is fixed.value = convertFrom0to1 (newValue)inAudioParameterBool::setValue, matching Choice/Int/Float. That is not part of this PR.Refs #188