mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Allow simulating poly-aftertouch messages in MPEInstrument
This commit is contained in:
parent
5666d5b1b0
commit
1a22a3fafb
2 changed files with 27 additions and 12 deletions
|
|
@ -258,18 +258,8 @@ void MPEInstrument::processMidiAfterTouchMessage (const MidiMessage& message)
|
|||
if (! isMasterChannel (message.getChannel()))
|
||||
return;
|
||||
|
||||
const ScopedLock sl (lock);
|
||||
|
||||
for (auto i = notes.size(); --i >= 0;)
|
||||
{
|
||||
auto& note = notes.getReference (i);
|
||||
|
||||
if (note.midiChannel == message.getChannel() && note.initialNote == message.getNoteNumber())
|
||||
{
|
||||
pressureDimension.getValue (note) = MPEValue::from7BitInt (message.getAfterTouchValue());
|
||||
listeners.call ([&] (Listener& l) { l.notePressureChanged (note); });
|
||||
}
|
||||
}
|
||||
polyAftertouch (message.getChannel(), message.getNoteNumber(),
|
||||
MPEValue::from7BitInt (message.getAfterTouchValue()));
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -385,6 +375,24 @@ void MPEInstrument::timbre (int midiChannel, MPEValue value)
|
|||
updateDimension (midiChannel, timbreDimension, value);
|
||||
}
|
||||
|
||||
void MPEInstrument::polyAftertouch (int midiChannel, int midiNoteNumber, MPEValue value)
|
||||
{
|
||||
const ScopedLock sl (lock);
|
||||
|
||||
for (auto i = notes.size(); --i >= 0;)
|
||||
{
|
||||
auto& note = notes.getReference (i);
|
||||
|
||||
if (note.midiChannel == midiChannel
|
||||
&& note.initialNote == midiNoteNumber
|
||||
&& pressureDimension.getValue (note) != value)
|
||||
{
|
||||
pressureDimension.getValue (note) = value;
|
||||
callListenersDimensionChanged (note, pressureDimension);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MPEValue MPEInstrument::getInitialValueForNewNote (int midiChannel, MPEDimension& dimension) const
|
||||
{
|
||||
if (getLastNotePlayedPtr (midiChannel) != nullptr)
|
||||
|
|
|
|||
|
|
@ -185,6 +185,13 @@ public:
|
|||
*/
|
||||
virtual void timbre (int midiChannel, MPEValue value);
|
||||
|
||||
/** Request a poly-aftertouch change for a given note number.
|
||||
|
||||
The change will be broadcast to all notes sharing the channel and note
|
||||
number of the change message.
|
||||
*/
|
||||
virtual void polyAftertouch (int midiChannel, int midiNoteNumber, MPEValue value);
|
||||
|
||||
/** Request a sustain pedal press or release.
|
||||
|
||||
If midiChannel is a zone's master channel, this will act on all notes in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue