当前位置: 首页>>代码示例>>C++>>正文


C++ FloatArray::multiply方法代码示例

本文整理汇总了C++中FloatArray::multiply方法的典型用法代码示例。如果您正苦于以下问题:C++ FloatArray::multiply方法的具体用法?C++ FloatArray::multiply怎么用?C++ FloatArray::multiply使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FloatArray的用法示例。


在下文中一共展示了FloatArray::multiply方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: processAudio

 void processAudio(AudioBuffer &buffer) {
   float tune = getParameterValue(PARAMETER_A)*10.0 - 6.0;
   float fc = getParameterValue(PARAMETER_B)*10.0 - 4.0;
   float q = getParameterValue(PARAMETER_C)*3+0.75;
   float shape = getParameterValue(PARAMETER_E)*2;
   float pw = 0.5;
   if(shape > 1.0){
     pw += 0.49*(shape-1.0); // pw 0.5 to 0.99
     shape = 1.0; // square wave
   }
   float df = getParameterValue(PARAMETER_D)*4;
   int di = (int)df;
   float gain = 0.0f;
   switch(di){
     // a/d
   case 0: // l/s
     env.setAttack(1.0-df);
     env.setRelease(0.0);
     break;
   case 1: // s/s
     env.setAttack(0.0);
     env.setRelease(df-1);
     break;
   case 2: // s/l
     env.setAttack(df-2);
     env.setRelease(1.0);
     break;
   case 3: // l/l
     env.setAttack(1.0);
     env.setRelease(1.0);
     gain = df-3;
     break;
   }
   env.trigger(isButtonPressed(PUSHBUTTON), getSamplesSinceButtonPressed(PUSHBUTTON));
   FloatArray left = buffer.getSamples(LEFT_CHANNEL);
   FloatArray right = buffer.getSamples(RIGHT_CHANNEL);
   // vco
   hz.setTune(tune);
   float lfreq = hz.getFrequency(left[0]);
   osc.setFrequency(lfreq);
   osc.setShape(shape);
   osc.setPulseWidth(pw);
   osc.getSamples(left);
   // vcf
   hz.setTune(fc);
   fc = hz.getFrequency(right[0]);
   fc = min(0.999, max(0.01, fc/(getSampleRate()*2))); // normalised and bounded
   filter->setLowPass(fc, q);
   right.copyFrom(left);
   filter->process(right);
   right.multiply(0.8-q*0.2); // gain compensation for high q
   // vca
   env.getEnvelope(envelope);
   envelope.add(gain);
   left.multiply(envelope);
   right.multiply(envelope);
 }
开发者ID:camerondavidbailey,项目名称:MyPatches,代码行数:57,代码来源:SynthVoicePatch.hpp

示例2: processAudio

 void processAudio(AudioBuffer &buffer){
   eg1.setAttack(getParameterValue(PARAMETER_A)*2);
   eg1.setRelease(getParameterValue(PARAMETER_B)*2);
   eg2.setAttack(getParameterValue(PARAMETER_C)*2);
   eg2.setRelease(getParameterValue(PARAMETER_D)*2);
   FloatArray left = buffer.getSamples(LEFT_CHANNEL);
   FloatArray right = buffer.getSamples(RIGHT_CHANNEL);
   eg1.getEnvelope(left);
   eg2.getEnvelope(right);
   left.multiply(-1);
   right.multiply(-1);
 }
开发者ID:marsus,项目名称:MyPatches,代码行数:12,代码来源:DualASRPatch.hpp

示例3: processAudio

  void processAudio(AudioBuffer& buffer){
    float tone = 20*powf(2, getParameterValue(PARAMETER_A)*4);
    float decay = getParameterValue(PARAMETER_B)*100;
    float c = getParameterValue(PARAMETER_C);
    float level = getParameterValue(PARAMETER_D)*2;
    drum[0]->setDecay(decay);
    drum[0]->setFrequency(tone);
    drum[1]->setDecay(decay*2);
    drum[1]->setFrequency(tone*2);
    drum[1]->setSnap(c);
    FloatArray left = buffer.getSamples(LEFT_CHANNEL);
    FloatArray right = buffer.getSamples(RIGHT_CHANNEL);
    if(isButtonPressed(PUSHBUTTON) != buttonstate){
      buttonstate = isButtonPressed(PUSHBUTTON);
      if(buttonstate){
	drum[0]->trigger();
	drum[1]->trigger();
      }
    }
    drum[0]->getSamples(left);
    drum[1]->getSamples(right);
    left.multiply(level);
    right.multiply(level);
  }
开发者ID:camerondavidbailey,项目名称:MyPatches,代码行数:24,代码来源:BassDrumPatch.hpp


注:本文中的FloatArray::multiply方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。