-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathModuleInputSmooth.h
More file actions
38 lines (30 loc) · 900 Bytes
/
ModuleInputSmooth.h
File metadata and controls
38 lines (30 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// =============================================================================
//
// This is not a module that you use to build a synth. It gives you the
// ability to smooth inputs:
//
// Before:
// equation_player->equation_input = inputs->mod;
//
// After
// equation_player->equation_input = inputs->mod->smooth;
//
#ifndef ModuleInputSmooth_h
#define ModuleInputSmooth_h
#include "Module.h"
class ModuleInputSmooth : public Module
{
private:
uint16_t compute();
public:
ModuleInputSmooth(Module *parent_module);
// Variables
Module *parent_module;
uint32_t value; // The value of the input
// Smoothing variables
uint16_t readings[8]; // the readings from the analog input
uint16_t index; // the index of the current reading
uint16_t total; // the running total
uint16_t average; // the average
};
#endif