stereo.c

来自「dsp 5416dsk aduio音效code」· C语言 代码 · 共 45 行

C
45
字号
/*****************************************************************************/
/* FILENAME                                                                  */
/* 	 stereo.c                                                                */
/*                                                                           */
/* DESCRIPTION                                                               */
/*   Stereo handling of signals.                                             */
/*                                                                           */
/* VERSION                                                                   */
/*   1.01                                                                    */
/*                                                                           */
/* AUTHOR                                                                    */
/*   Bao Xiaojing                                                            */
/*                                                                           */
/* REVISION HISTORY                                                          */
/*   VER   DATE        AUTHOR          DESCRIPTION                           */
/* ------------------------------------------------------------------------  */
/*   1.01  2008.12.06  Bao Xiaojing    Update 3 audio effects.               */
/*   1.00  2002.04.06  Richard Sikora  Initial version.                      */
/*                                                                           */
/*****************************************************************************/

#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 + -
显示快捷键?