Control Surface  1.1.1
MIDI Control Surface library for Arduino
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
MIDICNChannelAddress Class Reference

A type-safe utility class for saving a MIDI address consisting of a 7-bit address, a 4-bit channel, and a 4-bit cable number. More...

#include <Def/MIDICNChannelAddress.hpp>

Collaboration diagram for MIDICNChannelAddress:

Public Member Functions

constexpr MIDICNChannelAddress ()
 
constexpr MIDICNChannelAddress (int address, MIDICNChannel channelCN)
 
constexpr MIDICNChannelAddress (int address, Channel channel=CHANNEL_1, int cableNumber=0x0)
 
constexpr MIDICNChannelAddress (Channel channel, int cableNumber=0x0)
 
constexpr MIDICNChannelAddress (const MIDICNChannel &address)
 
MIDICNChannelAddressoperator+= (const RelativeMIDICNChannelAddress &rhs)
 
MIDICNChannelAddressoperator-= (const RelativeMIDICNChannelAddress &rhs)
 
MIDICNChannelAddress operator+ (const RelativeMIDICNChannelAddress &rhs) const
 
MIDICNChannelAddress operator- (const RelativeMIDICNChannelAddress &rhs) const
 
constexpr bool operator== (const MIDICNChannelAddress &rhs) const
 
constexpr bool operator!= (const MIDICNChannelAddress &rhs) const
 
constexpr uint8_t getAddress () const
 Get the address [0, 127]. More...
 
constexpr Channel getChannel () const
 Get the channel [CHANNEL_1, CHANNEL_16]. More...
 
constexpr uint8_t getRawChannel () const
 Get the channel [0, 15]. More...
 
constexpr uint8_t getCableNumber () const
 Get the cable number [0, 15]. More...
 
constexpr bool isValid () const
 Check if the MIDI address is valid. More...
 
constexpr operator bool () const
 Check if the MIDI address is valid. More...
 

Static Public Member Functions

static bool matchSingle (const MIDICNChannelAddress &toMatch, const MIDICNChannelAddress &base)
 Check if two addresses match. More...
 
static bool matchAddressInRange (const MIDICNChannelAddress &toMatch, const MIDICNChannelAddress &base, uint8_t length)
 Check if an address falls within a range of addresses, starting with address base, with a given length. More...
 
constexpr static MIDICNChannelAddress invalid ()
 

Private Attributes

RawMIDICNChannelAddress addresses
 

Detailed Description

A type-safe utility class for saving a MIDI address consisting of a 7-bit address, a 4-bit channel, and a 4-bit cable number.

Examples
Send-MIDI-Notes.ino.

Definition at line 82 of file MIDICNChannelAddress.hpp.

Constructor & Destructor Documentation

◆ MIDICNChannelAddress() [1/5]

constexpr MIDICNChannelAddress ( )
inlineconstexpr

Definition at line 84 of file MIDICNChannelAddress.hpp.

◆ MIDICNChannelAddress() [2/5]

constexpr MIDICNChannelAddress ( int  address,
MIDICNChannel  channelCN 
)
inlineconstexpr

Definition at line 91 of file MIDICNChannelAddress.hpp.

◆ MIDICNChannelAddress() [3/5]

constexpr MIDICNChannelAddress ( int  address,
Channel  channel = CHANNEL_1,
int  cableNumber = 0x0 
)
inlineconstexpr

Definition at line 98 of file MIDICNChannelAddress.hpp.

◆ MIDICNChannelAddress() [4/5]

constexpr MIDICNChannelAddress ( Channel  channel,
int  cableNumber = 0x0 
)
inlineconstexpr

Definition at line 106 of file MIDICNChannelAddress.hpp.

◆ MIDICNChannelAddress() [5/5]

constexpr MIDICNChannelAddress ( const MIDICNChannel address)
inlineconstexpr

Definition at line 113 of file MIDICNChannelAddress.hpp.

Member Function Documentation

◆ operator+=()

MIDICNChannelAddress & operator+= ( const RelativeMIDICNChannelAddress rhs)

Definition at line 6 of file MIDICNChannelAddress.cpp.

◆ operator-=()

MIDICNChannelAddress & operator-= ( const RelativeMIDICNChannelAddress rhs)

Definition at line 18 of file MIDICNChannelAddress.cpp.

◆ operator+()

MIDICNChannelAddress operator+ ( const RelativeMIDICNChannelAddress rhs) const

Definition at line 30 of file MIDICNChannelAddress.cpp.

◆ operator-()

MIDICNChannelAddress operator- ( const RelativeMIDICNChannelAddress rhs) const

Definition at line 37 of file MIDICNChannelAddress.cpp.

◆ operator==()

constexpr bool operator== ( const MIDICNChannelAddress rhs) const
inlineconstexpr

Definition at line 126 of file MIDICNChannelAddress.hpp.

◆ operator!=()

constexpr bool operator!= ( const MIDICNChannelAddress rhs) const
inlineconstexpr

Definition at line 133 of file MIDICNChannelAddress.hpp.

◆ getAddress()

constexpr uint8_t getAddress ( ) const
inlineconstexpr

Get the address [0, 127].

Definition at line 141 of file MIDICNChannelAddress.hpp.

◆ getChannel()

constexpr Channel getChannel ( ) const
inlineconstexpr

Get the channel [CHANNEL_1, CHANNEL_16].

Definition at line 144 of file MIDICNChannelAddress.hpp.

◆ getRawChannel()

constexpr uint8_t getRawChannel ( ) const
inlineconstexpr

Get the channel [0, 15].

Definition at line 148 of file MIDICNChannelAddress.hpp.

◆ getCableNumber()

constexpr uint8_t getCableNumber ( ) const
inlineconstexpr

Get the cable number [0, 15].

Definition at line 151 of file MIDICNChannelAddress.hpp.

◆ isValid()

constexpr bool isValid ( ) const
inlineconstexpr

Check if the MIDI address is valid.

Definition at line 154 of file MIDICNChannelAddress.hpp.

◆ operator bool()

constexpr operator bool ( ) const
inlineexplicitconstexpr

Check if the MIDI address is valid.

See also
isValid

Definition at line 158 of file MIDICNChannelAddress.hpp.

◆ matchSingle()

bool matchSingle ( const MIDICNChannelAddress toMatch,
const MIDICNChannelAddress base 
)
static

Check if two addresses match.

Definition at line 43 of file MIDICNChannelAddress.cpp.

◆ matchAddressInRange()

bool matchAddressInRange ( const MIDICNChannelAddress toMatch,
const MIDICNChannelAddress base,
uint8_t  length 
)
static

Check if an address falls within a range of addresses, starting with address base, with a given length.

Definition at line 48 of file MIDICNChannelAddress.cpp.

◆ invalid()

constexpr static MIDICNChannelAddress invalid ( )
inlinestaticconstexpr
Examples
One-Pot-Both-PB-and-CC.ino.

Definition at line 170 of file MIDICNChannelAddress.hpp.

Member Data Documentation

◆ addresses

RawMIDICNChannelAddress addresses
private

Definition at line 173 of file MIDICNChannelAddress.hpp.


The documentation for this class was generated from the following files: