本文整理汇总了C++中FloatArray::copyFrom方法的典型用法代码示例。如果您正苦于以下问题:C++ FloatArray::copyFrom方法的具体用法?C++ FloatArray::copyFrom怎么用?C++ FloatArray::copyFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FloatArray
的用法示例。
在下文中一共展示了FloatArray::copyFrom方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processAudio
void processAudio(AudioBuffer &buffer){
FloatArray left = buffer.getSamples(LEFT_CHANNEL);
FloatArray right = buffer.getSamples(RIGHT_CHANNEL);
leftBuffer->copyFrom(left);
rightBuffer->copyFrom(right);
leftPatch.processAudio(*leftBuffer);
rightPatch.processAudio(*rightBuffer);
left.copyFrom(*leftBuffer);
right.copyFrom(*rightBuffer);
}
示例2: 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);
}
示例3: processAudio
void processAudio(AudioBuffer &buffer) {
float tune = getParameterValue(PARAMETER_A)*6.0 - 4.0;
float b = getParameterValue(PARAMETER_B);
float c = getParameterValue(PARAMETER_C);
float d = getParameterValue(PARAMETER_D);
float e = getParameterValue(PARAMETER_E);
harms.setTimeStep(b*b);
harms.setControl(1, c);
harms.setControl(2, d);
harms.setControl(3, e);
harms.normalizeAmplitudes();
harms.calculateNormalized(wavetable, samples);
harms.increment();
FloatArray left = buffer.getSamples(LEFT_CHANNEL);
FloatArray right = buffer.getSamples(RIGHT_CHANNEL);
hz.setTune(tune);
float freq = hz.getFrequency(left[0]);
osc->setFrequency(freq);
osc->getSamples(left);
right.copyFrom(left);
}