Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;
- ; source for do the file for the hypnodot demo source
- ; code by me
- ;
- ;
- ;
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- void putWord(char* table,int pos,int value);
- int main(argc,argv)
- int argc;
- char **argv;
- {
- char mytable[1540*2];
- FILE* fichier;
- int ofs=0;
- int i;
- for (i=0;i<512;i++)
- { double sinus=sin(i*3.14159265358979/256.0);
- putWord(mytable,ofs,(int) (sinus*32767+32767));
- ofs+=1;
- }
- fichier=fopen("SIN512.ATA","w");
- for (i=0;i<1024;i++)
- {
- fputc(mytable[i],fichier);
- }
- fclose(fichier);
- ofs=0;
- for (i=0;i<1540;i++)
- {
- double sinus=sin(i*3.14159265358979*2/1540.0);
- putWord(mytable,ofs,(int) (sinus*32767+32767));
- ofs+=1;
- }
- fichier=fopen("SIN1540.ATA","w");
- for (i=0;i<1540;i++)
- {
- fputc(mytable[i],fichier);
- }
- fclose(fichier);
- }
- void putWord(char* table,int pos,int value)
- {
- table[pos*2]=(char)(((value+65536)/256) & 255);
- table[pos*2+1]=(char)(value & 255);
- }
- int min(int a,int b)
- {
- int c=a;
- if (a>b)
- {
- c=b;
- }
- return c;
- }
- int max(int a,int b)
- {
- int c=a;
- if (a<b)
- {
- c=b;
- }
- return c;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement