Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FILE *o;
- double a;
- double b;
- double fr;
- double pclk;
- a = pow(2.0, (1.0 / 12.0));
- pclk = (1.0 / (4433618.75 * 1.6)) * 2.0;
- o = fopen("mt_PeriodTable.h", "w");
- fprintf(o, "const short mt_PeriodTable[%d] =\n{\n%c", 16 * 37, 0x09);
- for (i = 0; i < 16; ++i)
- {
- b = pow(a, ((double)i / 8.0));
- fr = 258.9731 * b;
- for (j = 0; j < 36; ++j)
- {
- mt_PeriodTable[(i * 37) + j] = (int)((1.0 / fr / pclk) / 16.0);
- fr *= a;
- fprintf(o, "%d,", mt_PeriodTable[(i * 37) + j]);
- if (j == 35)
- fprintf(o, "0,\n%c", 0x09);
- else if ((j % 12) == 11)
- fprintf(o, "\n%c", 0x09);
- }
- mt_PeriodTable[(i * 37) + j] = 0;
- }
- fseek(o, -4, SEEK_CUR);
- fprintf(o, "\n};\n");
- fclose(o);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement