File analogbassdrum.h¶
File List > DaisySP > Source > Drums > analogbassdrum.h
Go to the documentation of this file
Source Code¶
/*
Copyright (c) 2020 Electrosmith, Corp, Emilie Gillet
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_ANALOG_BD_H
#define DSY_ANALOG_BD_H
#include <stdint.h>
#ifdef __cplusplus
#include "Synthesis/oscillator.h"
#include "Filters/svf.h"
namespace daisysp
{
class AnalogBassDrum
{
public:
AnalogBassDrum() {}
~AnalogBassDrum() {}
void Init(float sample_rate);
float Process(bool trigger = false);
void Trig();
void SetSustain(bool sustain);
void SetAccent(float accent);
void SetFreq(float f0);
void SetTone(float tone);
void SetDecay(float decay);
void SetAttackFmAmount(float attack_fm_amount);
void SetSelfFmAmount(float self_fm_amount);
private:
inline float Diode(float x);
float sample_rate_;
float accent_, f0_, tone_, decay_;
float attack_fm_amount_, self_fm_amount_;
bool trig_, sustain_;
int pulse_remaining_samples_;
int fm_pulse_remaining_samples_;
float pulse_;
float pulse_height_;
float pulse_lp_;
float fm_pulse_lp_;
float retrig_pulse_;
float lp_out_;
float tone_lp_;
float sustain_gain_;
Svf resonator_;
//for use in sin + cos osc. in sustain mode
float phase_;
};
} // namespace daisysp
#endif
#endif