LCOV - code coverage report
Current view: top level - src/MIDI_Outputs/Bankable - CCAbsoluteEncoder.hpp (source / functions) Hit Total Coverage
Test: 169c36a3797bc662d84b5726f34a3f37d3c58247 Lines: 3 3 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/MIDIAbsoluteEncoder.hpp>
       5             : #include <MIDI_Senders/ContinuousCCSender.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 absolute MIDI **Control Change**
      14             :  *          events.
      15             :  * 
      16             :  * This version can be banked.
      17             :  *
      18             :  * @tparam  NumBanks
      19             :  *          The number of banks.
      20             :  * 
      21             :  * @ingroup BankableMIDIOutputElements
      22             :  */
      23             : template <size_t NumBanks>
      24             : class CCAbsoluteEncoder
      25             :     : public MIDIAbsoluteEncoder<NumBanks, SingleAddress, ContinuousCCSender> {
      26             :   public:
      27             :     /**
      28             :      * @brief   Construct a new Bankable CCAbsoluteEncoder object with the given 
      29             :      *          pins, controller, channel, speed factor, and number of pulses
      30             :      *          per step.
      31             :      * 
      32             :      * @param   config
      33             :      *          The bank configuration to use: the bank to add this element to,
      34             :      *          and whether to change the address, channel or cable number.
      35             :      * @param   encoder
      36             :      *          The Encoder object to use.  
      37             :      *          Usually passed as a list of the two pins connected to the 
      38             :      *          A and B outputs of the encoder, e.g. `{2, 3}`.  
      39             :      *          The internal pull-up resistors will be enabled by the Encoder
      40             :      *          library.
      41             :      * @param   address
      42             :      *          The MIDI address containing the controller number [0, 119], 
      43             :      *          channel [Channel_1, Channel_16], and optional cable number 
      44             :      *          [0, 15].
      45             :      * @param   speedMultiply
      46             :      *          A constant factor to increase the speed of the rotary encoder.
      47             :      *          The difference in position will just be multiplied by this 
      48             :      *          factor. 
      49             :      * @param   pulsesPerStep
      50             :      *          The number of pulses per physical click of the encoder.
      51             :      *          For a normal encoder, this is 4. If you want to increase the
      52             :      *          resolution, for the use of Jog wheels, for example, you can go
      53             :      *          as 1.  
      54             :      *          Whereas a greater speedMultiply factor will increase the 
      55             :      *          speed, increasing the number of pulsesPerStep will result in a 
      56             :      *          lower speed.
      57             :      */
      58           1 :     CCAbsoluteEncoder(BankConfig<NumBanks> config, AHEncoder &&encoder,
      59             :                       MIDIAddress address, int16_t speedMultiply = 1,
      60             :                       uint8_t pulsesPerStep = 4)
      61             :         : MIDIAbsoluteEncoder<NumBanks, SingleAddress, ContinuousCCSender>(
      62           1 :               {config, address}, std::move(encoder), speedMultiply,
      63           2 :               pulsesPerStep, {}) {}
      64             : };
      65             : 
      66             : } // namespace Bankable
      67             : 
      68             : END_CS_NAMESPACE

Generated by: LCOV version 1.15