// live_params.cpp — the fold from the parameter set to the live block, and the ramp-step law. // See live_params.h for the publication contract. #include "core/instrument/engine/live_params.h" namespace reasampler::instrument::engine { LiveValues foldLive(const PlayParams& params, double keyTrack) { LiveValues v; v.keyTrack = keyTrack; // Folded here, not at the voice: Voice::start reads the block's value directly, so the // spline rule has to be applied on the way in or the two would answer differently. v.splineActive = splineActive(params); v.lengthFraction = effectiveLengthFraction(params); v.filterSettings = params.filter.settings; v.filterModAmount = params.filter.modAmount; v.filterVelAmount = params.filter.velAmount; v.filterKeyTrack = params.filter.keyTrack; v.filterEnv = params.filter.env; v.filterAhd = params.filter.trigEnv; v.adsr = params.adsr; v.ampAhd = params.trigAhd; v.pitchEnv = params.pitchEnv; v.playRate = params.playRate; v.pitchOffsetSemitones = params.pitchOffsetSemitones; return v; } double liveRampStep(double sampleRate) { if (!(sampleRate > 0.0)) return 0.0; // also catches NaN return 1.0 / (kLiveRampSeconds * sampleRate); } } // namespace reasampler::instrument::engine