📄 amf_mixernxmsmoothed.c
字号:
// Copyright(c) 2005 Analog Devices, Inc. All Rights Reserved.
// This software is proprietary and confidential to Analog Devices, Inc. and its licensors.
// File : $Id: //depot/development/visualaudio/modules/2.5.0/SHARC/Source/AMF_MixerNxMSmoothed.c#3 $
// Part of : VisualAudio V2.5.0
// Updated : $Date: 2006/10/12 $ by $Author: Fernando $
#include "AMF_MixerNxMSmoothed.h"
void AMF_MixerNxMSmoothed_Render(AMF_MixerNxMSmoothed * restrict instance,float * restrict * buffers, int tickSize);
// NOTE: The C version of this function is for reference only (it is
// intended just to show the general algorithm that the module
// uses), and it may not have been fully tested
#if 0 // Example C code
#define EPSILON .0001
#pragma optimize_for_speed
SEG_MOD_FAST_CODE void AMF_MixerNxMSmoothed_Render(AMF_MixerNxMSmoothed * restrict instance,float * restrict * buffers,int tickSize) {
int i;
int inputCount = instance->b.numInputs;
int outputCount = instance->b.numOutputs;
int outNum,inNum;
float * restrict in;
float * restrict out;
float pm *ampsTargets = &instance->ampsTarget[0];
float pm *ampss = &instance->amps[0];
float ampsSmoothing = instance->ampsSmoothing;
float oneMinusRate = 1.0 - ampsSmoothing;
float amps,ampsTarget;
int outWritten; // Boolean
for (outNum=0; outNum<outputCount; outNum++) {
out = buffers[inputCount + outNum];
outWritten = 0;
for (inNum=0; inNum<inputCount; inNum++) {
ampsTarget = ampsTargets[inNum*outputCount+outNum];
amps = ampss[inNum*outputCount+outNum];
if (amps > EPSILON || ampsTarget > EPSILON) {
in = buffers[inNum];
if (!outWritten) {
outWritten = 1;
for (i=0; i<tickSize; i++) {
amps = amps * oneMinusRate + ampsTarget * ampsSmoothing;
out[i] = in[i] * amps;
}
}
}
ampss[inNum*outputCount+outNum] = amps;
}
if (!outWritten)
for (i=0; i<tickSize; i++)
// Should be able to use SIMD here
out[i] = 0.0;
}
}
#endif
SEG_MOD_SLOW_CONST const AMF_ModuleVariableClass AMFClassMixerNxMSmoothed = {
/* Flags */
AMFModuleClassFlag_VARIABLE_PIN_COUNT,
/* Render function */
(AMF_RenderFunction)AMF_MixerNxMSmoothed_Render,
/* Default bypass */
(void *)0
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -