53 instrument->enableLegacyMode (pitchbendRange, channelRange);
63 return instrument->getLegacyModeChannelRange();
68 instrument->setLegacyModeChannelRange (channelRange);
73 return instrument->getLegacyModePitchbendRange();
78 instrument->setLegacyModePitchbendRange (pitchbendRange);
84 instrument->setPressureTrackingMode (modeToUse);
89 instrument->setPitchbendTrackingMode (modeToUse);
104template <
typename floatType>
111 jassert (sampleRate != 0);
116 bool firstEvent =
true;
122 while (numSamples > 0)
130 auto samplesToNextMidiMessage = midiEventPos - startSample;
132 if (samplesToNextMidiMessage >= numSamples)
139 if (samplesToNextMidiMessage < ((firstEvent && ! subBlockSubdivisionIsStrict) ? 1 : minimumSubBlockSize))
149 startSample += samplesToNextMidiMessage;
150 numSamples -= samplesToNextMidiMessage;
164 if (sampleRate != newRate)
168 sampleRate = newRate;
175 jassert (numSamples > 0);
176 minimumSubBlockSize = numSamples;
177 subBlockSubdivisionIsStrict = shouldBeStrict;
A multi-channel buffer containing floating point audio samples.
Automatically locks and unlocks a mutex object.
This class represents an instrument handling MPE.
TrackingMode
The MPE note tracking mode.
This class represents the current MPE zone layout of a device capable of handling MPE.
Used to iterate through the events in a MidiBuffer.
void setNextSamplePosition(int samplePosition) noexcept
Repositions the iterator so that the next event retrieved will be the first one whose sample position...
bool getNextEvent(MidiMessage &result, int &samplePosition) noexcept
Retrieves a copy of the next event from the buffer.
Holds a sequence of time-stamped midi events.
Encapsulates a MIDI message.
A general-purpose range object, that simply represents any linear range with a start and end point.
void setPitchbendTrackingMode(TrackingMode modeToUse)
Set the MPE tracking mode for the pitchbend dimension.
virtual void handleMidiEvent(const MidiMessage &)
Handle incoming MIDI events (called from renderNextBlock).
bool isLegacyModeEnabled() const noexcept
Returns true if the instrument is in legacy mode, false otherwise.
MPEZoneLayout getZoneLayout() const noexcept
Returns the synthesiser's internal MPE zone layout.
void setZoneLayout(MPEZoneLayout newLayout)
Re-sets the synthesiser's internal MPE zone layout to the one passed in.
int getLegacyModePitchbendRange() const noexcept
Returns the pitchbend range in semitones (0-96) to be used for notes when in legacy mode.
void setLegacyModeChannelRange(Range< int > channelRange)
Re-sets the range of MIDI channels (1-16) to be used for notes when in legacy mode.
void setLegacyModePitchbendRange(int pitchbendRange)
Re-sets the pitchbend range in semitones (0-96) to be used for notes when in legacy mode.
void enableLegacyMode(int pitchbendRange=2, Range< int > channelRange=Range< int >(1, 17))
Puts the synthesiser into legacy mode.
void setTimbreTrackingMode(TrackingMode modeToUse)
Set the MPE tracking mode for the timbre dimension.
std::unique_ptr< MPEInstrument > instrument
void setPressureTrackingMode(TrackingMode modeToUse)
Set the MPE tracking mode for the pressure dimension.
Range< int > getLegacyModeChannelRange() const noexcept
Returns the range of MIDI channels (1-16) to be used for notes when in legacy mode.
virtual void setCurrentPlaybackSampleRate(double sampleRate)
Tells the synthesiser what the sample rate is for the audio it's being used to render.
void renderNextBlock(AudioBuffer< floatType > &outputAudio, const MidiBuffer &inputMidi, int startSample, int numSamples)
Creates the next block of audio output.
void setMinimumRenderingSubdivisionSize(int numSamples, bool shouldBeStrict=false) noexcept
Sets a minimum limit on the size to which audio sub-blocks will be divided when rendering.
virtual void renderNextSubBlock(AudioBuffer< float > &outputAudio, int startSample, int numSamples)=0
Implement this method to render your audio inside.
MPESynthesiserBase()
Constructor.