MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ LinearRamp()

std::vector< double > MayaFlux::Nodes::Generator::LinearRamp ( size_t  length,
double  start = 0.0,
double  end = 1.0 
)

Creates a linear ramp function.

Parameters
lengthNumber of samples in the ramp
startStarting value (default: 0.0)
endEnding value (default: 1.0)
Returns
Vector containing the ramp function values

A linear ramp increases or decreases at a constant rate from start to end value. Useful for:

  • Creating linear transitions
  • Parameter automation
  • Simple envelope shapes

Definition at line 42 of file WindowGenerator.cpp.

43{
44 std::vector<double> ramp(length);
45 if (length == 1)
46 return { start };
47 const double step = (end - start) / (length - 1);
48 for (size_t i = 0; i < length; ++i) {
49 ramp[i] = start + i * step;
50 }
51 return ramp;
52}