JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
juce_RangedAudioParameter.h
Go to the documentation of this file.
1 /*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
42template <typename Derived, typename Value>
44{
46
47public:
49
51 using ValueFromString = std::function<Value (const String&)>;
52
54 [[nodiscard]] auto withStringFromValueFunction (StringFromValue x) const { return withMember (asDerived(), &Derived::stringFromValue, std::move (x)); }
55
57 [[nodiscard]] auto withValueFromStringFunction (ValueFromString x) const { return withMember (asDerived(), &Derived::valueFromString, std::move (x)); }
58
60 [[nodiscard]] auto withLabel (String x) const { return withMember (asDerived(), &Derived::attributes, attributes.withLabel (std::move (x))); }
61
63 [[nodiscard]] auto withCategory (Category x) const { return withMember (asDerived(), &Derived::attributes, attributes.withCategory (std::move (x))); }
64
66 [[nodiscard]] auto withMeta (bool x) const { return withMember (asDerived(), &Derived::attributes, attributes.withMeta (std::move (x))); }
67
69 [[nodiscard]] auto withAutomatable (bool x) const { return withMember (asDerived(), &Derived::attributes, attributes.withAutomatable (std::move (x))); }
70
72 [[nodiscard]] auto withInverted (bool x) const { return withMember (asDerived(), &Derived::attributes, attributes.withInverted (std::move (x))); }
73
75 [[nodiscard]] const auto& getStringFromValueFunction() const { return stringFromValue; }
76
78 [[nodiscard]] const auto& getValueFromStringFunction() const { return valueFromString; }
79
81 [[nodiscard]] const auto& getAudioProcessorParameterWithIDAttributes() const { return attributes; }
82
83private:
84 auto& asDerived() const { return *static_cast<const Derived*> (this); }
85
86 AudioProcessorParameterWithIDAttributes attributes;
87 StringFromValue stringFromValue;
88 ValueFromString valueFromString;
89};
90
91//==============================================================================
100{
101public:
102 using AudioProcessorParameterWithID::AudioProcessorParameterWithID;
103
106
111 int getNumSteps() const override;
112
114 float convertTo0to1 (float v) const noexcept;
115
117 float convertFrom0to1 (float v) const noexcept;
118};
119
120} // namespace juce
auto withLabel(String x) const
An optional label for the parameter's value.
auto withCategory(Category x) const
The semantics of this parameter.
This abstract base class is used by some AudioProcessorParameter helper classes.
Represents a mapping between an arbitrary range of values and a normalised 0->1 range.
auto withValueFromStringFunction(ValueFromString x) const
An optional lambda function that parses a string and converts it into a non-normalised value.
auto withMeta(bool x) const
See AudioProcessorParameter::isMetaParameter()
auto withCategory(Category x) const
See AudioProcessorParameterWithIDAttributes::withCategory()
auto withAutomatable(bool x) const
See AudioProcessorParameter::isAutomatable()
const auto & getValueFromStringFunction() const
An optional lambda function that parses a string and converts it into a non-normalised value.
const auto & getAudioProcessorParameterWithIDAttributes() const
Gets attributes that would also apply to an AudioProcessorParameterWithID.
auto withStringFromValueFunction(StringFromValue x) const
An optional lambda function that converts a non-normalised value to a string with a maximum length.
const auto & getStringFromValueFunction() const
An optional lambda function that converts a non-normalised value to a string with a maximum length.
auto withInverted(bool x) const
See AudioProcessorParameter::isOrientationInverted()
auto withLabel(String x) const
See AudioProcessorParameterWithIDAttributes::withLabel()
This abstract base class is used by some AudioProcessorParameter helper classes.
virtual const NormalisableRange< float > & getNormalisableRange() const =0
Returns the range of values that the parameter can take.
The JUCE String class!
Definition juce_String.h:53
Represents a shared variant value.
Definition juce_Value.h:51
JUCE Namespace.
Object withMember(Object copy, Member OtherObject::*member, Other &&value)
Copies an object, sets one of the copy's members to the specified value, and then returns the copy.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
Definition juce_Memory.h:88