JUCE  v5.4.1-191-g0ab5e696f
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::MPEChannelAssigner Class Reference

This class handles the assignment of new MIDI notes to member channels of an active MPE zone. More...

#include <juce_MPEUtils.h>

Collaboration diagram for juce::MPEChannelAssigner:

Classes

struct  MidiChannel
 

Public Member Functions

 MPEChannelAssigner (MPEZoneLayout::Zone zoneToUse)
 Constructor. More...
 
 MPEChannelAssigner (Range< int > channelRange=Range< int >(1, 17))
 Legacy mode constructor. More...
 
void allNotesOff ()
 Call this to clear all currently playing notes. More...
 
int findMidiChannelForNewNote (int noteNumber) noexcept
 This method will use a set of rules recommended in the MPE specification to determine which member channel the specified MIDI note should be assigned to and will return this channel number. More...
 
void noteOff (int noteNumber)
 You must call this method for all note-offs that you receive so that this class can keep track of the currently playing notes internally. More...
 

Private Member Functions

int findMidiChannelPlayingClosestNonequalNote (int noteNumber) noexcept
 

Private Attributes

int channelIncrement
 
int firstChannel
 
bool isLegacy = false
 
int lastChannel
 
int midiChannelLastAssigned
 
MidiChannel midiChannels [17]
 
int numChannels
 
std::unique_ptr< MPEZoneLayout::Zonezone
 

Detailed Description

This class handles the assignment of new MIDI notes to member channels of an active MPE zone.

To use it, create an instance passing in the MPE zone that it should operate on and then call use the findMidiChannelForNewNote() method for all note-on messages and the noteOff() method for all note-off messages.

{Audio}

Constructor & Destructor Documentation

◆ MPEChannelAssigner() [1/2]

juce::MPEChannelAssigner::MPEChannelAssigner ( MPEZoneLayout::Zone  zoneToUse)

Constructor.

This will assign channels within the range of the specified MPE zone.

◆ MPEChannelAssigner() [2/2]

juce::MPEChannelAssigner::MPEChannelAssigner ( Range< int channelRange = Rangeint >(1, 17))

Legacy mode constructor.

This will assign channels within the specified range.

Member Function Documentation

◆ allNotesOff()

void juce::MPEChannelAssigner::allNotesOff ( )

Call this to clear all currently playing notes.

◆ findMidiChannelForNewNote()

int juce::MPEChannelAssigner::findMidiChannelForNewNote ( int  noteNumber)
noexcept

This method will use a set of rules recommended in the MPE specification to determine which member channel the specified MIDI note should be assigned to and will return this channel number.

The rules have the following precedence:

  • find a free channel on which the last note played was the same as the one specified
  • find the next free channel in round-robin assignment
  • find the channel number that is currently playing the closest note (but not the same)
Parameters
noteNumberthe MIDI note number to be assigned to a channel
Returns
the zone's member channel that this note should be assigned to

◆ findMidiChannelPlayingClosestNonequalNote()

int juce::MPEChannelAssigner::findMidiChannelPlayingClosestNonequalNote ( int  noteNumber)
privatenoexcept

◆ noteOff()

void juce::MPEChannelAssigner::noteOff ( int  noteNumber)

You must call this method for all note-offs that you receive so that this class can keep track of the currently playing notes internally.

Member Data Documentation

◆ channelIncrement

int juce::MPEChannelAssigner::channelIncrement
private

◆ firstChannel

int juce::MPEChannelAssigner::firstChannel
private

◆ isLegacy

bool juce::MPEChannelAssigner::isLegacy = false
private

◆ lastChannel

int juce::MPEChannelAssigner::lastChannel
private

◆ midiChannelLastAssigned

int juce::MPEChannelAssigner::midiChannelLastAssigned
private

◆ midiChannels

MidiChannel juce::MPEChannelAssigner::midiChannels[17]
private

◆ numChannels

int juce::MPEChannelAssigner::numChannels
private

◆ zone

std::unique_ptr<MPEZoneLayout::Zone> juce::MPEChannelAssigner::zone
private

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