本文整理汇总了C++中AD::resetSoft方法的典型用法代码示例。如果您正苦于以下问题:C++ AD::resetSoft方法的具体用法?C++ AD::resetSoft怎么用?C++ AD::resetSoft使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AD
的用法示例。
在下文中一共展示了AD::resetSoft方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onAudio
void onAudio(AudioIOData& io){
while(io()){
if(tmr()){
// Our sequence of pitches
float pitches[] = {0,0,12,0,0,10,-5,0};
// Map pitch class to a frequency in Hz
float f = 55 * pow(2, pitches[step]/12.);
// Increment step counter
step = (step + 1) % 8;
// Set new target frequence of portamento
freq = f;
// Restart envelope using a soft reset (to avoid clicks)
env.resetSoft();
}
// Set saw frequency from portamento filter
saw.freq(freq());
// Get next envelope value
float e = env();
// Map envelope value to cutoff frequency
lpf.freq(e * (modCutoff.paraU()*6000 + 500) + 40);
// Generate next saw sample
float s = saw() * 0.3;
// Filter saw sample
s = lpf(s) * e;
// Send sample to DAC
io.out(0) = io.out(1) = s;
}
}