~ubuntu-branches/ubuntu/wily/ecasound/wily-proposed

« back to all changes in this revision

Viewing changes to libecasound/audiofx_envelope_modulation.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghedini
  • Date: 2011-05-12 17:58:03 UTC
  • Revision ID: james.westby@ubuntu.com-20110512175803-zy3lodjecabt9r3v
Tags: upstream-2.8.0
ImportĀ upstreamĀ versionĀ 2.8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef INCLUDED_AUDIOFX_ENVELOPE_MODULATION_H
 
2
#define INCLUDED_AUDIOFX_ENVELOPE_MODULATION_H
 
3
 
 
4
#include <string>
 
5
 
 
6
#include "samplebuffer_iterators.h"
 
7
#include "audiofx.h"
 
8
 
 
9
/**
 
10
 * Virtual base for envelope modulation effects.
 
11
 * @author Rob Coker
 
12
 */
 
13
class EFFECT_ENV_MOD : public EFFECT_BASE {
 
14
 
 
15
 public:
 
16
  virtual ~EFFECT_ENV_MOD(void);
 
17
};
 
18
 
 
19
/**
 
20
 * Pulse shaped gate
 
21
 * @author Rob Coker
 
22
 */
 
23
class EFFECT_PULSE_GATE: public EFFECT_ENV_MOD {
 
24
 
 
25
  SAMPLE_ITERATOR_INTERLEAVED i;
 
26
  parameter_t freq_rep;
 
27
  parameter_t on_time_rep;
 
28
  long int period_rep;
 
29
  long int on_from_rep;
 
30
  long int current_rep;
 
31
 
 
32
 public:
 
33
 
 
34
  virtual std::string name(void) const { return("Pulse Gate"); }
 
35
  virtual std::string parameter_names(void) const  { return("freq-Hz,on-time-%"); }
 
36
 
 
37
  virtual void set_parameter(int param, parameter_t value);
 
38
  virtual parameter_t get_parameter(int param) const;
 
39
 
 
40
  virtual void init(SAMPLE_BUFFER *insample);
 
41
  virtual void process(void);
 
42
 
 
43
  EFFECT_PULSE_GATE (parameter_t freq_Hz = 1.0, parameter_t onTime_percent = 50.0);
 
44
  virtual ~EFFECT_PULSE_GATE(void);
 
45
  EFFECT_PULSE_GATE* clone(void) const { return new EFFECT_PULSE_GATE(*this); }
 
46
  EFFECT_PULSE_GATE* new_expr(void) const { return new EFFECT_PULSE_GATE(); }
 
47
 
 
48
  /** @name Protected virtual functions to notify about changes 
 
49
   *        (Reimplemented from ECA_SAMPLERATE_AWARE) */
 
50
  /*@{*/
 
51
 
 
52
  virtual void set_samples_per_second(SAMPLE_SPECS::sample_rate_t v);
 
53
 
 
54
  /*@}*/
 
55
};
 
56
 
 
57
/**
 
58
 * Wrapper class for pulse shaped gate providing 
 
59
 * a beats-per-minute (bpm) based parameters.
 
60
 *
 
61
 * @author Kai Vehmanen
 
62
 */
 
63
class EFFECT_PULSE_GATE_BPM : public EFFECT_ENV_MOD {
 
64
 
 
65
  EFFECT_PULSE_GATE pulsegate_rep;
 
66
 
 
67
 public:
 
68
 
 
69
  virtual std::string name(void) const { return("Pulse gate BPM"); }
 
70
  virtual std::string parameter_names(void) const  { return("bpm,on-time-msec"); }
 
71
 
 
72
  virtual void set_parameter(int param, parameter_t value);
 
73
  virtual parameter_t get_parameter(int param) const;
 
74
 
 
75
  virtual void init(SAMPLE_BUFFER *insample);
 
76
  virtual void process(void);
 
77
 
 
78
  EFFECT_PULSE_GATE_BPM (parameter_t bpm = 120.0, parameter_t ontime_percent = 5.0);
 
79
  virtual ~EFFECT_PULSE_GATE_BPM(void);
 
80
  EFFECT_PULSE_GATE_BPM* clone(void) const { return new EFFECT_PULSE_GATE_BPM(*this); }
 
81
  EFFECT_PULSE_GATE_BPM* new_expr(void) const { return new EFFECT_PULSE_GATE_BPM(); }
 
82
 
 
83
  /** @name Protected virtual functions to notify about changes 
 
84
   *        (Reimplemented from ECA_SAMPLERATE_AWARE) */
 
85
  /*@{*/
 
86
 
 
87
  virtual void set_samples_per_second(SAMPLE_SPECS::sample_rate_t v);
 
88
 
 
89
  /*@}*/
 
90
};
 
91
 
 
92
/**
 
93
 * Tremolo
 
94
 * @author Rob Coker
 
95
 */
 
96
class EFFECT_TREMOLO: public EFFECT_ENV_MOD {
 
97
 
 
98
  SAMPLE_ITERATOR_INTERLEAVED i;
 
99
  parameter_t freq;
 
100
  parameter_t depth;
 
101
  parameter_t currentTime;
 
102
  parameter_t incrTime;
 
103
 
 
104
 public:
 
105
 
 
106
  virtual std::string name(void) const { return("Tremolo"); }
 
107
  virtual std::string parameter_names(void) const  { return("bpm,depth-%"); }
 
108
 
 
109
  virtual void set_parameter(int param, parameter_t value);
 
110
  virtual parameter_t get_parameter(int param) const;
 
111
 
 
112
  virtual void init(SAMPLE_BUFFER *insample);
 
113
  virtual void process(void);
 
114
 
 
115
  EFFECT_TREMOLO (parameter_t freq_bpm = 60.0, parameter_t depth_percent = 100.0);
 
116
  virtual ~EFFECT_TREMOLO(void);
 
117
  EFFECT_TREMOLO* clone(void) const { return new EFFECT_TREMOLO(*this); }
 
118
  EFFECT_TREMOLO* new_expr(void) const { return new EFFECT_TREMOLO(); }
 
119
};
 
120
 
 
121
#endif