LCOV - code coverage report
Current view: top level - src/MIDI_Outputs/Bankable - CCRotaryEncoder.hpp (source / functions) Hit Total Coverage
Test: 169c36a3797bc662d84b5726f34a3f37d3c58247 Lines: 4 4 100.0 %
Date: 2024-11-09 15:32:27 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include <Banks/BankAddresses.hpp>
       4             : #include <MIDI_Outputs/Bankable/Abstract/MIDIRotaryEncoder.hpp>
       5             : #include <MIDI_Senders/RelativeCCSender.hpp>
       6             : 
       7             : BEGIN_CS_NAMESPACE
       8             : 
       9             : namespace Bankable {
      10             : 
      11             : /**
      12             :  * @brief   A class of MIDIOutputElement%s that read the input of a **quadrature
      13             :  *          (rotary) encoder** and send out relative MIDI **Control Change**
      14             :  *          events.
      15             :  * 
      16             :  * This version can be banked.
      17             :  *
      18             :  * @ingroup BankableMIDIOutputElements
      19             :  */
      20             : class CCRotaryEncoder
      21             :     : public MIDIRotaryEncoder<SingleAddress, RelativeCCSender> {
      22             :   public:
      23             :     /**
      24             :      * @brief   Construct a new Bankable CCRotaryEncoder object with the given 
      25             :      *          pins, controller, channel, speed factor, and number of pulses
      26             :      *          per step.
      27             :      * 
      28             :      * @param   config
      29             :      *          The bank configuration to use: the bank to add this element to,
      30             :      *          and whether to change the address, channel or cable number.
      31             :      * @param   encoder
      32             :      *          The Encoder object to use.  
      33             :      *          Usually passed as a list of the two pins connected to the 
      34             :      *          A and B outputs of the encoder, e.g. `{2, 3}`.  
      35             :      *          The internal pull-up resistors will be enabled by the Encoder
      36             :      *          library.
      37             :      * @param   address
      38             :      *          The MIDI address containing the controller number [0, 119], 
      39             :      *          channel [Channel_1, Channel_16], and optional cable number 
      40             :      *          [Cable_1, Cable_16]1, Cable_16].
      41             :      * @param   speedMultiply
      42             :      *          A constant factor to increase the speed of the rotary encoder.
      43             :      *          The difference in position will just be multiplied by this 
      44             :      *          factor. 
      45             :      * @param   pulsesPerStep
      46             :      *          The number of pulses per physical click of the encoder.
      47             :      *          For a normal encoder, this is 4. If you want to increase the
      48             :      *          resolution, for the use of Jog wheels, for example, you can go
      49             :      *          as 1.  
      50             :      *          Whereas a greater speedMultiply factor will increase the 
      51             :      *          speed, increasing the number of pulsesPerStep will result in a 
      52             :      *          lower speed.
      53             :      */
      54           2 :     CCRotaryEncoder(OutputBankConfig<> config, AHEncoder &&encoder,
      55             :                     MIDIAddress address, int16_t speedMultiply = 1,
      56             :                     uint8_t pulsesPerStep = 4)
      57           2 :         : MIDIRotaryEncoder<SingleAddress, RelativeCCSender>(
      58           2 :               {config, address}, std::move(encoder), speedMultiply,
      59           4 :               pulsesPerStep, {}) {}
      60             : };
      61             : 
      62             : } // namespace Bankable
      63             : 
      64             : END_CS_NAMESPACE

Generated by: LCOV version 1.15