Mozzi  alpha 0.01.1t
sound synthesis library for Arduino
 All Classes Functions Typedefs
Public Member Functions
Line< T > Class Template Reference

For linear changes with a minimum of calculation at each step. More...

List of all members.

Public Member Functions

 Line ()
 Constructor.
next ()
 Increments one step along the line.
void set (T value)
 Set the current value of the line.
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.
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.

Detailed Description

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:
Tthe 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 (avoid 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 fixedMath.h, which enable you to represent fractional numbers. Google "fixed point arithmetic" if this is new to you.

Definition at line 44 of file Line.h.


Constructor & Destructor Documentation

template<class T>
Line< T >::Line ( ) [inline]

Constructor.

Use the template parameter to set the type of numbers you want to use. For example, Line <int> myline; makes a Line which uses ints.

Definition at line 54 of file Line.h.


Member Function Documentation

template<class T>
T Line< T >::next ( ) [inline]

Increments one step along the line.

Returns:
the next value.

Definition at line 63 of file Line.h.

template<class T>
void Line< T >::set ( value) [inline]

Set the current value of the line.

The Line will continue incrementing from this value using any previously calculated step size.

Parameters:
valuethe number to set the Line's current_value to.

Definition at line 79 of file Line.h.

template<class T>
void Line< T >::set ( targetvalue,
num_steps 
) [inline]

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.

Parameters:
targetvaluethe value to move towards.
num_stepshow many steps to take to reach the target.

Definition at line 95 of file Line.h.

template<class T>
void Line< T >::set ( startvalue,
targetvalue,
num_steps 
) [inline]

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.

Parameters:
valuethe number to set the Line's current_value to.
targetvaluethe value to move towards.
num_stepshow many steps to take to reach the target.

Definition at line 107 of file Line.h.


The documentation for this class was generated from the following file: