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