DaisySP
Loading...
Searching...
No Matches
oscillatorbank.h
Go to the documentation of this file.
1/*
2Copyright (c) 2020 Electrosmith, Corp, Emilie Gillet
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_OSCILLATORBANK_H
11#define DSY_OSCILLATORBANK_H
12
13#include <stdint.h>
14#ifdef __cplusplus
15
18namespace daisysp
19{
31{
32 public:
35
39 void Init(float sample_rate);
40
43 float Process();
44
48 void SetFreq(float freq);
49
53 void SetAmplitudes(const float* amplitudes);
54
59 void SetSingleAmp(float amp, int idx);
60
64 void SetGain(float gain);
65
66 private:
67 // Oscillator state.
68 float phase_;
69 float next_sample_;
70 int segment_;
71 float gain_;
72 float registration_[7];
73 float unshifted_registration_[7];
74
75 float frequency_;
76 float saw_8_gain_;
77 float saw_4_gain_;
78 float saw_2_gain_;
79 float saw_1_gain_;
80
81 float sample_rate_;
82 bool recalc_, recalc_gain_;
83
84 bool cmp(float a, float b) { return fabsf(a - b) > .0000001; }
85};
86} // namespace daisysp
87#endif
88#endif
Oscillator Bank module.
Definition oscillatorbank.h:31
void SetGain(float gain)
Definition oscillatorbank.cpp:141
float Process()
Definition oscillatorbank.cpp:33
void SetSingleAmp(float amp, int idx)
Definition oscillatorbank.cpp:131
void SetAmplitudes(const float *amplitudes)
Definition oscillatorbank.cpp:122
void SetFreq(float freq)
Definition oscillatorbank.cpp:114
void Init(float sample_rate)
Definition oscillatorbank.cpp:7
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16