Factory presets.
More...
#include <klang.h>
|
void | operator+= (const Preset &preset) |
|
void | operator= (const Presets &presets) |
|
void | operator= (std::initializer_list< Preset > presets) |
|
template<typename... Values> |
void | add (const char *name, const Values... values) |
|
unsigned int | size () const |
| The current number of items in the array.
|
|
void | add (const Preset &item) |
| Add the specified item to the end of the array.
|
|
Preset * | add () |
| Add a blank item to the end of the array, returning a pointer that allows the item to be modified.
|
|
void | clear () |
| Clear the array contents. Only resets the item count, without wiping memory.
|
|
float | max () const |
| Find the maximum value in the array.
|
|
float | mean () const |
| Find the mean average of values in the array.
|
|
float | rms () const |
| Find the root mean squared (RMS) average of values in the array.
|
|
void | normalise (float target=1.f, int mode=Peak) |
| Normalises values in the array to the specified target, based on peak, mean, or RMS value;.
|
|
Preset & | operator[] (int index) |
| Returns a reference to the array item at the given index.
|
|
const Preset & | operator[] (int index) const |
| Returns a read-only reference to the array item at the given index.
|
|
|
static int | capacity () |
| The maximum capacity of the array.
|
|
Definition at line 1160 of file klang.h.
◆ add() [1/3]
Definition at line 255 of file klang.h.
255 {
256 if (
count < CAPACITY)
258 return nullptr;
259 }
◆ add() [2/3]
◆ add() [3/3]
template<typename... Values>
void klang::Presets::add |
( |
const char * | name, |
|
|
const Values... | values ) |
|
inline |
Definition at line 1176 of file klang.h.
1176 {
1178
1179 const float preset[] = { values... };
1180 int nbValues = sizeof...(values);
1181 for(int p=0; p<nbValues; p++)
1184 }
◆ capacity()
◆ clear()
◆ max()
Definition at line 265 of file klang.h.
265 {
267 for (
unsigned int i = 0; i <
count; i++)
271 }
◆ mean()
Definition at line 274 of file klang.h.
274 {
275 float sum = 0.f;
276 for (
unsigned int i = 0; i <
count; i++)
277 sum += abs(
items[i]);
279 }
◆ normalise()
Definition at line 290 of file klang.h.
290 {
292
294 const float scale = current == 0.f ? 0.f : target / current;
295 for (
int i = 0; i <
count; i++)
297 }
◆ operator+=()
void klang::Presets::operator+= |
( |
const Preset & | preset | ) |
|
|
inline |
◆ operator=() [1/2]
void klang::Presets::operator= |
( |
const Presets & | presets | ) |
|
|
inline |
◆ operator=() [2/2]
void klang::Presets::operator= |
( |
std::initializer_list< Preset > | presets | ) |
|
|
inline |
Definition at line 1170 of file klang.h.
1170 {
1171 for(auto preset : presets)
1173 }
void operator+=(const Preset &preset)
References operator+=().
◆ operator[]() [1/2]
◆ operator[]() [2/2]
◆ rms()
Definition at line 282 of file klang.h.
282 {
283 float sum = 0.f;
284 for (
unsigned int i = 0; i <
count; i++)
286 return sqrt(sum /
count);
287 }
◆ size()
◆ count
◆ items