37template <
typename SampleType>
44 using NumericType =
typename SampleTypeHelpers::ElementType<SampleType>::Type;
74 lookupTable.reset (
table);
104 rampBuffer.
resize ((
int)
spec.maximumBlockSize);
115 frequency.
reset (sampleRate, 0.05);
128 template <
typename ProcessContext>
136 jassert (
outBlock.getNumSamples() <=
static_cast<size_t> (rampBuffer.
size()));
139 auto numChannels =
outBlock.getNumChannels();
140 auto inputChannels =
inBlock.getNumChannels();
150 for (
size_t i = 0; i <
len; ++i)
158 if (
context.usesSeparateInputAndOutputBlocks())
160 for (
ch = 0;
ch < jmin (numChannels, inputChannels); ++
ch)
165 for (
size_t i = 0; i <
len; ++i)
166 dst[i] =
src[i] + generator (buffer[i]);
171 for (
ch = 0;
ch < jmin (numChannels, inputChannels); ++
ch)
175 for (
size_t i = 0; i <
len; ++i)
176 dst[i] += generator (buffer[i]);
180 for (;
ch < numChannels; ++
ch)
184 for (
size_t i = 0; i <
len; ++i)
185 dst[i] = generator (buffer[i]);
196 frequency.
skip (
static_cast<int> (
len));
203 if (
context.usesSeparateInputAndOutputBlocks())
205 for (
ch = 0;
ch < jmin (numChannels, inputChannels); ++
ch)
211 for (
size_t i = 0; i <
len; ++i)
217 for (
ch = 0;
ch < jmin (numChannels, inputChannels); ++
ch)
222 for (
size_t i = 0; i <
len; ++i)
227 for (;
ch < numChannels; ++
ch)
232 for (
size_t i = 0; i <
len; ++i)
244 std::unique_ptr<LookupTableTransform<NumericType>> lookupTable;
int size() const noexcept
ElementType * getRawDataPointer() noexcept
void resize(int targetNumItems)
bool isSmoothing() const noexcept
void setCurrentAndTargetValue(FloatType newValue)
FloatType getTargetValue() const noexcept
FloatType skip(int numSamples) noexcept
FloatType getNextValue() noexcept
void reset(double sampleRate, double rampLengthInSeconds) noexcept
void setTargetValue(FloatType newValue) noexcept
SampleType JUCE_VECTOR_CALLTYPE processSample(SampleType input) noexcept
Oscillator(const std::function< NumericType(NumericType)> &function, size_t lookupTableNumPoints=0)
void prepare(const ProcessSpec &spec) noexcept
bool isInitialised() const noexcept
typename SampleTypeHelpers::ElementType< SampleType >::Type NumericType
NumericType getFrequency() const noexcept
void process(const ProcessContext &context) noexcept
void setFrequency(NumericType newFrequency, bool force=false) noexcept
void initialise(const std::function< NumericType(NumericType)> &function, size_t lookupTableNumPoints=0)
Type advance(Type increment) noexcept