LCOV - code coverage report
Current view: top level - src/MIDI_Outputs/ManyAddresses - PBAbsoluteEncoder.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 <AH/Containers/ArrayHelpers.hpp>
       4             : #include <Banks/BankAddresses.hpp>
       5             : #include <MIDI_Outputs/Bankable/Abstract/MIDIAbsoluteEncoder.hpp>
       6             : #include <MIDI_Senders/PitchBendSender.hpp>
       7             : 
       8             : BEGIN_CS_NAMESPACE
       9             : 
      10             : namespace Bankable {
      11             : namespace ManyAddresses {
      12             : 
      13             : /**
      14             :  * @brief   A class of MIDIOutputElement%s that read the input of a **quadrature
      15             :  *          (rotary) encoder** and send out absolute MIDI **Pitch Bend**
      16             :  *          events.
      17             :  * 
      18             :  * This version can be banked using an arbitrary list of alternative
      19             :  * addresses.
      20             :  *
      21             :  * @tparam  NumBanks
      22             :  *          The number of banks.
      23             :  * 
      24             :  * @ingroup ManyAddressesMIDIOutputElements
      25             :  */
      26             : template <size_t NumBanks>
      27             : class PBAbsoluteEncoder
      28             :     : public MIDIAbsoluteEncoder<NumBanks, ManyAddresses<NumBanks>,
      29             :                                  PitchBendSender<14>> {
      30             :   public:
      31             :     /**
      32             :      * @brief   Construct a new Bankable PBAbsoluteEncoder object with the given 
      33             :      *          pins, channel, speed factor, and number of pulses per step.
      34             :      * 
      35             :      * @param   bank
      36             :      *          The bank that selects the address to use.
      37             :      * @param   encoder
      38             :      *          The Encoder object to use.  
      39             :      *          Usually passed as a list of the two pins connected to the 
      40             :      *          A and B outputs of the encoder, e.g. `{2, 3}`.  
      41             :      *          The internal pull-up resistors will be enabled by the Encoder
      42             :      *          library.
      43             :      * @param   addresses
      44             :      *          The list of MIDI channels [Channel_1, Channel_16] and optional 
      45             :      *          cable numbers [0, 15].
      46             :      * @param   speedMultiply
      47             :      *          A constant factor to increase the speed of the rotary encoder.
      48             :      *          The difference in position will just be multiplied by this 
      49             :      *          factor. 
      50             :      * @param   pulsesPerStep
      51             :      *          The number of pulses per physical click of the encoder.
      52             :      *          For a normal encoder, this is 4. If you want to increase the
      53             :      *          resolution, for the use of Jog wheels, for example, you can go
      54             :      *          as 1.  
      55             :      *          Whereas a greater speedMultiply factor will increase the 
      56             :      *          speed, increasing the number of pulsesPerStep will result in a 
      57             :      *          lower speed.
      58             :      */
      59           1 :     PBAbsoluteEncoder(const Bank<NumBanks> &bank, AHEncoder &&encoder,
      60             :                       const Array<MIDIChannelCable, NumBanks> &addresses,
      61             :                       int16_t speedMultiply = 1, uint8_t pulsesPerStep = 4)
      62             :         : MIDIAbsoluteEncoder<NumBanks, ManyAddresses<NumBanks>,
      63             :                               PitchBendSender<14>>(
      64           3 :               {bank, AH::copyAs<MIDIAddress>(addresses)}, std::move(encoder),
      65           4 :               speedMultiply, pulsesPerStep, {}) {}
      66             : };
      67             : 
      68             : } // namespace ManyAddresses
      69             : } // namespace Bankable
      70             : 
      71             : END_CS_NAMESPACE

Generated by: LCOV version 1.15