LMMS
Loading...
Searching...
No Matches
juce_MPEInstrument.h
Go to the documentation of this file.
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 The code included in this file is provided under the terms of the ISC license
11 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12 To use, copy, modify, and/or distribute this software for any purpose with or
13 without fee is hereby granted provided that the above copyright notice and
14 this permission notice appear in all copies.
15
16 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18 DISCLAIMED.
19
20 ==============================================================================
21*/
22
23namespace juce
24{
25
26//==============================================================================
54{
55public:
63 MPEInstrument() noexcept;
64
67
69 virtual ~MPEInstrument();
70
71 //==============================================================================
79
86 void setZoneLayout (MPEZoneLayout newLayout);
87
94 bool isMemberChannel (int midiChannel) const noexcept;
95
101 bool isMasterChannel (int midiChannel) const noexcept;
102
109 bool isUsingChannel (int midiChannel) const noexcept;
110
111 //==============================================================================
126
128 void setPressureTrackingMode (TrackingMode modeToUse);
129
131 void setPitchbendTrackingMode (TrackingMode modeToUse);
132
134 void setTimbreTrackingMode (TrackingMode modeToUse);
135
136 //==============================================================================
143 virtual void processNextMidiEvent (const MidiMessage& message);
144
145 //==============================================================================
152 virtual void noteOn (int midiChannel, int midiNoteNumber, MPEValue midiNoteOnVelocity);
153
160 virtual void noteOff (int midiChannel, int midiNoteNumber, MPEValue midiNoteOffVelocity);
161
170 virtual void pitchbend (int midiChannel, MPEValue pitchbend);
171
178 virtual void pressure (int midiChannel, MPEValue value);
179
187 virtual void timbre (int midiChannel, MPEValue value);
188
194 virtual void polyAftertouch (int midiChannel, int midiNoteNumber, MPEValue value);
195
201 virtual void sustainPedal (int midiChannel, bool isDown);
202
208 virtual void sostenutoPedal (int midiChannel, bool isDown);
209
214 void releaseAllNotes();
215
216 //==============================================================================
218 int getNumPlayingNotes() const noexcept;
219
225 MPENote getNote (int index) const noexcept;
226
231 MPENote getNote (int midiChannel, int midiNoteNumber) const noexcept;
232
234 MPENote getNoteWithID (uint16 noteID) const noexcept;
235
241 MPENote getMostRecentNote (int midiChannel) const noexcept;
242
248 MPENote getMostRecentNoteOtherThan (MPENote otherThanThisNote) const noexcept;
249
250 //==============================================================================
260 {
261 public:
263 virtual ~Listener() = default;
264
268 virtual void noteAdded (MPENote newNote) { ignoreUnused (newNote); }
269
273 virtual void notePressureChanged (MPENote changedNote) { ignoreUnused (changedNote); }
274
282 virtual void notePitchbendChanged (MPENote changedNote) { ignoreUnused (changedNote); }
283
287 virtual void noteTimbreChanged (MPENote changedNote) { ignoreUnused (changedNote); }
288
296 virtual void noteKeyStateChanged (MPENote changedNote) { ignoreUnused (changedNote); }
297
303 virtual void noteReleased (MPENote finishedNote) { ignoreUnused (finishedNote); }
304
308 virtual void zoneLayoutChanged() {}
309 };
310
311 //==============================================================================
313 void addListener (Listener* listenerToAdd);
314
316 void removeListener (Listener* listenerToRemove);
317
318 //==============================================================================
340 void enableLegacyMode (int pitchbendRange = 2,
341 Range<int> channelRange = Range<int> (1, 17));
342
344 bool isLegacyModeEnabled() const noexcept;
345
347 Range<int> getLegacyModeChannelRange() const noexcept;
348
350 void setLegacyModeChannelRange (Range<int> channelRange);
351
353 int getLegacyModePitchbendRange() const noexcept;
354
356 void setLegacyModePitchbendRange (int pitchbendRange);
357
358protected:
359 //==============================================================================
361
362private:
363 //==============================================================================
367
371
373 {
374 bool isEnabled = false;
377 };
378
386
389
391
392 void updateDimension (int midiChannel, MPEDimension&, MPEValue);
396 MPEValue getInitialValueForNewNote (int midiChannel, MPEDimension&) const;
397
405 void handlePressureMSB (int midiChannel, int value) noexcept;
406 void handlePressureLSB (int midiChannel, int value) noexcept;
407 void handleTimbreMSB (int midiChannel, int value) noexcept;
408 void handleTimbreLSB (int midiChannel, int value) noexcept;
409 void handleSustainOrSostenuto (int midiChannel, bool isDown, bool isSostenuto);
410
411 const MPENote* getNotePtr (int midiChannel, int midiNoteNumber) const noexcept;
412 MPENote* getNotePtr (int midiChannel, int midiNoteNumber) noexcept;
413 const MPENote* getNotePtr (int midiChannel, TrackingMode) const noexcept;
414 MPENote* getNotePtr (int midiChannel, TrackingMode) noexcept;
415 const MPENote* getLastNotePlayedPtr (int midiChannel) const noexcept;
416 MPENote* getLastNotePlayedPtr (int midiChannel) noexcept;
417 const MPENote* getHighestNotePtr (int midiChannel) const noexcept;
418 MPENote* getHighestNotePtr (int midiChannel) noexcept;
419 const MPENote* getLowestNotePtr (int midiChannel) const noexcept;
420 MPENote* getLowestNotePtr (int midiChannel) noexcept;
422
424};
425
426} // namespace juce
#define noexcept
Definition DistrhoDefines.h:72
static void message(int level, const char *fmt,...)
Definition adplugdb.cpp:120
Definition juce_Array.h:56
Definition juce_CriticalSection.h:43
Definition juce_ListenerList.h:70
Definition juce_MPEInstrument.h:260
virtual void notePitchbendChanged(MPENote changedNote)
Definition juce_MPEInstrument.h:282
virtual void noteAdded(MPENote newNote)
Definition juce_MPEInstrument.h:268
virtual void notePressureChanged(MPENote changedNote)
Definition juce_MPEInstrument.h:273
virtual void noteTimbreChanged(MPENote changedNote)
Definition juce_MPEInstrument.h:287
virtual void noteReleased(MPENote finishedNote)
Definition juce_MPEInstrument.h:303
virtual ~Listener()=default
virtual void zoneLayoutChanged()
Definition juce_MPEInstrument.h:308
virtual void noteKeyStateChanged(MPENote changedNote)
Definition juce_MPEInstrument.h:296
void updateDimensionForNote(MPENote &, MPEDimension &, MPEValue)
Definition juce_MPEInstrument.cpp:513
bool isMemberChannelSustained[16]
Definition juce_MPEInstrument.h:370
void processMidiControllerMessage(const MidiMessage &)
Definition juce_MPEInstrument.cpp:246
void processMidiPitchWheelMessage(const MidiMessage &)
Definition juce_MPEInstrument.cpp:232
MPEZoneLayout getZoneLayout() const noexcept
Definition juce_MPEInstrument.cpp:63
void updateNoteTotalPitchbend(MPENote &)
Definition juce_MPEInstrument.cpp:535
bool isMemberChannel(int midiChannel) const noexcept
Definition juce_MPEInstrument.cpp:645
void processMidiAfterTouchMessage(const MidiMessage &)
Definition juce_MPEInstrument.cpp:301
MPEZoneLayout zoneLayout
Definition juce_MPEInstrument.h:365
virtual ~MPEInstrument()
void handlePressureMSB(int midiChannel, int value) noexcept
Definition juce_MPEInstrument.cpp:311
void processMidiNoteOnMessage(const MidiMessage &)
Definition juce_MPEInstrument.cpp:203
TrackingMode
Definition juce_MPEInstrument.h:120
@ highestNoteOnChannel
Definition juce_MPEInstrument.h:123
@ lowestNoteOnChannel
Definition juce_MPEInstrument.h:122
@ lastNotePlayedOnChannel
Definition juce_MPEInstrument.h:121
@ allNotesOnChannel
Definition juce_MPEInstrument.h:124
void resetLastReceivedValues()
Definition juce_MPEInstrument.cpp:68
CriticalSection lock
Definition juce_MPEInstrument.h:360
ListenerList< Listener > listeners
Definition juce_MPEInstrument.h:366
MPEInstrument() noexcept
Definition juce_MPEInstrument.cpp:39
void setZoneLayout(MPEZoneLayout newLayout)
Definition juce_MPEInstrument.cpp:85
MPEDimension pitchbendDimension
Definition juce_MPEInstrument.h:388
void processMidiNoteOffMessage(const MidiMessage &)
Definition juce_MPEInstrument.cpp:224
void updateDimension(int midiChannel, MPEDimension &, MPEValue)
Definition juce_MPEInstrument.cpp:450
const MPENote * getLastNotePlayedPtr(int midiChannel) const noexcept
Definition juce_MPEInstrument.cpp:766
MPEDimension timbreDimension
Definition juce_MPEInstrument.h:388
void handleSustainOrSostenuto(int midiChannel, bool isDown, bool isSostenuto)
Definition juce_MPEInstrument.cpp:588
void handlePressureLSB(int midiChannel, int value) noexcept
Definition juce_MPEInstrument.cpp:319
const MPENote * getNotePtr(int midiChannel, int midiNoteNumber) const noexcept
Definition juce_MPEInstrument.cpp:728
MPEDimension pressureDimension
Definition juce_MPEInstrument.h:388
void updateDimensionMaster(bool, MPEDimension &, MPEValue)
Definition juce_MPEInstrument.cpp:482
const MPENote * getLowestNotePtr(int midiChannel) const noexcept
Definition juce_MPEInstrument.cpp:814
void processMidiResetAllControllersMessage(const MidiMessage &)
Definition juce_MPEInstrument.cpp:261
void handleTimbreLSB(int midiChannel, int value) noexcept
Definition juce_MPEInstrument.cpp:332
MPEValue getInitialValueForNewNote(int midiChannel, MPEDimension &) const
Definition juce_MPEInstrument.cpp:441
uint8 lastTimbreLowerBitReceivedOnChannel[16]
Definition juce_MPEInstrument.h:369
void handleTimbreMSB(int midiChannel, int value) noexcept
Definition juce_MPEInstrument.cpp:324
void processMidiChannelPressureMessage(const MidiMessage &)
Definition juce_MPEInstrument.cpp:239
Array< MPENote > notes
Definition juce_MPEInstrument.h:364
const MPENote * getHighestNotePtr(int midiChannel) const noexcept
Definition juce_MPEInstrument.cpp:788
void callListenersDimensionChanged(const MPENote &, const MPEDimension &)
Definition juce_MPEInstrument.cpp:527
bool isMasterChannel(int midiChannel) const noexcept
Definition juce_MPEInstrument.cpp:654
uint8 lastPressureLowerBitReceivedOnChannel[16]
Definition juce_MPEInstrument.h:368
bool isUsingChannel(int midiChannel) const noexcept
Definition juce_MPEInstrument.cpp:666
LegacyMode legacyMode
Definition juce_MPEInstrument.h:387
Definition juce_MPEValue.h:37
Definition juce_MPEZoneLayout.h:121
Definition juce_MidiMessage.h:35
Definition juce_Range.h:40
static PuglViewHint int value
Definition pugl.h:1708
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
#define JUCE_API
Definition juce_StandardHeader.h:152
Definition carla_juce.cpp:31
unsigned short uint16
Definition juce_MathsFunctions.h:41
void ignoreUnused(Types &&...) noexcept
Definition juce_MathsFunctions.h:333
unsigned char uint8
Definition juce_MathsFunctions.h:37
Definition juce_MPEInstrument.h:373
Range< int > channelRange
Definition juce_MPEInstrument.h:375
bool isEnabled
Definition juce_MPEInstrument.h:374
int pitchbendRange
Definition juce_MPEInstrument.h:376
Definition juce_MPEInstrument.h:380
TrackingMode trackingMode
Definition juce_MPEInstrument.h:381
MPEValue MPENote::* value
Definition juce_MPEInstrument.h:383
MPEValue & getValue(MPENote &note) noexcept
Definition juce_MPEInstrument.h:384
MPEValue lastValueReceivedOnChannel[16]
Definition juce_MPEInstrument.h:382
Definition juce_MPENote.h:40
#define const
Definition zconf.h:137