FastLED
3.9.7
Loading...
Searching...
No Matches
util.h
1
#ifndef UTIL_H_
2
#define UTIL_H_
3
4
#include <stdint.h>
5
6
#include "./ApproximatingFunction.h"
7
#include "./settings.h"
8
9
#ifndef round
10
#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
11
#endif
// round
12
13
/*
14
// C - 0, C# - 1, D - 2, D# - 3... B - 11.
15
// http://cote.cc/w/wp-content/uploads/drupal/blog/logic-midi-note-numbers.png
16
*/
17
uint8_t FundamentalNote(
int
midi_note);
18
19
float
mapf(
float
x,
float
in_min,
float
in_max,
float
out_min,
float
out_max);
20
21
// Given an input time.
22
float
AttackRemapFactor(uint32_t delta_t_ms);
23
24
float
MapDecayTime(uint8_t key_idx);
25
26
// Returns a value in the range 1->0 indicating how intense the note is. This
27
// value will go to 0 as time progresses, and will be 1 when the note is first
28
// pressed.
29
float
CalcDecayFactor(
bool
sustain_pedal_on,
30
bool
key_on,
31
int
key_idx,
32
float
velocity,
33
bool
dampened_key,
34
float
time_elapsed_ms);
35
36
float
ToBrightness(
int
velocity);
37
38
#endif
// UTIL_H_
examples
LuminescentGrand
shared
util.h
Generated on Fri Dec 20 2024 20:54:48 for FastLED by
1.11.0