Control Surface  1.1.1
MIDI Control Surface library for Arduino
PitchBendSender.hpp
Go to the documentation of this file.
1 #pragma once
2 
5 
7 
8 template <uint8_t INPUT_PRECISION_BITS>
10  public:
11  static void send(uint16_t value, MIDICNChannelAddress address) {
12  value =
13  AH::increaseBitDepth<14, precision(), uint16_t, uint16_t>(value);
14  // ignore address byte, just use channel and cable numbers
15  MIDICNChannel channelCN = {address.getChannel(),
16  address.getCableNumber()};
17  Control_Surface.MIDI().sendPB(channelCN, value);
18  }
19 
20  constexpr static uint8_t precision() {
21  static_assert(INPUT_PRECISION_BITS <= 14,
22  "Maximum pitch bend resolution is 14 bits");
23  return INPUT_PRECISION_BITS;
24  }
25 };
26 
PitchBendSender::send
static void send(uint16_t value, MIDICNChannelAddress address)
Definition: PitchBendSender.hpp:11
IncreaseBitDepth.hpp
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition: Settings/NamespaceSettings.hpp:9
MIDICNChannelAddress::getCableNumber
constexpr uint8_t getCableNumber() const
Get the cable number [0, 15].
Definition: MIDICNChannelAddress.hpp:151
PitchBendSender::precision
constexpr static uint8_t precision()
Definition: PitchBendSender.hpp:20
Control_Surface_::MIDI
MIDI_Interface & MIDI()
Get the MIDI interface of the Control Surface.
Definition: Control_Surface_Class.cpp:58
PitchBendSender
Definition: PitchBendSender.hpp:9
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition: Settings/NamespaceSettings.hpp:10
Control_Surface_Class.hpp
MIDICNChannelAddress
A type-safe utility class for saving a MIDI address consisting of a 7-bit address,...
Definition: MIDICNChannelAddress.hpp:82
Control_Surface
Control_Surface_ & Control_Surface
A predefined instance of the Control Surface to use in the Arduino sketches.
Definition: Control_Surface_Class.cpp:176
MIDI_Interface::sendPB
void sendPB(MIDICNChannel address, uint16_t value)
Send a MIDI Pitch Bend event.
Definition: MIDI_Interface.cpp:95
MIDICNChannel
A class for saving a MIDI channel and cable number.
Definition: MIDICNChannelAddress.hpp:19
MIDICNChannelAddress::getChannel
constexpr Channel getChannel() const
Get the channel [CHANNEL_1, CHANNEL_16].
Definition: MIDICNChannelAddress.hpp:144