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

A type-safe class for MIDI channels. More...

#include <Def/Channel.hpp>

+ Collaboration diagram for Channel:

Public Member Functions

constexpr Channel (uint8_t zeroBasedChannel)
 Create a MIDI Channel object. More...
 
constexpr uint8_t getRaw () const
 Get the channel as an integer. More...
 
constexpr bool operator== (const Channel &rhs) const
 Check if two channels are the same. More...
 
Channeloperator+= (uint8_t rhs)
 Add an offset. More...
 
Channel operator+ (uint8_t rhs) const
 Add an offset to a channel. More...
 
Channeloperator-= (uint8_t rhs)
 Subtract an offset. More...
 
Channel operator- (uint8_t rhs) const
 Subtract an offset from a channel. More...
 

Static Public Member Functions

static constexpr Channel createChannel (uint8_t oneBasedChannel)
 Create a channel. More...
 

Private Attributes

uint8_t zeroBasedChannel: 4
 

Detailed Description

A type-safe class for MIDI channels.

Examples
Keyboard-Matrix-BCD.ino.

Definition at line 13 of file Channel.hpp.

Constructor & Destructor Documentation

◆ Channel()

constexpr Channel ( uint8_t  zeroBasedChannel)
inlineexplicitconstexpr

Create a MIDI Channel object.

Parameters
zeroBasedChannelThe zero-based channel (0 is the first channel).

Definition at line 21 of file Channel.hpp.

Member Function Documentation

◆ getRaw()

constexpr uint8_t getRaw ( ) const
inlineconstexpr

Get the channel as an integer.

Returns
The zero-based channel (0 is the first channel).

Definition at line 29 of file Channel.hpp.

◆ createChannel()

static constexpr Channel createChannel ( uint8_t  oneBasedChannel)
inlinestaticconstexpr

Create a channel.

Parameters
oneBasedChannelThe channel number (1 is the first channel).

Definition at line 37 of file Channel.hpp.

◆ operator==()

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

Check if two channels are the same.

Parameters
rhsThe other channel to compare this channel to.

Definition at line 47 of file Channel.hpp.

◆ operator+=()

Channel& operator+= ( uint8_t  rhs)
inline

Add an offset.

Parameters
rhsThe offset to add to this channel.

Definition at line 57 of file Channel.hpp.

◆ operator+()

Channel operator+ ( uint8_t  rhs) const
inline

Add an offset to a channel.

Parameters
rhsThe offset to add to the channel.

Definition at line 68 of file Channel.hpp.

◆ operator-=()

Channel& operator-= ( uint8_t  rhs)
inline

Subtract an offset.

Parameters
rhsThe offset to subtract from this channel.

Definition at line 80 of file Channel.hpp.

◆ operator-()

Channel operator- ( uint8_t  rhs) const
inline

Subtract an offset from a channel.

Parameters
rhsThe offset to subtract from the channel.

Definition at line 91 of file Channel.hpp.

Member Data Documentation

◆ zeroBasedChannel

uint8_t zeroBasedChannel
private

Definition at line 98 of file Channel.hpp.


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