#include "instr_Grainlet.hh" #include "daisysp.h" #include "osp_utils.hh" namespace Heck::OSP { namespace Instrument { Grainlet::Grainlet() { init(); } void Grainlet::init() { grainlet.Init(Constants::AUDIO_SAMPLERATE); } void Grainlet::trigger() { } void Grainlet::ctl(unsigned int ctl_nr, float val) { switch (ctl_nr) { case 0: { grainlet.SetFreq( dz::scalen_min_max(val, 40, 400)); } break; case 1: { } break; case 2: { grainlet.SetFormantFreq( dz::scalen_min_max(val, 400, 2000)); } break; case 3: { grainlet.SetShape( dz::scalen_min_max(val, 0, 1)); } break; } } void Grainlet::switch_algo(unsigned int pos) { mode1 = pos; } void Grainlet::switch_mode(unsigned int pos) { mode2 = pos; } float Grainlet::nextsample() { float out{}; out = grainlet.Process(); return out; } } // namespace Instrument } // namespace Heck