📄 writ_dat.c
字号:
/*----------------------------------------------------------------------
*
* FUNCTION: writ_data
*
* PURPOSE: round array of float data to 16-bit words and write to the
* file "fp"
*
*--------------------------------------------------------------------------*/
#include <stdio.h>
#include "../include/amr_plus.h"
void writ_data(
float data[], /* input : data */
int size, /* input : number of samples */
FILE *fp /* output: file pointer */
)
{
short data16[4*L_FRAME_FSMAX];
int i;
float temp;
for (i = 0; i < size; i++)
{
temp = data[i];
if (temp >= 0.0)
temp += 0.5;
else
temp -= 0.5;
if (temp > 32767.0 ) temp = 32767.0;
if (temp < -32767.0 ) temp = -32767.0;
data16[i] = (short) temp;
}
fwrite(data16, sizeof(short), size, fp);
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -