Loading...
Searching...
No Matches
juce::MidiRPNDetector Class Reference

`#include <juce_MidiRPN.h>`

## Public Member Functions

| MidiRPNDetector () noexcept=default
| ~MidiRPNDetector () noexcept=default
void | reset () noexcept
bool | parseControllerMessage (int midiChannel, int controllerNumber, int controllerValue, MidiRPNMessage &result) noexcept
std::optional< MidiRPNMessage > | tryParse (int midiChannel, int controllerNumber, int controllerValue)

## Detailed Description

Parses a stream of MIDI data to assemble RPN and NRPN messages from their constituent MIDI CC messages.

The detector uses the following parsing rules: the parameter number LSB/MSB can be sent/received in either order and must both come before the parameter value; for the parameter value, LSB always has to be sent/received before the value MSB, otherwise it will be treated as 7-bit (MSB only).

Definition at line 67 of file juce_MidiRPN.h.

## Constructor & Destructor Documentation

## MidiRPNDetector()

juce::MidiRPNDetector::MidiRPNDetector | ( |  | ) |

default noexcept

Constructor.

Referenced by ~MidiRPNDetector().

## ~MidiRPNDetector()

juce::MidiRPNDetector::~MidiRPNDetector | ( |  | ) |

default noexcept

Destructor.

## Member Function Documentation

## parseControllerMessage()

bool juce::MidiRPNDetector::parseControllerMessage | ( | int | midiChannel,
|  | int | controllerNumber,
|  | int | controllerValue,
|  | MidiRPNMessage & | result )

noexcept

See also
  tryParse()

Definition at line 26 of file juce_MidiRPN.cpp.

Referenced by ~MidiRPNDetector().

## reset()

void juce::MidiRPNDetector::reset | ( |  | ) |

noexcept

Resets the RPN detector's internal state, so that it forgets about previously received MIDI CC messages.

Definition at line 51 of file juce_MidiRPN.cpp.

Referenced by ~MidiRPNDetector().

## tryParse()

std::optional< MidiRPNMessage > juce::MidiRPNDetector::tryParse | ( | int | midiChannel,
|  | int | controllerNumber,
|  | int | controllerValue )

Takes the next in a stream of incoming MIDI CC messages and returns a MidiRPNMessage if the current message produces a well-formed RPN or NRPN.

Note that senders are expected to send the MSB before the LSB, but senders are not required to send a LSB at all. Therefore, tryParse() will return a non-null optional on all MSB messages (provided a parameter number has been set), and will also return a non-null optional for each LSB that follows the initial MSB.

This behaviour allows senders to transmit a single MSB followed by multiple LSB messages to facilitate fine-tuning of parameters.

The result of parsing a MSB will always be a 7-bit value. The result of parsing a LSB that follows an MSB will always be a 14-bit value.

Definition at line 40 of file juce_MidiRPN.cpp.

Referenced by parseControllerMessage(), and ~MidiRPNDetector().

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

- juce_MidiRPN.h
- juce_MidiRPN.cpp