OpenShot Audio Library | OpenShotAudio: juce::NormalisableRange< ValueType > Class Template Reference

OpenShot Audio Library | OpenShotAudio 0.6.0

Loading...
Searching...
No Matches
juce::NormalisableRange< ValueType > Class Template Reference

`#include <juce_NormalisableRange.h>`

## Public Types
using | ValueRemapFunction

## Public Member Functions
| NormalisableRange ()=default
| NormalisableRange (const NormalisableRange &)=default
NormalisableRange & | operator= (const NormalisableRange &)=default
| NormalisableRange (NormalisableRange &&)=default
NormalisableRange & | operator= (NormalisableRange &&)=default
| NormalisableRange (ValueType rangeStart, ValueType rangeEnd, ValueType intervalValue, ValueType skewFactor, bool useSymmetricSkew=false) noexcept
| NormalisableRange (ValueType rangeStart, ValueType rangeEnd) noexcept
| NormalisableRange (ValueType rangeStart, ValueType rangeEnd, ValueType intervalValue) noexcept
| NormalisableRange (Range< ValueType > range) noexcept
| NormalisableRange (Range< ValueType > range, ValueType intervalValue) noexcept
| NormalisableRange (ValueType rangeStart, ValueType rangeEnd, ValueRemapFunction convertFrom0To1Func, ValueRemapFunction convertTo0To1Func, ValueRemapFunction snapToLegalValueFunc={}) noexcept
ValueType | convertTo0to1 (ValueType v) const noexcept
ValueType | convertFrom0to1 (ValueType proportion) const noexcept
ValueType | snapToLegalValue (ValueType v) const noexcept
Range< ValueType > | getRange () const noexcept
void | setSkewForCentre (ValueType centrePointValue) noexcept

## Public Attributes
ValueType | start = 0
ValueType | end = 1
ValueType | interval = 0
ValueType | skew = 1
bool | symmetricSkew = false

## Detailed Description

template<typename ValueType>
class juce::NormalisableRange< ValueType >

Represents a mapping between an arbitrary range of values and a normalised 0->1 range.

The properties of the mapping also include an optional snapping interval and skew-factor.

See also
  Range

Definition at line 39 of file juce_NormalisableRange.h.

## Member Typedef Documentation

## ◆ ValueRemapFunction

template<typename ValueType>

using juce::NormalisableRange< ValueType >::ValueRemapFunction

Initial value:
std::function<ValueType(ValueType rangeStart,
ValueType rangeEnd,
ValueType valueToRemap)>

A function object which can remap a value in some way based on the start and end of a range.

Definition at line 92 of file juce_NormalisableRange.h.

## Constructor & Destructor Documentation

## ◆ NormalisableRange() [1/7]

template<typename ValueType>

juce::NormalisableRange< ValueType >::NormalisableRange | ( |  | ) |
| default

Creates a continuous range that performs a dummy mapping.

Referenced by NormalisableRange().

## ◆ NormalisableRange() [2/7]

template<typename ValueType>

juce::NormalisableRange< ValueType >::NormalisableRange | ( | ValueType | rangeStart,
|  | ValueType | rangeEnd,
|  | ValueType | intervalValue,
|  | ValueType | skewFactor,
|  | bool | useSymmetricSkew = false )
| inlinenoexcept

Creates a NormalisableRange with a given range, interval and skew factor.

Definition at line 51 of file juce_NormalisableRange.h.

## ◆ NormalisableRange() [3/7]

template<typename ValueType>

juce::NormalisableRange< ValueType >::NormalisableRange | ( | ValueType | rangeStart,
|  | ValueType | rangeEnd )
| inlinenoexcept

Creates a NormalisableRange with a given range, continuous interval, but a dummy skew-factor.

Definition at line 63 of file juce_NormalisableRange.h.

## ◆ NormalisableRange() [4/7]

template<typename ValueType>

juce::NormalisableRange< ValueType >::NormalisableRange | ( | ValueType | rangeStart,
|  | ValueType | rangeEnd,
|  | ValueType | intervalValue )
| inlinenoexcept

Creates a NormalisableRange with a given range and interval, but a dummy skew-factor.

Definition at line 71 of file juce_NormalisableRange.h.

## ◆ NormalisableRange() [5/7]

template<typename ValueType>

juce::NormalisableRange< ValueType >::NormalisableRange | ( | Range< ValueType > | range | ) |
| inlinenoexcept

Creates a NormalisableRange with a given range, continuous interval, but a dummy skew-factor.

Definition at line 80 of file juce_NormalisableRange.h.

## ◆ NormalisableRange() [6/7]

template<typename ValueType>

juce::NormalisableRange< ValueType >::NormalisableRange | ( | Range< ValueType > | range,
|  | ValueType | intervalValue )
| inlinenoexcept

Creates a NormalisableRange with a given range and interval, but a dummy skew-factor.

Definition at line 86 of file juce_NormalisableRange.h.

## ◆ NormalisableRange() [7/7]

template<typename ValueType>

