Control Surface
main
MIDI Control Surface library for Arduino
Toggle main menu visibility
Loading...
Searching...
No Matches
src
MIDI_Outputs
Bankable
Abstract
Bankable/Abstract/MIDIButtonLatching.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <
AH/Hardware/Button.hpp
>
4
#include <
Banks/BankableAddresses.hpp
>
5
#include <
Def/Def.hpp
>
6
#include <
MIDI_Outputs/Abstract/MIDIOutputElement.hpp
>
7
8
BEGIN_CS_NAMESPACE
9
10
namespace
Bankable
{
11
19
template
<
class
BankAddress,
class
Sender>
20
class
MIDIButtonLatching
:
public
MIDIOutputElement
{
21
protected
:
33
MIDIButtonLatching
(BankAddress bankAddress,
pin_t
pin,
const
Sender &
sender
)
34
:
address
(bankAddress),
button
(pin),
sender
(
sender
) {}
35
36
public
:
37
void
begin
()
override
{
button
.begin(); }
38
void
update
()
override
{
39
AH::Button::State
state =
button
.update();
40
if
(state ==
AH::Button::Falling
|| state ==
AH::Button::Rising
) {
41
MIDIAddress
sendAddress =
address
.getActiveAddress();
42
sender
.sendOn(sendAddress);
43
sender
.sendOff(sendAddress);
44
}
45
}
46
47
AH::Button::State
getButtonState
()
const
{
return
button
.getState(); }
48
49
protected
:
50
BankAddress
address
;
51
AH::Button
button
;
52
53
public
:
54
Sender
sender
;
55
};
56
57
}
// namespace Bankable
58
59
END_CS_NAMESPACE
BankableAddresses.hpp
Button.hpp
Def.hpp
MIDIOutputElement.hpp
MIDIOutputElement
AH::Updatable<> MIDIOutputElement
Definition
MIDIOutputElement.hpp:9
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition
Settings/NamespaceSettings.hpp:14
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition
Settings/NamespaceSettings.hpp:11
AH::Button
A class for reading and debouncing buttons and switches.
Definition
Button.hpp:15
AH::Button::State
State
An enumeration of the different states a button can be in.
Definition
Button.hpp:47
AH::Button::Rising
@ Rising
Input went from low to high (0,1).
Definition
Button.hpp:51
AH::Button::Falling
@ Falling
Input went from high to low (1,0).
Definition
Button.hpp:50
Bankable::MIDIButtonLatching::MIDIButtonLatching
MIDIButtonLatching(BankAddress bankAddress, pin_t pin, const Sender &sender)
Construct a new MIDIButtonLatching.
Definition
Bankable/Abstract/MIDIButtonLatching.hpp:33
Bankable::MIDIButtonLatching::button
AH::Button button
Definition
Bankable/Abstract/MIDIButtonLatching.hpp:51
Bankable::MIDIButtonLatching::address
BankAddress address
Definition
Bankable/Abstract/MIDIButtonLatching.hpp:50
Bankable::MIDIButtonLatching::getButtonState
AH::Button::State getButtonState() const
Definition
Bankable/Abstract/MIDIButtonLatching.hpp:47
Bankable::MIDIButtonLatching::sender
Sender sender
Definition
Bankable/Abstract/MIDIButtonLatching.hpp:54
Bankable::MIDIButtonLatching::update
void update() override
Update this updatable.
Definition
Bankable/Abstract/MIDIButtonLatching.hpp:38
Bankable::MIDIButtonLatching::begin
void begin() override
Initialize this updatable.
Definition
Bankable/Abstract/MIDIButtonLatching.hpp:37
MIDIAddress
A type-safe utility class for saving a MIDI address consisting of a 7-bit address,...
Definition
MIDIAddress.hpp:145
Bankable
A namespace for MIDI elements that can be added to a Bank, to change their address or channel.
Definition
BankAddresses.hpp:7
AH::ExtIO::pin_t
Type for storing pin numbers of Extended Input/Output elements.
Definition
Hardware-Types.hpp:25
Generated by
1.17.0