Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
Bankable/Abstract/MIDIFilteredAnalog.hpp
Go to the documentation of this file.
1#pragma once
2
5#include <Def/Def.hpp>
7
9
10namespace Bankable {
11
20template <class BankAddress, class Sender>
22 protected:
35 const Sender &sender)
37
38 public:
40
41 void update() final override {
44 }
45
48 void forcedUpdate() {
49 sender.send(filteredAnalog.getValue(), address.getActiveAddress());
50 }
51
65
68
73 analog_t getRawValue() const { return filteredAnalog.getRawValue(); }
74
78 static constexpr analog_t getMaxRawValue() {
80 }
81
86 analog_t getValue() const { return filteredAnalog.getValue(); }
87
88 protected:
90 using FilteredAnalog = AH::FilteredAnalog<Sender::precision()>;
92
93 public:
94 Sender sender;
95};
96
97} // namespace Bankable
98
#define END_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
void invert()
Invert the analog value.
void resetToCurrentValue()
Reset the filtered value to the value that's currently being measured at the analog input.
void map(MappingFunction fn)
Specify a mapping function/functor that is applied to the analog value after filtering and before app...
AnalogType getRawValue() const
Read the raw value of the analog input without any filtering or mapping applied, but with its bit dep...
AnalogType getValue() const
Get the filtered value of the analog input (with the mapping function applied).
bool update()
Read the analog input value, apply the mapping function, and update the average.
static constexpr AnalogType getMaxRawValue()
Get the maximum value that can be returned from getRawValue.
A super class for object that have to be updated regularly.
A class for potentiometers and faders that send MIDI events and can be added to a Bank.
void forcedUpdate()
Send the value of the analog input over MIDI, even if the value didn't change.
analog_t getValue() const
Get the value of the analog input (this is the value after first applying the mapping function).
static constexpr analog_t getMaxRawValue()
Get the maximum value that can be returned from getRawValue.
void map(MappingFunction fn)
Specify a mapping function that is applied to the raw analog value before sending.
MIDIFilteredAnalog(BankAddress bankAddress, pin_t analogPin, const Sender &sender)
Construct a new MIDIFilteredAnalog.
void begin() final override
Initialize this updatable.
analog_t getRawValue() const
Get the raw value of the analog input (this is the value without applying the filter or the mapping f...
void update() final override
Update this updatable.
A namespace for MIDI elements that can be added to a Bank, to change their address or channel.
An array wrapper for easy copying, comparing, and iterating.
Definition Array.hpp:32