mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
APVTS: Update an example in the docs to reflect best practices for constructing ParameterLayouts
This commit is contained in:
parent
ccbe0816d0
commit
72c1914004
1 changed files with 5 additions and 5 deletions
|
|
@ -176,18 +176,18 @@ public:
|
|||
std::make_unique<AudioParameterInt> ("b", "Parameter B", 0, 5, 2) })
|
||||
@endcode
|
||||
|
||||
To add parameters programatically you can use the iterator-based ParameterLayout
|
||||
constructor:
|
||||
To add parameters programatically you can call `add` repeatedly on a
|
||||
ParameterLayout instance:
|
||||
|
||||
@code
|
||||
AudioProcessorValueTreeState::ParameterLayout createParameterLayout()
|
||||
{
|
||||
std::vector<std::unique_ptr<AudioParameterInt>> params;
|
||||
AudioProcessorValueTreeState::ParameterLayout layout;
|
||||
|
||||
for (int i = 1; i < 9; ++i)
|
||||
params.push_back (std::make_unique<AudioParameterInt> (String (i), String (i), 0, i, 0));
|
||||
layout.add (std::make_unique<AudioParameterInt> (String (i), String (i), 0, i, 0));
|
||||
|
||||
return { params.begin(), params.end() };
|
||||
return layout;
|
||||
}
|
||||
|
||||
YourAudioProcessor()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue