34template <
typename SampleType>
41 using NumericType =
typename SampleTypeHelpers::ElementType<SampleType>::Type;
71 lookupTable.reset (
table);
101 rampBuffer.
resize ((
int)
spec.maximumBlockSize);
112 frequency.
reset (sampleRate, 0.05);
125 template <
typename ProcessContext>
133 jassert (
outBlock.getNumSamples() <=
static_cast<size_t> (rampBuffer.
size()));
136 auto numChannels =
outBlock.getNumChannels();
137 auto inputChannels =
inBlock.getNumChannels();
141 context.getOutputBlock().clear();
147 for (
size_t i = 0; i <
len; ++i)
155 if (
context.usesSeparateInputAndOutputBlocks())
157 for (
ch = 0;
ch < jmin (numChannels, inputChannels); ++
ch)
162 for (
size_t i = 0; i <
len; ++i)
163 dst[i] =
src[i] + generator (buffer[i]);
168 for (
ch = 0;
ch < jmin (numChannels, inputChannels); ++
ch)
172 for (
size_t i = 0; i <
len; ++i)
173 dst[i] += generator (buffer[i]);
177 for (;
ch < numChannels; ++
ch)
181 for (
size_t i = 0; i <
len; ++i)
182 dst[i] = generator (buffer[i]);
193 frequency.
skip (
static_cast<int> (
len));
200 if (
context.usesSeparateInputAndOutputBlocks())
202 for (
ch = 0;
ch < jmin (numChannels, inputChannels); ++
ch)
208 for (
size_t i = 0; i <
len; ++i)
214 for (
ch = 0;
ch < jmin (numChannels, inputChannels); ++
ch)
219 for (
size_t i = 0; i <
len; ++i)
224 for (;
ch < numChannels; ++
ch)
229 for (
size_t i = 0; i <
len; ++i)
241 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