juce::NormalisableRange< ValueType >::NormalisableRange | ( | ValueType | rangeStart,
|  | ValueType | rangeEnd,
|  | ValueRemapFunction | convertFrom0To1Func,
|  | ValueRemapFunction | convertTo0To1Func,
|  | ValueRemapFunction | snapToLegalValueFunc = {} )
| inlinenoexcept

Creates a NormalisableRange with a given range and an injective mapping function.

Parameters

  rangeStart | The minimum value in the range.
  rangeEnd | The maximum value in the range.
  convertFrom0To1Func | A function which uses the current start and end of this NormalisableRange and produces a mapped value from a normalised value.
  convertTo0To1Func | A function which uses the current start and end of this NormalisableRange and produces a normalised value from a mapped value.
  snapToLegalValueFunc | A function which uses the current start and end of this NormalisableRange to take a mapped value and snap it to the nearest legal value.

Definition at line 107 of file juce_NormalisableRange.h.

## Member Function Documentation

## ◆ convertFrom0to1()

template<typename ValueType>

ValueType juce::NormalisableRange< ValueType >::convertFrom0to1 | ( | ValueType | proportion | ) | const
| inlinenoexcept

Uses the properties of this mapping to convert a normalised 0->1 value to its full-range representation.

Definition at line 148 of file juce_NormalisableRange.h.

## ◆ convertTo0to1()

template<typename ValueType>

ValueType juce::NormalisableRange< ValueType >::convertTo0to1 | ( | ValueType | v | ) | const
| inlinenoexcept

Uses the properties of this mapping to convert a non-normalised value to its 0->1 representation.

Definition at line 124 of file juce_NormalisableRange.h.

## ◆ getRange()

template<typename ValueType>

Range< ValueType > juce::NormalisableRange< ValueType >::getRange | ( |  | ) | const
| inlinenoexcept

Returns the extent of the normalisable range.

Definition at line 188 of file juce_NormalisableRange.h.

## ◆ setSkewForCentre()

template<typename ValueType>

void juce::NormalisableRange< ValueType >::setSkewForCentre | ( | ValueType | centrePointValue | ) |
| inlinenoexcept

Given a value which is between the start and end points, this sets the skew such that convertFrom0to1 (0.5) will return this value.

If you have used lambda functions for convertFrom0to1Func and convertFrom0to1Func in the constructor of this class then the skew value is ignored.

Parameters

  centrePointValue | this must be greater than the start of the range and less than the end.

Definition at line 198 of file juce_NormalisableRange.h.

## ◆ snapToLegalValue()

template<typename ValueType>

ValueType juce::NormalisableRange< ValueType >::snapToLegalValue | ( | ValueType | v | ) | const
| inlinenoexcept

Takes a non-normalised value and snaps it based on either the interval property of this NormalisableRange or the lambda function supplied to the constructor.

Definition at line 176 of file juce_NormalisableRange.h.

## Member Data Documentation

## ◆ end

template<typename ValueType>

ValueType juce::NormalisableRange< ValueType >::end = 1

The maximum value of the non-normalised range.

Definition at line 212 of file juce_NormalisableRange.h.

Referenced by convertFrom0to1(), convertTo0to1(), getRange(), NormalisableRange(), setSkewForCentre(), and snapToLegalValue().

## ◆ interval

template<typename ValueType>

ValueType juce::NormalisableRange< ValueType >::interval = 0

The snapping interval that should be used (for a non-normalised value). Use 0 for a continuous range.

If you have used a lambda function for snapToLegalValueFunction in the constructor of this class then the interval is ignored.

Definition at line 220 of file juce_NormalisableRange.h.

Referenced by NormalisableRange(), and snapToLegalValue().

## ◆ skew

template<typename ValueType>

ValueType juce::NormalisableRange< ValueType >::skew = 1

An optional skew factor that alters the way values are distribute across the range.

The skew factor lets you skew the mapping logarithmically so that larger or smaller values are given a larger proportion of the available space.

A factor of 1.0 has no skewing effect at all. If the factor is < 1.0, the lower end of the range will fill more of the slider's length; if the factor is > 1.0, the upper end of the range will be expanded.

If you have used lambda functions for convertFrom0to1Func and convertFrom0to1Func in the constructor of this class then the skew value is ignored.

Definition at line 234 of file juce_NormalisableRange.h.

Referenced by convertFrom0to1(), convertTo0to1(), NormalisableRange(), and setSkewForCentre().

## ◆ start

template<typename ValueType>

ValueType juce::NormalisableRange< ValueType >::start = 0

The minimum value of the non-normalised range.

Definition at line 209 of file juce_NormalisableRange.h.

Referenced by convertFrom0to1(), convertTo0to1(), getRange(), NormalisableRange(), setSkewForCentre(), and snapToLegalValue().

## ◆ symmetricSkew

template<typename ValueType>

bool juce::NormalisableRange< ValueType >::symmetricSkew = false

If true, the skew factor applies from the middle of the slider to each of its ends.

Definition at line 237 of file juce_NormalisableRange.h.

Referenced by convertFrom0to1(), convertTo0to1(), NormalisableRange(), and setSkewForCentre().

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

- juce_NormalisableRange.h