Control Surface
main
MIDI Control Surface library for Arduino
Toggle main menu visibility
Loading...
Searching...
No Matches
src
MIDI_Senders
ContinuousCCSender.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <
AH/Math/IncreaseBitDepth.hpp
>
4
#include <
Control_Surface/Control_Surface_Class.hpp
>
5
6
BEGIN_CS_NAMESPACE
7
14
class
ContinuousCCSender
{
15
public
:
17
void
send
(uint8_t value,
MIDIAddress
address) {
18
Control_Surface
.sendControlChange(address, value);
19
}
20
22
constexpr
static
uint8_t
precision
() {
return
7; }
23
};
24
36
template
<u
int
8_t INPUT_PRECISION_BITS>
37
class
ContinuousCCSender14
{
38
public
:
42
void
send
(uint16_t value,
MIDIAddress
address) {
43
value =
AH::increaseBitDepth<14, precision(), uint16_t>
(value);
44
Control_Surface
.sendControlChange(address + 0x00, (value >> 7) & 0x7F);
45
Control_Surface
.sendControlChange(address + 0x20, (value >> 0) & 0x7F);
46
}
47
49
constexpr
static
uint8_t
precision
() {
50
static_assert
(INPUT_PRECISION_BITS <= 14,
51
"Maximum resolution is 14 bits"
);
52
return
INPUT_PRECISION_BITS;
53
}
54
};
55
56
END_CS_NAMESPACE
Control_Surface
Control_Surface_ & Control_Surface
A predefined instance of the Control Surface to use in the Arduino sketches.
Definition
Control_Surface_Class.cpp:338
Control_Surface_Class.hpp
IncreaseBitDepth.hpp
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition
Settings/NamespaceSettings.hpp:14
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition
Settings/NamespaceSettings.hpp:11
ContinuousCCSender14
Class that sends continuous MIDI control change messages with a resolution of 14 bits.
Definition
ContinuousCCSender.hpp:37
ContinuousCCSender14::precision
static constexpr uint8_t precision()
Get this sender's precision.
Definition
ContinuousCCSender.hpp:49
ContinuousCCSender14::send
void send(uint16_t value, MIDIAddress address)
Send a 14-bit CC message to the given address.
Definition
ContinuousCCSender.hpp:42
ContinuousCCSender
Class that sends continuous MIDI control change messages with a resolution of 7 bits.
Definition
ContinuousCCSender.hpp:14
ContinuousCCSender::precision
static constexpr uint8_t precision()
Get the resolution of the sender in bits (always returns 7).
Definition
ContinuousCCSender.hpp:22
ContinuousCCSender::send
void send(uint8_t value, MIDIAddress address)
Send a 7-bit CC message to the given address.
Definition
ContinuousCCSender.hpp:17
MIDIAddress
A type-safe utility class for saving a MIDI address consisting of a 7-bit address,...
Definition
MIDIAddress.hpp:145
AH::increaseBitDepth
T_out increaseBitDepth(T_in in)
Increase the bit depth of the given value from Bits_in bits wide to Bits_out bits wide,...
Definition
IncreaseBitDepth.hpp:77
Generated by
1.17.0