#include "instr_hihat.hh" #include "daisysp.h" #include "osp_utils.hh" namespace Heck::OSP { namespace Instrument { HiHat::HiHat() { init(); } void HiHat::init() { hihat.Init(Constants::AUDIO_SAMPLERATE); hihat.SetDecay(1.); } void HiHat::trigger() { hihat.Trig(); } void HiHat::ctl(unsigned int ctl_nr, float val) { switch (ctl_nr) { case 0: { hihat.SetFreq( dz::scalen_min_max(val, 800, 2000)); } break; case 1: { } break; case 2: { hihat.SetTone( dz::scalen_min_max(val, 0, 1)); } break; case 3: { hihat.SetNoisiness( dz::scalen_min_max(val, 0, 1)); } break; } } void HiHat::switch_algo(unsigned int pos) { mode1 = pos; } void HiHat::switch_mode(unsigned int pos) { mode2 = pos; } float HiHat::nextsample() { float out{}; out = hihat.Process(); return out; } } // namespace Instrument } // namespace Heck