stereo.c

来自「dsp5416 fir windows程序源码」· C语言 代码 · 共 50 行

C
50
字号
/*****************************************************************************/
/*                                                                           */
/* FILENAME                                                                  */
/* 	stereo.c                                                                 */
/*                                                                           */
/* DESCRIPTION                                                               */
/*   TMS320C5416 DSK.                                                        */
/*   Conversion from stereo to mono.                                         */
/*                                                                           */
/* REVISION                                                                  */
/*   Revision: 1.00	                                                         */
/*   Author  : Richard Sikora                                                */
/*---------------------------------------------------------------------------*/
/*                                                                           */
/* HISTORY                                                                   */
/*   Revision: 1.00                                                          */
/*   6th April 2002. Created by Richard Sikora.                              */
/*                                                                           */
/*****************************************************************************/

#include <stdio.h>


/*****************************************************************************/
/* stereo_to_mono()                                                          */
/*---------------------------------------------------------------------------*/
/*                                                                           */
/* INPUTS:  left and right channel (stereo) information.                     */
/*                                                                           */
/* RETURNS: Average of two input channels (mono)                             */
/*                                                                           */
/*****************************************************************************/

signed int stereo_to_mono(signed int left_channel, signed int right_channel)
{
 signed long temp;
 
 /* Take average of left and right channels. */
 
 temp = (signed long) left_channel + (signed long) right_channel;
 
 temp >>= 1;    /* Divide by 2 to prevent overload at output */
 
 return ((signed int) temp); /* Return mono value to calling function */
}

/*****************************************************************************/
/* End of stereo.c                                                           */
/*****************************************************************************/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?