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