61 virtual bool appliesToNote (
int midiNoteNumber) = 0;
68 virtual bool appliesToChannel (
int midiChannel) = 0;
126 virtual void startNote (
int midiNoteNumber,
129 int currentPitchWheelPosition) = 0;
146 virtual void stopNote (
float velocity,
bool allowTailOff) = 0;
152 virtual bool isVoiceActive()
const;
157 virtual void pitchWheelMoved (
int newPitchWheelValue) = 0;
162 virtual void controllerMoved (
int controllerNumber,
int newControllerValue) = 0;
167 virtual void aftertouchChanged (
int newAftertouchValue);
172 virtual void channelPressureChanged (
int newChannelPressureValue);
207 virtual void setCurrentPlaybackSampleRate (
double newRate);
214 virtual bool isPlayingChannel (
int midiChannel)
const;
230 void setKeyDown (
bool isNowDown) noexcept { keyIsDown = isNowDown; }
247 return isVoiceActive() && ! (isKeyDown() || isSostenutoPedalDown() || isSustainPedalDown());
266 void clearCurrentNote();
273 double currentSampleRate = 44100.0;
274 int currentlyPlayingNote = -1, currentPlayingMidiChannel = 0;
275 uint32 noteOnTime = 0;
277 bool keyIsDown =
false, sustainPedalDown =
false, sostenutoPedalDown =
false;
281 #if JUCE_CATCH_DEPRECATED_CODE_MISUSE 283 virtual int stopNote (
bool) {
return 0; }
349 void removeVoice (
int index);
369 void removeSound (
int index);
378 void setNoteStealingEnabled (
bool shouldStealNotes);
399 virtual void noteOn (
int midiChannel,
415 virtual void noteOff (
int midiChannel,
434 virtual void allNotesOff (
int midiChannel,
448 virtual void handlePitchWheel (
int midiChannel,
463 virtual void handleController (
int midiChannel,
464 int controllerNumber,
465 int controllerValue);
480 virtual void handleAftertouch (
int midiChannel,
int midiNoteNumber,
int aftertouchValue);
494 virtual void handleChannelPressure (
int midiChannel,
int channelPressureValue);
497 virtual void handleSustainPedal (
int midiChannel,
bool isDown);
500 virtual void handleSostenutoPedal (
int midiChannel,
bool isDown);
503 virtual void handleSoftPedal (
int midiChannel,
bool isDown);
509 virtual void handleProgramChange (
int midiChannel,
518 virtual void setCurrentPlaybackSampleRate (
double sampleRate);
567 void setMinimumRenderingSubdivisionSize (
int numSamples,
bool shouldBeStrict =
false) noexcept;
578 int lastPitchWheelValues [16];
585 int startSample,
int numSamples);
587 int startSample,
int numSamples);
600 bool stealIfNoneAvailable)
const;
609 int midiNoteNumber)
const;
633 double sampleRate = 0;
634 uint32 lastNoteOnCounter = 0;
635 int minimumSubBlockSize = 32;
636 bool subBlockSubdivisionIsStrict =
false;
637 bool shouldStealNotes =
true;
640 template <
typename floatType>
643 #if JUCE_CATCH_DEPRECATED_CODE_MISUSE 645 virtual int findFreeVoice (
const bool)
const {
return 0; }
646 virtual int noteOff (
int,
int,
int) {
return 0; }
651 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (
Synthesiser)
#define JUCE_API
This macro is added to all JUCE public class declarations.
bool isSustainPedalDown() const noexcept
Returns true if the sustain pedal is currently active for this voice.
Encapsulates a MIDI message.
bool isNoteStealingEnabled() const noexcept
Returns true if note-stealing is enabled.
int getNumVoices() const noexcept
Returns the number of voices that have been added.
void setSostenutoPedalDown(bool isNowDown) noexcept
Modifies the sostenuto pedal flag.
SynthesiserSound::Ptr getCurrentlyPlayingSound() const noexcept
Returns the sound that this voice is currently playing.
Describes one of the sounds that a Synthesiser can play.
An arbitrarily large integer class.
void setSustainPedalDown(bool isNowDown) noexcept
Modifies the sustain pedal flag.
SynthesiserSound::Ptr getSound(int index) const noexcept
Returns one of the sounds.
Base class for a musical device that can play sounds.
bool isKeyDown() const noexcept
Returns true if the key that triggered this voice is still held down.
Represents a voice that a Synthesiser can use to play a SynthesiserSound.
Holds a sequence of time-stamped midi events.
int getNumSounds() const noexcept
Returns the number of sounds that have been added to the synth.
bool isPlayingButReleased() const noexcept
Returns true if a voice is sounding in its release phase.
int getCurrentlyPlayingNote() const noexcept
Returns the midi note that this voice is currently playing.
CriticalSection lock
This is used to control access to the rendering callback and the note trigger methods.
double getSampleRate() const noexcept
Returns the current target sample rate at which rendering is being done.
An array designed for holding objects.
A base class which provides methods for reference-counting.
double getSampleRate() const noexcept
Returns the current target sample rate at which rendering is being done.
bool isSostenutoPedalDown() const noexcept
Returns true if the sostenuto pedal is currently active for this voice.
Holds a list of objects derived from ReferenceCountedObject, or which implement basic reference-count...
void setKeyDown(bool isNowDown) noexcept
Allows you to modify the flag indicating that the key that triggered this voice is still held down...