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.
55 lines
1.3 KiB
55 lines
1.3 KiB
#include "instr_kick.hh"
|
|
#include "daisysp.h"
|
|
|
|
using namespace daisysp;
|
|
|
|
|
|
namespace Heck {
|
|
namespace Instrument {
|
|
|
|
void Kick::init(float samplerate)
|
|
{
|
|
osc.Init(samplerate);
|
|
|
|
osc.SetWaveform(Oscillator::WAVE_TRI);
|
|
osc.SetAmp(1);
|
|
|
|
pitchEnv.Init(samplerate);
|
|
pitchEnv.SetTime(ADENV_SEG_ATTACK, .001);
|
|
pitchEnv.SetTime(ADENV_SEG_DECAY, .01);
|
|
pitchEnv.SetMax(250);
|
|
pitchEnv.SetMin(20);
|
|
|
|
volEnv.Init(samplerate);
|
|
volEnv.SetTime(ADENV_SEG_ATTACK, .0001);
|
|
volEnv.SetTime(ADENV_SEG_DECAY, 0.1);
|
|
volEnv.SetMax(1);
|
|
volEnv.SetMin(0);
|
|
}
|
|
|
|
|
|
void Kick::trigger()
|
|
{
|
|
volEnv.Trigger();
|
|
pitchEnv.Trigger();
|
|
return;
|
|
}
|
|
|
|
void Kick::ctl(unsigned int ctl_nr, float val) {}
|
|
void Kick::switch_mode(unsigned int pos) {}
|
|
void Kick::swtich_variation(unsigned int pos) {}
|
|
void Kick::switch_filter(unsigned int pos) {}
|
|
|
|
float Kick::nextsample()
|
|
{
|
|
float kck_env_out = volEnv.Process();
|
|
|
|
osc.SetFreq(pitchEnv.Process());
|
|
osc.SetAmp(kck_env_out);
|
|
float osc_out = osc.Process();
|
|
|
|
return osc_out;
|
|
}
|
|
|
|
} // namespace Instrument
|
|
} // namespace Heck
|