MCPcopy Create free account
hub / github.com/StrangeLoopsAudio/gRainbow / processBlock

Method processBlock

Source/Modulators.cpp:26–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24};
25
26void LFOModSource::processBlock() {
27 // Calculate LFO output
28 mOutput = LFO_SHAPES[shape->getIndex()].calc(mCurPhase) / 2.0f;
29 if (!bipolar->get()) mOutput = mOutput + 0.5f; // Make unipolar if needed
30
31 // Update phase for the next block
32 if (sync->get()) {
33 const float divInBars = std::pow(2, juce::roundToInt(ParamRanges::SYNC_DIV_MAX * rate->convertTo0to1(rate->get())));
34 mCurPhase += mRadPerBlock / (mBarsPerSec / divInBars);
35 } else {
36 mCurPhase += mRadPerBlock * rate->get();
37 }
38
39 // Wrap phase to keep it in the range [0, 2PI)
40 if (mCurPhase >= juce::MathConstants<double>::twoPi) mCurPhase -= juce::MathConstants<double>::twoPi;
41}
42
43juce::Range<float> LFOModSource::getRange() {
44 if (bipolar->get()) {

Callers 1

processModSourcesMethod · 0.45

Calls 1

getAmplitudeMethod · 0.45

Tested by

no test coverage detected