89 bool isLowerZone()
const noexcept {
return lowerZone; }
90 bool isUpperZone()
const noexcept {
return ! lowerZone; }
92 bool isActive()
const noexcept {
return numMemberChannels > 0; }
94 int getMasterChannel()
const noexcept {
return lowerZone ? 1 : 16; }
95 int getFirstMemberChannel()
const noexcept {
return lowerZone ? 2 : 15; }
96 int getLastMemberChannel()
const noexcept {
return lowerZone ? (1 + numMemberChannels)
97 : (16 - numMemberChannels); }
99 bool isUsingChannelAsMemberChannel (
int channel)
const noexcept
101 return lowerZone ? (channel > 1 && channel <= 1 + numMemberChannels)
102 : (channel < 16 && channel >= 16 - numMemberChannels);
105 bool isUsing (
int channel)
const noexcept
107 return isUsingChannelAsMemberChannel (channel) || channel == getMasterChannel();
110 bool operator== (
const Zone& other)
const noexcept {
return lowerZone == other.lowerZone
111 && numMemberChannels == other.numMemberChannels
112 && perNotePitchbendRange == other.perNotePitchbendRange
113 && masterPitchbendRange == other.masterPitchbendRange; }
115 bool operator!= (
const Zone& other)
const noexcept {
return ! operator== (other); }
117 int numMemberChannels;
118 int perNotePitchbendRange;
119 int masterPitchbendRange;
124 Zone (
bool lower,
int memberChans = 0,
int perNotePb = 48,
int masterPb = 2) noexcept
125 : numMemberChannels (memberChans),
126 perNotePitchbendRange (perNotePb),
127 masterPitchbendRange (masterPb),
136 void setLowerZone (
int numMemberChannels = 0,
137 int perNotePitchbendRange = 48,
138 int masterPitchbendRange = 2) noexcept;
141 void setUpperZone (
int numMemberChannels = 0,
142 int perNotePitchbendRange = 48,
143 int masterPitchbendRange = 2) noexcept;
146 const
Zone getLowerZone() const noexcept {
return lowerZone; }
154 void clearAllZones();
168 void processNextMidiEvent (
const MidiMessage& message);
181 void processNextMidiBuffer (
const MidiBuffer& buffer);
202 void addListener (
Listener*
const listenerToAdd) noexcept;
205 void removeListener (
Listener*
const listenerToRemove) noexcept;
209 Zone lowerZone {
true, 0 };
210 Zone upperZone {
false, 0 };
212 MidiRPNDetector rpnDetector;
213 ListenerList<Listener> listeners;
216 void setZone (
bool,
int,
int,
int) noexcept;
218 void processRpnMessage (MidiRPNMessage);
219 void processZoneLayoutRpnMessage (MidiRPNMessage);
220 void processPitchbendRangeRpnMessage (MidiRPNMessage);
222 void updateMasterPitchbend (Zone&,
int);
223 void updatePerNotePitchbendRange (Zone&,
int);
225 void sendLayoutChangeMessage();
226 void checkAndLimitZoneParameters (
int,
int,
int&) noexcept;
virtual void zoneLayoutChanged(const MPEZoneLayout &layout)=0
Implement this callback to be notified about any changes to this MPEZoneLayout.
virtual ~Listener()=default
Destructor.
This class represents the current MPE zone layout of a device capable of handling MPE.
const Zone getUpperZone() const noexcept
Returns a struct representing the upper MPE zone.
Holds a sequence of time-stamped midi events.
Encapsulates a MIDI message.
#define JUCE_API
This macro is added to all JUCE public class declarations.
This struct represents an MPE zone.