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;
344 void removeVoice (
int index);
364 void removeSound (
int index);
373 void setNoteStealingEnabled (
bool shouldStealNotes);
394 virtual void noteOn (
int midiChannel,
410 virtual void noteOff (
int midiChannel,
429 virtual void allNotesOff (
int midiChannel,
443 virtual void handlePitchWheel (
int midiChannel,
458 virtual void handleController (
int midiChannel,
459 int controllerNumber,
460 int controllerValue);
475 virtual void handleAftertouch (
int midiChannel,
int midiNoteNumber,
int aftertouchValue);
489 virtual void handleChannelPressure (
int midiChannel,
int channelPressureValue);
492 virtual void handleSustainPedal (
int midiChannel,
bool isDown);
495 virtual void handleSostenutoPedal (
int midiChannel,
bool isDown);
498 virtual void handleSoftPedal (
int midiChannel,
bool isDown);
504 virtual void handleProgramChange (
int midiChannel,
513 virtual void setCurrentPlaybackSampleRate (
double sampleRate);
562 void setMinimumRenderingSubdivisionSize (
int numSamples,
bool shouldBeStrict =
false) noexcept;
573 int lastPitchWheelValues [16];
580 int startSample,
int numSamples);
582 int startSample,
int numSamples);
595 bool stealIfNoneAvailable)
const;
604 int midiNoteNumber)
const;
628 double sampleRate = 0;
629 uint32 lastNoteOnCounter = 0;
630 int minimumSubBlockSize = 32;
631 bool subBlockSubdivisionIsStrict =
false;
632 bool shouldStealNotes =
true;
635 template <
typename floatType>
638 #if JUCE_CATCH_DEPRECATED_CODE_MISUSE 640 virtual int findFreeVoice (
const bool)
const {
return 0; }
641 virtual int noteOff (
int,
int,
int) {
return 0; }
646 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...