DaisySP
Loading...
Searching...
No Matches
variablesawosc.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_VARISAWOSCILLATOR_H
11#define DSY_VARISAWOSCILLATOR_H
12
13#include <stdint.h>
14#ifdef __cplusplus
15
17namespace daisysp
18{
29{
30 public:
33
34 void Init(float sample_rate);
35
37 float Process();
38
42 void SetFreq(float frequency);
43
47 void SetPW(float pw);
48
52 void SetWaveshape(float waveshape);
53
54
55 private:
56 float ComputeNaiveSample(float phase,
57 float pw,
58 float slope_up,
59 float slope_down,
60 float triangle_amount,
61 float notch_amount);
62
63 float sample_rate_;
64
65 // Oscillator state.
66 float phase_;
67 float next_sample_;
68 float previous_pw_;
69 bool high_;
70
71 const float kVariableSawNotchDepth = 0.2f;
72
73 // For interpolation of parameters.
74 float frequency_;
75 float pw_;
76 float waveshape_;
77};
78} // namespace daisysp
79#endif
80#endif
Definition delayline.h:29
Variable Saw Oscillator.
Definition variablesawosc.h:29
void SetPW(float pw)
Definition variablesawosc.cpp:78
float Process()
Definition variablesawosc.cpp:21
void SetWaveshape(float waveshape)
Definition variablesawosc.cpp:90
void SetFreq(float frequency)
Definition variablesawosc.cpp:70
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16