Control rate parameter sounding crunchy

There is also a function called makeSlope in SC_PlugIn.hpp. I’ve never used it and I don’t know of any examples, but it looks cool. I report the relevant parts:

 template <typename FloatType> struct SlopeSignal {
        SlopeSignal(FloatType value, FloatType slope): value(value), slope(slope) {}

        FloatType consume() {
            FloatType ret = value;
            value += slope;
            return ret;
        }

        FloatType value, slope;
};

template <typename FloatType> inline SlopeSignal<FloatType> makeSlope(FloatType next, FloatType last) const {
        return SlopeSignal<FloatType>(last, calcSlope(next, last));
}

    /// calculate slope value
template <typename FloatType> FloatType calcSlope(FloatType next, FloatType prev) const {
        const Unit* unit = this;
        return CALCSLOPE(next, prev);
}

I might well be wrong about this, but guess you can use it like this:

  • at the beginning of kk you create the slope:
    SlopeSignal delayTime = makeSlope(in(DelayTime)[0], mPrevDelayTime)
  • in the loop you consume it:
    m_delay.setDelayTime(delayTime.consume())
  • at the end of kk you need to cache mPrevDelayTime = delayTime.value
1 Like