📄 amf_volumefletchermunson.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_VolumeFletcherMunson.c#3 $
// Part of : VisualAudio V2.5.0
// Updated : $Date: 2006/10/12 $ by $Author: Fernando $
#include "AMF_VolumeFletcherMunson.h"
#include "VA_GeneralHelperFunctions.h"
void AMF_VolumeFletcherMunson_Render(AMF_VolumeFletcherMunson * 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
SEG_MOD_FAST_CODE void AMF_VolumeFletcherMunson_Render(AMF_VolumeFletcherMunson * restrict instance,float * restrict * buffers,int tickSize) {
int i;
float amp = instance->amp;
float ampTarget = instance->ampTarget;
float lowAmp = instance->lowAmp;
float lowAmpTarget = instance->lowAmpTarget;
float state1 = instance->aux->state1;
float state2 = instance->aux->state2;
float ampSmoothing = instance->ampSmoothing;
float b0 = instance->b0;
float b1 = instance->b1;
float oneMinusRate = 1.0 - ampSmoothing;
float tmp;
float allPass;
float *in = buffers[0];
float *out = buffers[1];
float *t = out;
// the allpass filter, in -> out
for (i=0; i<tickSize; i++) {
tmp = in[i] - b1 * state1 - b0 * state2;
t[i] = b0 * tmp + b1 * state1 + state2;
state2 = state1;
state1 = tmp;
}
// smothing and Regalia-Mitra boost, out->out
for (i=0; i<tickSize; i++) {
// the smoothed amplitude and 'peaking' amplitude
amp = amp * oneMinusRate + ampTarget * ampSmoothing;
lowAmp = lowAmp * oneMinusRate + lowAmpTarget * ampSmoothing;
// the Regalia-Mitra low boost
out[i] = 0.5 * (amp * (in[i] + t[i]) + lowAmp * (in[i] - t[i]) );
}
instance->amp = amp;
instance->lowAmp = lowAmp;
instance->aux->state1 = state1;
instance->aux->state2 = state2;
}
#endif
SEG_MOD_SLOW_CONST const AMF_ModuleClass AMFClassVolumeFletcherMunson = {
/* Flags */
0,
/** Reference to render function. */
(AMF_RenderFunction)AMF_VolumeFletcherMunson_Render, // render function
/* Default bypass */
(void *)0,
/* Input descriptor - 1 input, and it is mono. */
1, 0,
/* Output descriptor - 1 output, and it is mono. */
1, 0,
};
// Class-specific helper functions
// see AMF_SetFMGain() in VA_GeneralHelperFunctions.c
// also macro in AMF_VolumeFletcherMunson.h
// AMF_VolumeFletcherMunson_SetGain()
// Function to set Volume VolumeFletcherMunson and VolumeFletcherMunson_S in dB (-192.0 - 0.0)
// Bass Boost calculated via 2nd order polynomial
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -