de5654fb6f
The SDK's own single-component sample drains inputParameterChanges in process() and implements setParamNormalized; automation was reading the GUI channel alone. The audio thread now patches a block it solely owns.
35 lines
1.3 KiB
C++
35 lines
1.3 KiB
C++
// 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
|