LCOV - code coverage report
Current view: top level - src/MIDI_Senders - DigitalNoteSender.hpp (source / functions) Hit Total Coverage
Test: 3a807a259ebe0769dd942f7f612dca5273937539 Lines: 8 8 100.0 %
Date: 2024-03-24 17:16:54 Functions: 4 4 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 note on and off messages.
       9             :  * 
      10             :  * @ingroup MIDI_Senders
      11             :  */
      12             : class DigitalNoteSender {
      13             :   public:
      14          26 :     DigitalNoteSender(uint8_t velocity = 0x7F) : velocity(velocity) {}
      15             :     /// Send a note on message to the given address with this object's velocity
      16             :     /// as velocity.
      17          18 :     void sendOn(MIDIAddress address) {
      18          18 :         Control_Surface.sendNoteOn(address, getVelocity());
      19          18 :     }
      20             :     /// Send a note off message to the given address with 0x7F as velocity.
      21          18 :     void sendOff(MIDIAddress address) {
      22          18 :         Control_Surface.sendNoteOff(address, 0x7F);
      23          18 :     }
      24             : 
      25             :     void setVelocity(uint8_t velocity) { this->velocity = velocity; }
      26          18 :     uint8_t getVelocity() const { return this->velocity; }
      27             : 
      28             :   private:
      29             :     uint8_t velocity;
      30             : };
      31             : 
      32             : END_CS_NAMESPACE

Generated by: LCOV version 1.15