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