📄 fmfreqs.c
字号:
/* FmFreqs.c
This file is part of the VGB-DOS project
Copyright (C) Marcel de Kogel (m.dekogel@student.utwente.nl), 1996
Markus F.X.J. Oberhumer (markus.oberhumer@jk.uni-linz.ac.at), 1996
You may not use this file for commercial purposes
Please notify me if you make any changes to this file */
#include <stdio.h>
#include <math.h>
int main (void)
{
int i;
int b, bestb;
double v, minv;
int f, bestf;
double realfreq, adlibfreq;
FILE *file;
file = stdout;
for (i = 2048; i >= 1; i--)
{
minv = 10000; bestb = 0; bestf = 0;
realfreq = 4194304.0 / (32*i);
for (b = 0; b < 8; b++)
{
f = floor (realfreq / (50000.0 * pow(2,b-20)) + 0.5);
if (f > 1023)
continue;
adlibfreq = 50000.0 * f * pow(2,b-20);
v = fabs(realfreq - adlibfreq);
if (v < minv)
{
minv = v;
bestb = b;
bestf = f;
}
}
fprintf(file,"%1d, %4d, /* %8.2f */\n",
bestb, bestf, minv);
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -