File synthsnaredrum.h¶
File List > DaisySP > Source > Drums > synthsnaredrum.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_SYNTHSD_H
#define DSY_SYNTHSD_H
#include "Filters/svf.h"
#include <stdint.h>
#ifdef __cplusplus
namespace daisysp
{
class SyntheticSnareDrum
{
public:
SyntheticSnareDrum() {}
~SyntheticSnareDrum() {}
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 SetFmAmount(float fm_amount);
void SetDecay(float decay);
void SetSnappy(float snappy);
private:
inline float DistortedSine(float phase);
float sample_rate_;
bool trig_;
bool sustain_;
float accent_, f0_, fm_amount_, decay_, snappy_;
float phase_[2];
float drum_amplitude_;
float snare_amplitude_;
float fm_;
float sustain_gain_;
int hold_counter_;
Svf drum_lp_;
Svf snare_hp_;
Svf snare_lp_;
};
} // namespace daisysp
#endif
#endif