File fm2.h¶
File List > DaisySP > Source > Synthesis > fm2.h
Go to the documentation of this file
Source Code¶
/*
Copyright (c) 2020 Electrosmith, Corp
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
#pragma once
#ifndef DSY_FM2_H
#define DSY_FM2_H
#include <stdint.h>
#include "Synthesis/oscillator.h"
#ifdef __cplusplus
namespace daisysp
{
class Fm2
{
public:
Fm2() {}
~Fm2() {}
void Init(float samplerate);
float Process();
void SetFrequency(float freq);
void SetRatio(float ratio);
void SetIndex(float index);
float GetIndex();
void Reset();
private:
static constexpr float kIdxScalar = 0.2f;
static constexpr float kIdxScalarRecip = 1.f / kIdxScalar;
Oscillator mod_, car_;
float idx_;
float freq_, lfreq_, ratio_, lratio_;
};
} // namespace daisysp
#endif
#endif