fsh::stk
fantastic spatial holophonic synthesis toolkit
Loading...
Searching...
No Matches
ParamFloat.h
1/***************************************************************************************************
2 ██████ █████ █████ █████
3 ███░░███ ░░███ ░░███ ░░███
4 ░███ ░░░ █████ ░███████ ██ ██ █████ ███████ ░███ █████
5 ███████ ███░░ ░███░░███ ░░ ░░ ███░░ ░░░███░ ░███░░███
6 ░░░███░ ░░█████ ░███ ░███ ░░█████ ░███ ░██████░
7 ░███ ░░░░███ ░███ ░███ ░░░░███ ░███ ███ ░███░░███
8 █████ ██████ ████ █████ ██ ██ ██████ ░░█████ ████ █████
9 ░░░░░ ░░░░░░ ░░░░ ░░░░░ ░░ ░░ ░░░░░░ ░░░░░ ░░░░ ░░░░░
10
11 fantastic spatial holophonic synthesis tool kit
12
13 copyright (c) fabian hummel
14 www.github.com/fshstk
15 www.fshstk.com
16
17 this file is part of the fantastic spatial holophonic synthesis toolkit (fsh::stk)
18 fsh::stk is free software: it is provided under the terms of the gnu general public license v3.0
19 www.gnu.org/licenses/gpl-3.0
20***************************************************************************************************/
21
22#pragma once
23#include <cmath>
24#include <juce_audio_processors/juce_audio_processors.h>
25
26namespace fsh::plugin
27{
45{
47 using Range = juce::NormalisableRange<float>;
48
50 using Attributes = juce::AudioParameterFloatAttributes;
51
52 juce::ParameterID id;
53 juce::String name;
55 float defaultVal = 0.0;
57
59 static Range freqRange(float min = 20.0f, float max = 20'000.0f, float interval = 1.0f)
60 {
61 const auto geometricMean = sqrtf(min * max);
62 const auto skew = logf(0.5) / logf((geometricMean - min) / (max - min));
63 return Range{ min, max, interval, skew };
64 }
65
67 auto create() const
68 {
69 return std::make_unique<juce::AudioParameterFloat>(id, name, range, defaultVal, attributes);
70 }
71};
72} // namespace fsh::plugin
Used to add a floating point parameter to a plugin.
Definition ParamFloat.h:45
juce::NormalisableRange< float > Range
Used to specify the parameter's range. See the JUCE docs for details.
Definition ParamFloat.h:47
Attributes attributes
The parameter's attributes, e.g. a label.
Definition ParamFloat.h:56
juce::String name
The parameter's name, displayed in the DAW's automation.
Definition ParamFloat.h:53
juce::AudioParameterFloatAttributes Attributes
Used to specify the parameter's attributes, e.g. a label. See the JUCE docs for details.
Definition ParamFloat.h:50
juce::ParameterID id
The parameter's unique ID, used to identify it in the DAW.
Definition ParamFloat.h:52
Range range
The parameter's range, including optional step size and skew factor.
Definition ParamFloat.h:54
static Range freqRange(float min=20.0f, float max=20 '000.0f, float interval=1.0f)
Returns a range with a skew factor that is suitable for logarithmic frequency sliders in audio.
Definition ParamFloat.h:59
float defaultVal
The parameter's default value.
Definition ParamFloat.h:55
auto create() const
Creates a juce::AudioParameterFloat object from the given parameters.
Definition ParamFloat.h:67