Control Surface  1.2.0
MIDI Control Surface library for Arduino
PitchBendSender.hpp
Go to the documentation of this file.
1 #pragma once
2 
5 
7 
19 template <uint8_t INPUT_PRECISION_BITS>
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  MIDIChannelCN channelCN = {address.getChannel(),
29  address.getCableNumber()};
30  Control_Surface.sendPB(channelCN, value);
31  }
32 
34  constexpr static uint8_t precision() {
35  static_assert(INPUT_PRECISION_BITS <= 14,
36  "Maximum pitch bend resolution is 14 bits");
37  return INPUT_PRECISION_BITS;
38  }
39 };
40 
MIDIAddress
A type-safe utility class for saving a MIDI address consisting of a 7-bit address,...
Definition: MIDIAddress.hpp:91
MIDIAddress::getCableNumber
constexpr Cable getCableNumber() const
Get the cable number [CABLE_1, CABLE_16].
Definition: MIDIAddress.hpp:231
MIDIChannelCN
A class for saving a MIDI channel and cable number.
Definition: MIDIAddress.hpp:19
IncreaseBitDepth.hpp
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition: Settings/NamespaceSettings.hpp:9
PitchBendSender::precision
constexpr static uint8_t precision()
Get this sender's precision.
Definition: PitchBendSender.hpp:34
PitchBendSender
Class that sends continuous MIDI pitch bend messages with a resolution of 14 bits.
Definition: PitchBendSender.hpp:20
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition: Settings/NamespaceSettings.hpp:10
Control_Surface_Class.hpp
Control_Surface
Control_Surface_ & Control_Surface
A predefined instance of the Control Surface to use in the Arduino sketches.
Definition: Control_Surface_Class.cpp:203
PitchBendSender::send
static void send(uint16_t value, MIDIAddress address)
Send a MIDI pitch bend message with the given value and channel+CN.
Definition: PitchBendSender.hpp:25
MIDI_Sender::sendPB
void sendPB(MIDIChannelCN address, uint16_t value)
Send a MIDI Pitch Bend event.
Definition: MIDI_Interface.ipp:91
MIDIAddress::getChannel
constexpr Channel getChannel() const
Get the channel [CHANNEL_1, CHANNEL_16].
Definition: MIDIAddress.hpp:226