DaisySP
Loading...
Searching...
No Matches
chorus.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_CHORUS_H
11#define DSY_CHORUS_H
12#ifdef __cplusplus
13
14#include <stdint.h>
15#include "Utility/delayline.h"
16
19namespace daisysp
20{
26{
27 public:
28 ChorusEngine() {}
29 ~ChorusEngine() {}
30
34 void Init(float sample_rate);
35
39 float Process(float in);
40
44 void SetLfoDepth(float depth);
45
49 void SetLfoFreq(float freq);
50
54 void SetDelay(float delay);
55
59 void SetDelayMs(float ms);
60
64 void SetFeedback(float feedback);
65
66 private:
67 float sample_rate_;
68 static constexpr int32_t kDelayLength
69 = 2400; // 50 ms at 48kHz = .05 * 48000
70
71 //triangle lfos
72 float lfo_phase_;
73 float lfo_freq_;
74 float lfo_amp_;
75
76 float feedback_;
77
78 float delay_;
79
81
82 float ProcessLfo();
83};
84
85//wraps up all of the chorus engines
93class Chorus
94{
95 public:
96 Chorus() {}
97 ~Chorus() {}
98
102 void Init(float sample_rate);
103
107 float Process(float in);
108
110 float GetLeft();
111
113 float GetRight();
114
119 void SetPan(float panl, float panr);
120
124 void SetPan(float pan);
125
130 void SetLfoDepth(float depthl, float depthr);
131
135 void SetLfoDepth(float depth);
136
141 void SetLfoFreq(float freql, float freqr);
142
146 void SetLfoFreq(float freq);
147
152 void SetDelay(float delayl, float delayr);
153
157 void SetDelay(float delay);
158
163 void SetDelayMs(float msl, float msr);
164
168 void SetDelayMs(float ms);
169
174 void SetFeedback(float feedbackl, float feedbackr);
175
179 void SetFeedback(float feedback);
180
181 private:
182 ChorusEngine engines_[2];
183 float gain_frac_;
184 float pan_[2];
185
186 float sigl_, sigr_;
187};
188} //namespace daisysp
189#endif
190#endif
Single Chorus engine. Used in Chorus.
Definition chorus.h:26
void SetLfoDepth(float depth)
Definition chorus.cpp:33
void SetLfoFreq(float freq)
Definition chorus.cpp:39
void Init(float sample_rate)
Definition chorus.cpp:8
void SetDelay(float delay)
Definition chorus.cpp:46
void SetDelayMs(float ms)
Definition chorus.cpp:52
float Process(float in)
Definition chorus.cpp:22
void SetFeedback(float feedback)
Definition chorus.cpp:60
Chorus Effect.
Definition chorus.h:94
void SetDelayMs(float msl, float msr)
Definition chorus.cpp:167
void SetLfoFreq(float freql, float freqr)
Definition chorus.cpp:145
void SetFeedback(float feedbackl, float feedbackr)
Definition chorus.cpp:178
void SetDelay(float delayl, float delayr)
Definition chorus.cpp:156
void SetLfoDepth(float depthl, float depthr)
Definition chorus.cpp:134
float GetRight()
Definition chorus.cpp:118
float GetLeft()
Definition chorus.cpp:113
void SetPan(float panl, float panr)
Definition chorus.cpp:123
float Process(float in)
Definition chorus.cpp:95
void Init(float sample_rate)
Definition chorus.cpp:85
Definition delayline.h:29
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16