Control Surface  1.1.0
MIDI Control Surface library for Arduino
Bankable/CCRotaryEncoder.hpp
Go to the documentation of this file.
1 #pragma once
2 
5 
7 
8 namespace Bankable {
9 
10 /**
11  * @brief A class of MIDIOutputElement%s that read the input of a **quadrature
12  * (rotary) encoder** and send out relative MIDI **Control Change**
13  * events.
14  *
15  * This version can be banked.
16  *
17  * @note To use this class, include the [PJRC Encoder library]
18  * (https://github.com/PaulStoffregen/Encoder) before the
19  * Control-Surface library.
20  *
21  * @ingroup BankableMIDIOutputElements
22  */
23 class CCRotaryEncoder : public MIDIRotaryEncoder<RelativeCCSender> {
24  public:
25  /**
26  * @brief Construct a new Bankable CCRotaryEncoder object with the given
27  * pins, controller, channel, speed factor, and number of pulses
28  * per step.
29  *
30  * @param config
31  * The bank configuration to use: the bank to add this element to,
32  * and whether to change the address, channel or cable number.
33  * @param pins
34  * A list of the two pins connected to the A and B outputs of the
35  * encoder.
36  * The internal pull-up resistors will be enabled by the Encoder
37  * library.
38  * @param address
39  * The MIDI address containing the controller number [0, 119],
40  * channel [CHANNEL_1, CHANNEL_16], and optional cable number
41  * [0, 15].
42  * @param speedMultiplier
43  * A constant factor to increase the speed of the rotary encoder.
44  * The difference in position will just be multiplied by this
45  * factor.
46  * @param pulsesPerStep
47  * The number of pulses per physical click of the encoder.
48  * For a normal encoder, this is 4. If you want to increase the
49  * resolution, for the use of Jog wheels, for example, you can go
50  * as 1.
51  * Whereas a greater speedMultiplier factor will increase the
52  * speed, increasing the number of pulsesPerStep will result in a
53  * lower speed.
54  * @param sender
55  * The MIDI sender to use.
56  */
57  CCRotaryEncoder(const OutputBankConfig &config, const EncoderPinList &pins,
59  uint8_t speedMultiplier, uint8_t pulsesPerStep,
60  const RelativeCCSender &sender = {})
61  : MIDIRotaryEncoder(config, pins, address, speedMultiplier,
63 
64 // For tests only (PJRC Encoder library's copy constructor doesn't work)
65 #ifndef ARDUINO
66  CCRotaryEncoder(const OutputBankConfig &config, const Encoder &encoder,
68  uint8_t speedMultiplier = 1, uint8_t pulsesPerStep = 4,
69  const RelativeCCSender &sender = {})
70  : MIDIRotaryEncoder(config, encoder, address, speedMultiplier,
72 #endif
73 };
74 
75 } // namespace Bankable
76 
Bankable::MIDIRotaryEncoder< RelativeCCSender >::encoder
Encoder encoder
Definition: Bankable/Abstract/MIDIRotaryEncoder.hpp:64
MIDIRotaryEncoder.hpp
Bankable::MIDIRotaryEncoder< RelativeCCSender >::MIDIRotaryEncoder
MIDIRotaryEncoder(const OutputBankConfig &config, const EncoderPinList &pins, const MIDICNChannelAddress &address, uint8_t speedMultiply, uint8_t pulsesPerStep, const RelativeCCSender &sender)
Construct a new MIDIRotaryEncoder.
Definition: Bankable/Abstract/MIDIRotaryEncoder.hpp:30
Bankable
A namespace for MIDI elements that can be added to a Bank, to change their address or channel.
Definition: BankAddresses.hpp:7
Bankable::MIDIRotaryEncoder< RelativeCCSender >::sender
RelativeCCSender sender
Definition: Bankable/Abstract/MIDIRotaryEncoder.hpp:71
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition: Settings/NamespaceSettings.hpp:9
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition: Settings/NamespaceSettings.hpp:10
Bankable::MIDIRotaryEncoder< RelativeCCSender >::pulsesPerStep
const uint8_t pulsesPerStep
Definition: Bankable/Abstract/MIDIRotaryEncoder.hpp:67
Bankable::MIDIRotaryEncoder
An abstract class for rotary encoders that send MIDI events and that can be added to a Bank.
Definition: Bankable/Abstract/MIDIRotaryEncoder.hpp:23
MIDICNChannelAddress
A type-safe utility class for saving a MIDI address consisting of a 7-bit address,...
Definition: MIDICNChannelAddress.hpp:82
Bankable::CCRotaryEncoder::CCRotaryEncoder
CCRotaryEncoder(const OutputBankConfig &config, const EncoderPinList &pins, const MIDICNChannelAddress &address, uint8_t speedMultiplier, uint8_t pulsesPerStep, const RelativeCCSender &sender={})
Construct a new Bankable CCRotaryEncoder object with the given pins, controller, channel,...
Definition: Bankable/CCRotaryEncoder.hpp:57
RelativeCCSender.hpp
EncoderPinList
A struct for the pins of a rotary (quadrature) encoder without a switch.
Definition: Def.hpp:44
RelativeCCSender
Definition: RelativeCCSender.hpp:65
Bankable::MIDIRotaryEncoder< RelativeCCSender >::address
const MIDICNChannelAddress address
Definition: Bankable/Abstract/MIDIRotaryEncoder.hpp:65
Bankable::CCRotaryEncoder
A class of MIDIOutputElements that read the input of a quadrature (rotary) encoder and send out relat...
Definition: Bankable/CCRotaryEncoder.hpp:23
OutputBankConfig
A struct for selecting the bank of BankableMIDIOutputs and the bank type.
Definition: BankConfig.hpp:50