Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
zrythm::dsp::ParameterRange Class Reference

Public Types

enum class  Type : std::uint8_t {
  Linear , Toggle , Integer , GainAmplitude ,
  Logarithmic , Enumeration , Trigger
}
enum class  Unit : std::uint8_t {
  None , Hz , MHz , Db ,
  Degrees , Seconds , Ms , Us
}
 Unit to be displayed in the UI. More...

Public Member Functions

 ParameterRange (Type type, float min, float max, float zero=0.f, float def=0.f)
constexpr float clamp_to_range (float val) const
Q_INVOKABLE float convertFrom0To1 (float normalized_val) const
Q_INVOKABLE float convertTo0To1 (float real_val) const
bool is_toggled (float normalized_val) const

Static Public Member Functions

static utils::Utf8String unit_to_string (Unit unit)
static ParameterRange make_toggle (bool default_val)
static ParameterRange make_gain (float max_val)

Data Fields

Type type_ { Type::Linear }
Unit unit_ {}
 Parameter unit.
float minf_ { 0.f }
 Minimum, maximum and zero values for this parameter.
float maxf_ { 1.f }
float zerof_ { 0.f }
 The zero position of the port.
float deff_ { 0.f }
 Default value.

Friends

void to_json (nlohmann::json &j, const ParameterRange &p)
void from_json (const nlohmann::json &j, ParameterRange &p)

Detailed Description

Definition at line 20 of file parameter.h.

Member Enumeration Documentation

◆ Type

enum class zrythm::dsp::ParameterRange::Type : std::uint8_t
strong
Enumerator
Linear 

Linearly-scaled float parameter.

Toggle 

Whether the port is a toggle (on/off).

See also
Trigger
Integer 

Whether the port is an integer.

GainAmplitude 

Parameter is a gain amplitude (0-2.0).

Note
This is a special logarithmic-scaled parameter for gain parameters.
Logarithmic 

Logarithmic-scaled float parameter.

Enumeration 

Port's only reasonable values are its scale points.

Trigger 

Trigger parameters are set to on to trigger a change during processing and then turned off at the end of each cycle.

Used trigger eg, transport play/pause.

Definition at line 25 of file parameter.h.

◆ Unit

enum class zrythm::dsp::ParameterRange::Unit : std::uint8_t
strong

Unit to be displayed in the UI.

Enumerator
Ms 

Milliseconds.

Us 

Microseconds.

Definition at line 68 of file parameter.h.

Constructor & Destructor Documentation

◆ ParameterRange()

zrythm::dsp::ParameterRange::ParameterRange ( Type type,
float min,
float max,
float zero = 0.f,
float def = 0.f )
inline

Definition at line 95 of file parameter.h.

Member Function Documentation

◆ clamp_to_range()

float zrythm::dsp::ParameterRange::clamp_to_range ( float val) const
inlineconstexpr

Definition at line 110 of file parameter.h.

◆ convertFrom0To1()

Q_INVOKABLE float zrythm::dsp::ParameterRange::convertFrom0To1 ( float normalized_val) const
inline

Definition at line 115 of file parameter.h.

◆ convertTo0To1()

Q_INVOKABLE float zrythm::dsp::ParameterRange::convertTo0To1 ( float real_val) const
inline

Definition at line 141 of file parameter.h.

◆ is_toggled()

bool zrythm::dsp::ParameterRange::is_toggled ( float normalized_val) const
inline

Definition at line 168 of file parameter.h.

◆ make_gain()

ParameterRange zrythm::dsp::ParameterRange::make_gain ( float max_val)
inlinestatic

Definition at line 105 of file parameter.h.

◆ make_toggle()

ParameterRange zrythm::dsp::ParameterRange::make_toggle ( bool default_val)
inlinestatic

Definition at line 101 of file parameter.h.

◆ unit_to_string()

utils::Utf8String zrythm::dsp::ParameterRange::unit_to_string ( Unit unit)
inlinestatic

Definition at line 84 of file parameter.h.

Field Documentation

◆ deff_

float zrythm::dsp::ParameterRange::deff_ { 0.f }

Default value.

Definition at line 199 of file parameter.h.

◆ maxf_

float zrythm::dsp::ParameterRange::maxf_ { 1.f }

Definition at line 187 of file parameter.h.

◆ minf_

float zrythm::dsp::ParameterRange::minf_ { 0.f }

Minimum, maximum and zero values for this parameter.

Definition at line 186 of file parameter.h.

◆ type_

Type zrythm::dsp::ParameterRange::type_ { Type::Linear }

Definition at line 178 of file parameter.h.

◆ unit_

Unit zrythm::dsp::ParameterRange::unit_ {}

Parameter unit.

Definition at line 181 of file parameter.h.

◆ zerof_

float zrythm::dsp::ParameterRange::zerof_ { 0.f }

The zero position of the port.

For example, in balance controls, this will be the middle.

Definition at line 194 of file parameter.h.


The documentation for this class was generated from the following file: