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

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

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

- juce_audio_basics/mpe/juce_MPEUtils.h

## Public Member Functions

| MPEChannelAssigner (MPEZoneLayout::Zone zoneToUse)
| Constructor.
| MPEChannelAssigner (Range< int > channelRange=Range< int >(1, 17))
| Legacy mode constructor.
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.
int | findMidiChannelForExistingNote (int initialNoteOnNumber) noexcept
| If a note has been added using findMidiChannelForNewNote() this will return the channel to which it was assigned, otherwise it will return -1.
void | noteOff (int noteNumber, int midiChannel=-1)
| 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.
void | allNotesOff ()
| Call this to clear all currently playing notes.

## Constructors and Destructors

## 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 = Range< int >(1, 17) | ) |

Legacy mode constructor.

This will assign channels within the specified range.

## Member Functions

## 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

  noteNumber | the MIDI note number to be assigned to a channel

Returns
  the zone's member channel that this note should be assigned to

## findMidiChannelForExistingNote()

int juce::MPEChannelAssigner::findMidiChannelForExistingNote | ( | int | initialNoteOnNumber | ) |

noexcept

If a note has been added using findMidiChannelForNewNote() this will return the channel to which it was assigned, otherwise it will return -1.

## noteOff()

void juce::MPEChannelAssigner::noteOff | ( | int | noteNumber,
|  | int | midiChannel = -1 )

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.

You can specify the channel number the note off happened on. If you don't, it will look through all channels to find the registered midi note matching the given note number.

## allNotesOff()

void juce::MPEChannelAssigner::allNotesOff | ( |  | ) |

Call this to clear all currently playing notes.

### Purchase

Get JUCE

### Discover

What's New in JUCE Features

### Learn

Documentaion Tutorials Made with JUCE Resources

### Support

JUCE Forum Newsletter Archive

### About

Contact Us JUCE Legal JUCE Licensing FAQ

### Events

Audio Developer Conference
© Raw Material Software Limited