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

#include <MIDI_Senders/RelativeCCSender.hpp>

Detailed Description

Class that sends relative/incremental MIDI control change messages.

This is often used for rotary encoders.

This requires explicit support from your DAW. You have to select relative MIDI CC mode in the MIDI learn settings.

This class supports multiple different modes, see relativeCCmode.

Definition at line 88 of file RelativeCCSender.hpp.

+ Collaboration diagram for RelativeCCSender:

Static Public Member Functions

static uint8_t toTwosComplement7bit (int8_t value)
 Convert an 8-bit two's complement integer to a 7-bit two's complement integer. More...
 
static uint8_t toBinaryOffset7bit (int8_t value)
 Convert an 8-bit two's complement integer to a 7-bit integer with a binary offset of 64. More...
 
static uint8_t toSignedMagnitude7bit (int8_t value)
 Convert an 8-bit two's complement integer to 7-bit sign-magnitude format. More...
 
static uint8_t mapRelativeCC (int8_t value)
 Convert an 8-bit two's complement integer to a 7-bit value to send over MIDI. More...
 
static void send (long delta, MIDIAddress address)
 Send a relative CC message. More...
 
static void setMode (relativeCCmode mode)
 Set the relative CC mode that's used. More...
 

Static Private Attributes

static relativeCCmode mode = TWOS_COMPLEMENT
 

Member Function Documentation

◆ toTwosComplement7bit()

static uint8_t toTwosComplement7bit ( int8_t  value)
inlinestatic

Convert an 8-bit two's complement integer to a 7-bit two's complement integer.

Definition at line 92 of file RelativeCCSender.hpp.

◆ toBinaryOffset7bit()

static uint8_t toBinaryOffset7bit ( int8_t  value)
inlinestatic

Convert an 8-bit two's complement integer to a 7-bit integer with a binary offset of 64.

In other words, a value of 0 corresponds to -64, a value of 64 corresponds to 0, and a value of 127 corresponds to 63.

Definition at line 96 of file RelativeCCSender.hpp.

◆ toSignedMagnitude7bit()

static uint8_t toSignedMagnitude7bit ( int8_t  value)
inlinestatic

Convert an 8-bit two's complement integer to 7-bit sign-magnitude format.

Definition at line 99 of file RelativeCCSender.hpp.

◆ mapRelativeCC()

static uint8_t mapRelativeCC ( int8_t  value)
inlinestatic

Convert an 8-bit two's complement integer to a 7-bit value to send over MIDI.

Definition at line 107 of file RelativeCCSender.hpp.

◆ send()

static void send ( long  delta,
MIDIAddress  address 
)
inlinestatic

Send a relative CC message.

Definition at line 118 of file RelativeCCSender.hpp.

◆ setMode()

static void setMode ( relativeCCmode  mode)
inlinestatic

Set the relative CC mode that's used.

Requires the same setting on the receiving end, in your DAW, for example.

Examples
CCIncrementDecrementButtons.ino, MCU-OLED-SSD1306.ino, and RotaryEncoder.ino.

Definition at line 134 of file RelativeCCSender.hpp.

Member Data Documentation

◆ mode

relativeCCmode mode = TWOS_COMPLEMENT
staticprivate

Definition at line 137 of file RelativeCCSender.hpp.


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