DaisySP
Loading...
Searching...
No Matches
phaser.h
Go to the documentation of this file.
1/*
2Copyright (c) 2020 Electrosmith, Corp
3
4Use of this source code is governed by an MIT-style
5license that can be found in the LICENSE file or at
6https://opensource.org/licenses/MIT.
7*/
8
9#pragma once
10#ifndef DSY_PHASER_H
11#define DSY_PHASER_H
12#ifdef __cplusplus
13
14#include <stdint.h>
15#include "Utility/delayline.h"
16
19namespace daisysp
20{
26{
27 public:
28 PhaserEngine() {}
29 ~PhaserEngine() {}
30
34 void Init(float sample_rate);
35
39 float Process(float in);
40
44 void SetLfoDepth(float depth);
45
49 void SetLfoFreq(float lfo_freq);
50
54 void SetFreq(float ap_freq);
55
59 void SetFeedback(float feedback);
60
61 private:
62 float sample_rate_;
63 static constexpr int32_t kDelayLength
64 = 2400; // 50 ms at 48kHz = .05 * 48000
65
66 //triangle lfo
67 float lfo_phase_;
68 float lfo_freq_;
69 float lfo_amp_;
70
71 float os_;
72
73 float feedback_;
74 float ap_freq_;
75
76 float deltime_;
77 float last_sample_;
78
80
81 float ProcessLfo();
82};
83
84//wraps up all of the phaser engines
90class Phaser
91{
92 public:
93 Phaser() {}
94 ~Phaser() {}
95
99 void Init(float sample_rate);
100
104 float Process(float in);
105
109 void SetPoles(int poles);
110
114 void SetLfoDepth(float depth);
115
119 void SetLfoFreq(float lfo_freq);
120
124 void SetFreq(float ap_freq);
125
129 void SetFeedback(float feedback);
130
131 private:
132 static constexpr int kMaxPoles = 8;
133 PhaserEngine engines_[kMaxPoles];
134 float gain_frac_;
135 int poles_;
136};
137} //namespace daisysp
138#endif
139#endif
Definition delayline.h:29
Single Phaser engine. Used in Phaser.
Definition phaser.h:26
void SetLfoDepth(float depth)
Definition phaser.cpp:38
void Init(float sample_rate)
Definition phaser.cpp:8
void SetFeedback(float feedback)
Definition phaser.cpp:55
void SetLfoFreq(float lfo_freq)
Definition phaser.cpp:43
float Process(float in)
Definition phaser.cpp:28
void SetFreq(float ap_freq)
Definition phaser.cpp:50
Phaser Effect.
Definition phaser.h:91
float Process(float in)
Definition phaser.cpp:91
void SetFreq(float ap_freq)
Definition phaser.cpp:124
void SetFeedback(float feedback)
Definition phaser.cpp:132
void SetLfoDepth(float depth)
Definition phaser.cpp:108
void Init(float sample_rate)
Definition phaser.cpp:80
void SetLfoFreq(float lfo_freq)
Definition phaser.cpp:116
void SetPoles(int poles)
Definition phaser.cpp:103
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16