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

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include <Control_Surface/Control_Surface_Class.hpp>
       4             : 
       5             : BEGIN_CS_NAMESPACE
       6             : 
       7             : /**
       8             :  * @brief   Class that sends MIDI control change messages signifying either
       9             :  *          "on" or "off".
      10             :  * 
      11             :  * @ingroup MIDI_Senders
      12             :  */
      13             : class DigitalCCSender {
      14             :   public:
      15          19 :     DigitalCCSender(uint8_t onValue = 0x7F, uint8_t offValue = 0x00)
      16          19 :         : onValue(onValue), offValue(offValue) {}
      17             : 
      18             :     /// Send a control change message to the given address, with @p onValue as
      19             :     /// value.
      20          11 :     void sendOn(MIDIAddress address) {
      21          11 :         Control_Surface.sendControlChange(address, onValue);
      22          11 :     }
      23             :     /// Send a control change message to the given address, with @p offValue as
      24             :     /// value.
      25          11 :     void sendOff(MIDIAddress address) {
      26          11 :         Control_Surface.sendControlChange(address, offValue);
      27          11 :     }
      28             : 
      29             :     uint8_t getOnValue() const { return this->onValue; }
      30             :     void setOnValue(uint8_t onValue) { this->onValue = onValue; }
      31             :     uint8_t getOffValue() const { return this->offValue; }
      32             :     void setOffValue(uint8_t offValue) { this->offValue = offValue; }
      33             : 
      34             :   private:
      35             :     uint8_t onValue;
      36             :     uint8_t offValue;
      37             : };
      38             : 
      39             : END_CS_NAMESPACE

Generated by: LCOV version 1.15