File: audiofx_rcfilter.h

package info (click to toggle)
ecasound 2.9.1-7
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 5,652 kB
  • ctags: 6,128
  • sloc: cpp: 39,403; sh: 10,512; ansic: 2,040; lisp: 1,918; makefile: 909; python: 611; ruby: 202
file content (53 lines) | stat: -rw-r--r-- 1,711 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef _AUDIOFX_RC_LOWPASS_FILTER_H
#define _AUDIOFX_RC_LOWPASS_FILTER_H

#include <vector>
#include <deque>

#include "audiofx_filter.h"
#include "samplebuffer_iterators.h"

/**
 * Simulation of an 3rd-order 36dB active RC-lowpass
 *
 * 5th of February 2000 by Stefan Fendt
 * 
 * This is a quite realistic simulation of an analouge 
 * RC-lowpass as used in many old synthesisers. You can
 * increase filter-resonance up to the point were the 
 * filter starts oscillating (without any signal aplied
 * to it...) and this without digital clipping. Knowing 
 * that this was a design flaw (which had technical
 * reasons on real RC-filters) this was implemented in 
 * this simulation, too. I do not know any other 
 * filter-simulation which provides this.
 *
 * @author Stefan Fendt
 */
class EFFECT_RC_LOWPASS_FILTER : public EFFECT_FILTER {

  SAMPLE_ITERATOR_CHANNELS i;
  SAMPLE_SPECS::sample_t output_temp;
  std::vector<SAMPLE_SPECS::sample_t> lp1_old, lp2_old, lp3_old, hp1_old, feedback;
    
  parameter_t cutoff_rep;
  parameter_t resonance_rep;

public:

  virtual std::string name(void) const { return("RC-lowpass filter"); }
  virtual std::string parameter_names(void) const { return("cutoff-freq,resonance"); }

  virtual void set_parameter(int param, parameter_t value);
  virtual parameter_t get_parameter(int param) const;

  virtual void init(SAMPLE_BUFFER *insample);
  virtual void process(void);

  EFFECT_RC_LOWPASS_FILTER* clone(void) const { return new EFFECT_RC_LOWPASS_FILTER(*this); }
  EFFECT_RC_LOWPASS_FILTER* new_expr(void) const { return new EFFECT_RC_LOWPASS_FILTER(); }
  EFFECT_RC_LOWPASS_FILTER (parameter_t cutoff = 0.25,
			    parameter_t resonance = 1.0);
};

#endif