JUCE v8.0.9
JUCE API
 
Loading...
Searching...
No Matches
juce::MidiRPNDetector Class Reference

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

#include <juce_MidiRPN.h>

Collaboration diagram for juce::MidiRPNDetector:

Classes

struct  ChannelState
 

Public Member Functions

 MidiRPNDetector () noexcept=default
 Constructor.
 
 ~MidiRPNDetector () noexcept=default
 Destructor.
 
bool parseControllerMessage (int midiChannel, int controllerNumber, int controllerValue, MidiRPNMessage &result) noexcept
 
void reset () noexcept
 Resets the RPN detector's internal state, so that it forgets about previously received MIDI CC messages.
 
std::optional< MidiRPNMessagetryParse (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.
 

Private Attributes

ChannelState states [16]
 

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).

@tags{Audio}

Constructor & Destructor Documentation

◆ MidiRPNDetector()

juce::MidiRPNDetector::MidiRPNDetector ( )
defaultnoexcept

Constructor.

◆ ~MidiRPNDetector()

juce::MidiRPNDetector::~MidiRPNDetector ( )
defaultnoexcept

Destructor.

Member Function Documentation

◆ parseControllerMessage()

bool juce::MidiRPNDetector::parseControllerMessage ( int  midiChannel,
int  controllerNumber,
int  controllerValue,
MidiRPNMessage result 
)
noexcept
See also
tryParse()

◆ reset()

void juce::MidiRPNDetector::reset ( )
noexcept

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

◆ 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.

Member Data Documentation

◆ states

ChannelState juce::MidiRPNDetector::states[16]
private

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