amf_panner.c
来自「ADI SHARC DSP 音频算法标准模块库」· C语言 代码 · 共 71 行
C
71 行
// 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_Panner.c#3 $
// Part of : VisualAudio V2.5.0
// Updated : $Date: 2006/10/12 $ by $Author: Fernando $
#include "AMF_Panner.h"
#include "VA_GeneralHelperFunctions.h"
void AMF_Panner_Render(AMF_Panner * 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_Panner_Render(AMF_Panner * restrict instance,float * restrict * buffers,int tickSize) {
int i,j;
float cosSinSmoothing = instance->cosSinSmoothing;
float oneMinusRate = 1.0 - cosSinSmoothing;
float *in = buffers[0];
float *out = buffers[1];
float c0 = instance->cosTheta;
float c1 = instance->sinTheta;
float t0 = instance->cosThetaTarget * cosSinSmoothing;
float t1 = instance->sinThetaTarget * cosSinSmoothing;
for (i=0,j=0; i<tickSize; i++,j+=2) {
// smooth Cos and Sin for pan
c0 = c0 * oneMinusRate + t0;
c1 = c1 * oneMinusRate + t1;
out[j] = in[i] * c0;
out[j+1] = in[i] * c1;
}
instance->cosTheta = c0;
instance->sinTheta = c1;
}
#endif
SEG_MOD_SLOW_CONST const AMF_ModuleClass AMFClassPanner = {
/* Flags */
0,
/* Render function */
(AMF_RenderFunction)AMF_Panner_Render, // render function
/* Default bypass */
(void *)0,
/* Input descriptor - 1 input, and it is mono. */
1, 0,
/* Output descriptor - 1 output, and it is stereo. */
1, 1,
};
// Class-specific helper functions
// see AMF_SetPannerTheta() in VA_GeneralHelperFunctions.c
// also macros in AMF_Panner.h
// AMF_Panner_SetPannerTheta()
// AMF_Panner_SetPannerValue()
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?