Yet Another Synthesizer Engine
 
Loading...
Searching...
No Matches
yase::Fader Class Reference

#include <fader.hh>

+ Inheritance diagram for yase::Fader:
+ Collaboration diagram for yase::Fader:

Detailed Description

A Fader Module maps an input target to an output value.

Typically, the input comes from a Midi control such as a knob. Because such controls are discrete (for example, integers from 0 to 127), directly mapping the input to the output would result in abropt changes to the Fader value. The Fader object solves this with an internal state that uses proportional feedback to track the target, but moves continuously.

Typically, a list of fader objects is managed by a Controls object and a Fader object is not managed by the user directly.

Public Member Functions

 Fader ()
 Construct a new fader with range [0,1]. The default response is linear. And the default tracking gain is TRACKING_GAIN.
 
 Fader (double min, double max)
 
void init ()
 
void update ()
 
void randomize ()
 Set the target of the fader to a random value from within its min and max values.
 
void set_tracking_gain (double x)
 
void linear ()
 Set the response of the fader to lienar.
 
void exponential (double b)
 
- Public Member Functions inherited from yase::Module
virtual void init ()=0
 
virtual void update ()=0
 
int add_input (string name)
 
int add_output (string name)
 
int get_input_index (string name) const
 
string get_input_name (int index) const
 
string get_output_name (int index) const
 
int get_output_index (string name) const
 
void set_input (string name, double value)
 
void set_input (int index, double value)
 
double get_input (int index) const
 
double get_input (string name) const
 
double get_output (string name) const
 
double get_output (int index) const
 
void set_output (int index, double value)
 
void copy_inputs (const Module &source)
 
void copy_outputs (Module &destination) const
 
void configure (std::vector< std::tuple< string, double > > assignments)
 
int num_inputs () const
 
int num_outputs () const
 
void emit (Event e)
 
void set_ts (double s)
 
double get_ts ()
 

Constructor & Destructor Documentation

◆ Fader()

yase::Fader::Fader ( double  min,
double  max 
)

Construct a new fader. The default response is linear. And the default tracking gain is TRACKING_GAIN.

Parameters
minThe minimum value of the fader
maxThe maximum value of the fader

Member Function Documentation

◆ exponential()

void yase::Fader::exponential ( double  b)
inline

Set the reponse of the fader to exponential with base b. See the documentation for Controls for details.

Parameters
bThe base of the exponential.

◆ init()

void yase::Fader::init ( )
virtual

This method should be overridden by derived classes. It will usually be called once, after all modules and connections objects have been added to a synthesizer, but before the synthesizer starts running.

Implements yase::Module.

◆ set_tracking_gain()

void yase::Fader::set_tracking_gain ( double  x)
inline

Set the tracking gain of the fader. A higher number results in a snappier response.

Parameters
xThe desired gain

◆ update()

void yase::Fader::update ( )
virtual

This method should be overridden by derived classes. It will be called repeatedly by a synthesizer at a frequency determined by SAMPLE_RATE.

Implements yase::Module.


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