Control Surface  1.1.1
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 (int8_t zeroBasedChannel)
 Create a MIDI Channel object. More...
 
constexpr int8_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+= (const int8_t rhs)
 Add an offset. More...
 
Channel operator+ (const int8_t rhs) const
 Add an offset to a channel. More...
 
Channeloperator-= (const int8_t rhs)
 Subtract an offset. More...
 
Channel operator- (const int8_t rhs) const
 Subtract an offset from a channel. More...
 

Static Public Member Functions

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

Private Attributes

int8_t zeroBasedChannel
 

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 ( int8_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 int8_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 ( int8_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+= ( const int8_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+ ( const int8_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-= ( const int8_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- ( const int8_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

int8_t zeroBasedChannel
private

Definition at line 98 of file Channel.hpp.


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