125 int currentPitchWheelPosition) = 0;
142 virtual void stopNote (
float velocity,
bool allowTailOff) = 0;
148 virtual bool isVoiceActive()
const;
163 virtual void aftertouchChanged (
int newAftertouchValue);
168 virtual void channelPressureChanged (
int newChannelPressureValue);
203 virtual void setCurrentPlaybackSampleRate (
double newRate);
210 virtual bool isPlayingChannel (
int midiChannel)
const;
226 void setKeyDown (
bool isNowDown)
noexcept { keyIsDown = isNowDown; }
243 return isVoiceActive() && ! (isKeyDown() || isSostenutoPedalDown() || isSustainPedalDown());
262 void clearCurrentNote();
269 double currentSampleRate = 44100.0;
270 int currentlyPlayingNote = -1, currentPlayingMidiChannel = 0;
273 bool keyIsDown =
false, sustainPedalDown =
false, sostenutoPedalDown =
false;
340 void removeVoice (
int index);
360 void removeSound (
int index);
369 void setNoteStealingEnabled (
bool shouldStealNotes);
390 virtual void noteOn (
int midiChannel,
406 virtual void noteOff (
int midiChannel,
425 virtual void allNotesOff (
int midiChannel,
439 virtual void handlePitchWheel (
int midiChannel,
454 virtual void handleController (
int midiChannel,
455 int controllerNumber,
456 int controllerValue);
471 virtual void handleAftertouch (
int midiChannel,
int midiNoteNumber,
int aftertouchValue);
485 virtual void handleChannelPressure (
int midiChannel,
int channelPressureValue);
488 virtual void handleSustainPedal (
int midiChannel,
bool isDown);
491 virtual void handleSostenutoPedal (
int midiChannel,
bool isDown);
494 virtual void handleSoftPedal (
int midiChannel,
bool isDown);
500 virtual void handleProgramChange (
int midiChannel,
509 virtual void setCurrentPlaybackSampleRate (
double sampleRate);
558 void setMinimumRenderingSubdivisionSize (
int numSamples,
bool shouldBeStrict =
false) noexcept;
569 int lastPitchWheelValues [16];
575 virtual
void renderVoices (
AudioBuffer<
float>& outputAudio,
576 int startSample,
int numSamples);
577 virtual
void renderVoices (
AudioBuffer<
double>& outputAudio,
578 int startSample,
int numSamples);
591 bool stealIfNoneAvailable) const;
600 int midiNoteNumber) const;
624 double sampleRate = 0;
625 uint32 lastNoteOnCounter = 0;
626 int minimumSubBlockSize = 32;
627 bool subBlockSubdivisionIsStrict = false;
628 bool shouldStealNotes = true;
633 template <typename floatType>
Holds a resizable array of primitive or copy-by-value objects.
A multi-channel buffer containing floating point audio samples.
An arbitrarily large integer class.
Holds a sequence of time-stamped midi events.
Encapsulates a MIDI message.
An array designed for holding objects.
Holds a list of objects derived from ReferenceCountedObject, or which implement basic reference-count...
A base class which provides methods for reference-counting.
Describes one of the sounds that a Synthesiser can play.
virtual bool appliesToNote(int midiNoteNumber)=0
Returns true if this sound should be played when a given midi note is pressed.
virtual bool appliesToChannel(int midiChannel)=0
Returns true if the sound should be triggered by midi events on a given channel.
Represents a voice that a Synthesiser can use to play a SynthesiserSound.
bool isSostenutoPedalDown() const noexcept
Returns true if the sostenuto pedal is currently active for this voice.
double getSampleRate() const noexcept
Returns the current target sample rate at which rendering is being done.
virtual void stopNote(float velocity, bool allowTailOff)=0
Called to stop a note.
bool isSustainPedalDown() const noexcept
Returns true if the sustain pedal is currently active for this voice.
void setSustainPedalDown(bool isNowDown) noexcept
Modifies the sustain pedal flag.
void setSostenutoPedalDown(bool isNowDown) noexcept
Modifies the sostenuto pedal flag.
virtual void renderNextBlock(AudioBuffer< float > &outputBuffer, int startSample, int numSamples)=0
Renders the next block of data for this voice.
bool isKeyDown() const noexcept
Returns true if the key that triggered this voice is still held down.
void setKeyDown(bool isNowDown) noexcept
Allows you to modify the flag indicating that the key that triggered this voice is still held down.
virtual void controllerMoved(int controllerNumber, int newControllerValue)=0
Called to let the voice know that a midi controller has been moved.
int getCurrentlyPlayingNote() const noexcept
Returns the midi note that this voice is currently playing.
virtual void startNote(int midiNoteNumber, float velocity, SynthesiserSound *sound, int currentPitchWheelPosition)=0
Called to start a new note.
virtual bool canPlaySound(SynthesiserSound *)=0
Must return true if this voice object is capable of playing the given sound.
virtual void pitchWheelMoved(int newPitchWheelValue)=0
Called to let the voice know that the pitch wheel has been moved.
bool isPlayingButReleased() const noexcept
Returns true if a voice is sounding in its release phase.
SynthesiserSound::Ptr getCurrentlyPlayingSound() const noexcept
Returns the sound that this voice is currently playing.
Base class for a musical device that can play sounds.
int getNumSounds() const noexcept
Returns the number of sounds that have been added to the synth.
double getSampleRate() const noexcept
Returns the current target sample rate at which rendering is being done.
int getNumVoices() const noexcept
Returns the number of voices that have been added.
bool isNoteStealingEnabled() const noexcept
Returns true if note-stealing is enabled.
SynthesiserSound::Ptr getSound(int index) const noexcept
Returns one of the sounds.
#define JUCE_LEAK_DETECTOR(OwnerClass)
This macro lets you embed a leak-detecting object inside a class.
unsigned int uint32
A platform-independent 32-bit unsigned integer type.