You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
948 B
40 lines
948 B
#include "instr_noise.hh"
|
|
#include "daisysp.h"
|
|
|
|
using namespace daisysp;
|
|
|
|
namespace Heck {
|
|
namespace Instrument {
|
|
|
|
void Noise::init(float samplerate)
|
|
{
|
|
noise.Init();
|
|
|
|
env.Init(samplerate);
|
|
env.SetTime(ADENV_SEG_ATTACK, .0001);
|
|
env.SetTime(ADENV_SEG_DECAY, .01);
|
|
env.SetMax(1);
|
|
env.SetMin(0);
|
|
}
|
|
|
|
void Noise::trigger()
|
|
{
|
|
env.Trigger();
|
|
}
|
|
|
|
void Noise::ctl(unsigned int ctl_nr, float val) {}
|
|
void Noise::switch_mode(unsigned int pos) {}
|
|
void Noise::switch_variation(unsigned int pos) {}
|
|
void Noise::switch_filter(unsigned int pos) {}
|
|
|
|
float Noise::nextsample()
|
|
{
|
|
float snr_env_out = env.Process();
|
|
float sig = noise.Process();
|
|
sig *= snr_env_out;
|
|
|
|
return sig;
|
|
}
|
|
|
|
} // namespace Instrument
|
|
} // namespace Heck
|