Control Surface
main
MIDI Control Surface library for Arduino
Toggle main menu visibility
Loading...
Searching...
No Matches
src
MIDI_Senders
PitchBendSender.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
19
template
<u
int
8_t INPUT_PRECISION_BITS>
20
class
PitchBendSender
{
21
public
:
25
static
void
send
(uint16_t value,
MIDIAddress
address) {
26
value =
AH::increaseBitDepth<14, precision(), uint16_t>
(value);
27
// ignore address byte, just use channel and cable numbers
28
MIDIChannelCable
channelCN = address.
getChannelCable
();
29
Control_Surface
.sendPitchBend(channelCN, value);
30
}
31
33
constexpr
static
uint8_t
precision
() {
34
static_assert
(INPUT_PRECISION_BITS <= 14,
35
"Maximum pitch bend resolution is 14 bits"
);
36
return
INPUT_PRECISION_BITS;
37
}
38
};
39
40
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
MIDIAddress
A type-safe utility class for saving a MIDI address consisting of a 7-bit address,...
Definition
MIDIAddress.hpp:145
MIDIAddress::getChannelCable
constexpr MIDIChannelCable getChannelCable() const
Get the channel and cable number.
Definition
MIDIAddress.hpp:293
MIDIChannelCable
A class for saving a MIDI channel and cable number.
Definition
MIDIAddress.hpp:24
PitchBendSender
Class that sends continuous MIDI pitch bend messages with a resolution of 14 bits.
Definition
PitchBendSender.hpp:20
PitchBendSender::precision
static constexpr uint8_t precision()
Get this sender's precision.
Definition
PitchBendSender.hpp:33
PitchBendSender::send
static void send(uint16_t value, MIDIAddress address)
Send a MIDI pitch bend message with the given value and channel+cable.
Definition
PitchBendSender.hpp:25
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