37 sourceSampleRate (source.sampleRate),
48 source.
read (data.get(), 0, length + 4, 0,
true,
true);
85 sourceSamplePosition = 0.0;
122 const float*
const inL = data.getReadPointer (0);
123 const float*
const inR = data.getNumChannels() > 1 ? data.getReadPointer (1) :
nullptr;
128 while (--numSamples >= 0)
130 auto pos = (
int) sourceSamplePosition;
131 auto alpha = (
float) (sourceSamplePosition - pos);
151 *
outL++ += (
l + r) * 0.5f;
154 sourceSamplePosition += pitchRatio;
void setSampleRate(double newSampleRate) noexcept
Sets the sample rate that will be used for the envelope.
void noteOff() noexcept
Starts the release phase of the envelope.
void reset() noexcept
Resets the envelope to an idle state.
float getNextSample() noexcept
Returns the next sample value for an ADSR object.
void setParameters(const Parameters &newParameters)
Sets the parameters that will be used by an ADSR object.
void noteOn() noexcept
Starts the attack phase of the envelope.
A multi-channel buffer containing floating point audio samples.
An arbitrarily large integer class.
A subclass of SynthesiserSound that represents a sampled audio clip.
bool appliesToChannel(int midiChannel) override
Returns true if the sound should be triggered by midi events on a given channel.
SamplerSound(const String &name, AudioFormatReader &source, const BigInteger &midiNotes, int midiNoteForNormalPitch, double attackTimeSecs, double releaseTimeSecs, double maxSampleLengthSeconds)
Creates a sampled sound from an audio reader.
bool appliesToNote(int midiNoteNumber) override
Returns true if this sound should be played when a given midi note is pressed.
~SamplerSound() override
Destructor.
~SamplerVoice() override
Destructor.
void startNote(int midiNoteNumber, float velocity, SynthesiserSound *, int pitchWheel) override
Called to start a new note.
void controllerMoved(int controllerNumber, int newValue) override
Called to let the voice know that a midi controller has been moved.
bool canPlaySound(SynthesiserSound *) override
Must return true if this voice object is capable of playing the given sound.
void renderNextBlock(AudioBuffer< float > &, int startSample, int numSamples) override
Renders the next block of data for this voice.
void pitchWheelMoved(int newValue) override
Called to let the voice know that the pitch wheel has been moved.
SamplerVoice()
Creates a SamplerVoice.
void stopNote(float velocity, bool allowTailOff) override
Called to stop a note.
Describes one of the sounds that a Synthesiser can play.
double getSampleRate() const noexcept
Returns the current target sample rate at which rendering is being done.
void clearCurrentNote()
Resets the state of this voice after a sound has finished playing.
SynthesiserSound::Ptr getCurrentlyPlayingSound() const noexcept
Returns the sound that this voice is currently playing.
constexpr Type jmin(Type a, Type b)
Returns the smaller of two values.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...