42 amplitude = newAmplitude;
47 frequency = newFrequencyHz;
65 if (phasePerSample == 0.0)
70 const float sample = amplitude * (float) std::sin (currentPhase);
71 currentPhase += phasePerSample;
void releaseResources() override
Implementation of the AudioSource method.
int numSamples
The number of samples in the buffer which the callback is expected to fill with data.
ToneGeneratorAudioSource()
Creates a ToneGeneratorAudioSource.
void getNextAudioBlock(const AudioSourceChannelInfo &) override
Implementation of the AudioSource method.
int getNumChannels() const noexcept
Returns the number of channels of audio data that this buffer contains.
int startSample
The first sample in the buffer from which the callback is expected to write data. ...
AudioBuffer< float > * buffer
The destination buffer to fill with audio data.
void prepareToPlay(int samplesPerBlockExpected, double sampleRate) override
Implementation of the AudioSource method.
void setSample(int destChannel, int destSample, Type newValue) noexcept
Sets a sample in the buffer.
Commonly used mathematical constants.
Used by AudioSource::getNextAudioBlock().
void setFrequency(double newFrequencyHz)
Sets the signal's frequency.
~ToneGeneratorAudioSource() override
Destructor.
void setAmplitude(float newAmplitude)
Sets the signal's amplitude.