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

#include <Def/Channel.hpp>

Detailed Description

A type-safe class for MIDI channels.

Examples
Keyboard-Matrix-BCD.ino, MIDI-Input-Fine-Grained-All-Callbacks.ino, MIDI-Input-Fine-Grained.ino, and Send-All-MIDI-Messages.ino.

Definition at line 13 of file 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 uint8_t getOneBased () const
 Get the channel as an integer. More...
 
constexpr bool operator== (const Channel &rhs) const
 Check if two channels are the same. More...
 
constexpr bool operator!= (const Channel &rhs) const
 Check if two channels are the different. 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
 

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.

◆ getOneBased()

constexpr uint8_t getOneBased ( ) const
inlineconstexpr

Get the channel as an integer.

Returns
The one-based channel (1 is the first channel).

Definition at line 36 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 44 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 54 of file Channel.hpp.

◆ operator!=()

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

Check if two channels are the different.

Parameters
rhsThe other channel to compare this channel to.

Definition at line 64 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 74 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 85 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 97 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 108 of file Channel.hpp.

Member Data Documentation

◆ zeroBasedChannel

uint8_t zeroBasedChannel
private

Definition at line 115 of file Channel.hpp.


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