DaisySP
Loading...
Searching...
No Matches
fm2.h
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_FM2_H
11#define DSY_FM2_H
12
13#include <stdint.h>
14#include "Synthesis/oscillator.h"
15#ifdef __cplusplus
16
17namespace daisysp
18{
26class Fm2
27{
28 public:
29 Fm2() {}
30 ~Fm2() {}
31
35 void Init(float samplerate);
36
37
40 float Process();
41
45 void SetFrequency(float freq);
46
50 void SetRatio(float ratio);
51
55 void SetIndex(float index);
56
58 float GetIndex();
59
61 void Reset();
62
63 private:
64 static constexpr float kIdxScalar = 0.2f;
65 static constexpr float kIdxScalarRecip = 1.f / kIdxScalar;
66
67 Oscillator mod_, car_;
68 float idx_;
69 float freq_, lfreq_, ratio_, lratio_;
70};
71} // namespace daisysp
72#endif
73#endif
Definition fm2.h:27
float Process()
Definition fm2.cpp:26
float GetIndex()
Definition fm2.cpp:56
void Init(float samplerate)
Definition fm2.cpp:5
void Reset()
Definition fm2.cpp:61
void SetIndex(float index)
Definition fm2.cpp:51
void SetRatio(float ratio)
Definition fm2.cpp:46
void SetFrequency(float freq)
Definition fm2.cpp:41
Definition oscillator.h:21
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16