📄 amf_tonecontroltreble_s.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_ToneControlTreble_S.c#3 $
// Part of : VisualAudio V2.5.0
// Updated : $Date: 2006/10/12 $ by $Author: Fernando $
#include "AMF_ToneControlTreble_S.h"
#include "VA_GeneralHelperFunctions.h"
void AMF_ToneControlTreble_S_Render(AMF_ToneControlTreble_S * 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 // C example code
#pragma optimize_for_speed
SEG_MOD_FAST_CODE void AMF_ToneControlTreble_S_Render(AMF_ToneControlTreble_S * restrict instance,float * restrict * buffers,int tickSize) {
int i;
float amp = instance->aux->amp;
float ampTarget = instance->ampTarget;
float pm *state = &instance->aux->state[0];
float ampSmoothing = instance->ampSmoothing;
float b0 = instance->b0;
float oneMinusRate = 1.0 - ampSmoothing;
float tmp[2];
float allPass[2];
float *in = buffers[0]; // Don't use restrict because we say they can alias (see .h file)
float *out = buffers[1];
// In assembly version, this uses SIMD
for (i=0; i<tickSize*2; i+=2) {
// the smoothed shelf amplitude
amp = amp * oneMinusRate + ampTarget * ampSmoothing;
// the allpass filter
tmp[0] = in[i] - b0 * state[0];
tmp[1] = in[i+1] - b0 * state[1];
allPass[0] = b0 * tmp[0] + state[0];
allPass[1] = b0 * tmp[1] + state[1];
state[0] = tmp[0];
state[1] = tmp[1];
// the Regalia-Mitra low shelf
out[i] = 0.5 * ( (in[i] + allPass[0]) + amp * (in[i] - allPass[0]) );
out[i+1] = 0.5 * ( (in[i+1] + allPass[1]) + amp * (in[i+1] - allPass[1]) );
}
instance->aux->amp = amp;
}
#endif
SEG_MOD_SLOW_CONST const AMF_ModuleClass AMFClassToneControlTreble_S = {
/* Flags */
0,
/** Reference to render function. */
(AMF_RenderFunction)AMF_ToneControlTreble_S_Render,
/* Default bypass */
(void *)0,
/* Input descriptor - 1 input, and it is stereo. */
1, AMF_StereoPin(0),
/* Output descriptor - 1 output, and it is stereo. */
1, AMF_StereoPin(0)
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -