template<class T>
class Line< T >
For linear changes with a minimum of calculation at each step.
For instance, you can use Line to make an oscillator glide from one frequency to another, pre-calculating the required phase increments for each end and then letting your Line change the phase increment with only a simple addition at each step.
- Template Parameters
-
T | the type of numbers to use. For example, Line <int> myline; makes a Line which uses ints. |
- Note
- Watch out for underflows in the internal calcualtion of Line() if you're not using floats (but on the other hand try to avoid lots of floats, they're too slow!). If it seems like the Line() is not working, there's a good chance you need to scale up the numbers you're using, so internal calculations don't get truncated away. Use Mozzi's fixed-point number types in mozzi_fixmath.h, which enable you to represent fractional numbers. Google "fixed point arithmetic" if this is new to you.
Definition at line 39 of file Line.h.
|
| Line () |
| Constructor. More...
|
|
T | next () |
| Increments one step along the line. More...
|
|
void | set (T value) |
| Set the current value of the line. More...
|
|
void | set (T targetvalue, T num_steps) |
| Given a target value and the number of steps to take on the way, this calculates the step size needed to get there from the current value. More...
|
|
void | set (T startvalue, T targetvalue, T num_steps) |
| Given a new starting value, target value and the number of steps to take on the way, this sets the step size needed to get there. More...
|
|