home *** CD-ROM | disk | FTP | other *** search
- /*
- S O U N D C O N V E R T
-
- V 1.1
-
- Written 4/12/89 by Greg Dunlap
-
- This program converts raw binary sampled sound data between the Amiga
- and the Macintosh. It converts both ways. Just give it the source and
- destination files when it asks for them and let it do all the rest!
-
- */
-
-
- #include <stdio.h>
- #include <dos.h>
-
- #define BUFFERSIZE 1024 /* Size of read/write buffer */
- #define FILENAMESIZE 256 /* Max length of file name */
-
- void main()
- {
-
- char buffer[BUFFERSIZE];
- char sourcefile[FILENAMESIZE], destfile[FILENAMESIZE];
- int i;
- int sfh, dfh;
- int charsread, returnedlength;
-
- printf("Amiga <--> Macintosh sound converter V1.1, 4/12/89 by Greg Dunlap\n");
- printf("Enter sourcefile: ");
- scanf("%s",sourcefile);
- printf("Enter destfile: ");
- scanf("%s",destfile);
- if ((sfh = Open(sourcefile, MODE_OLDFILE)) == 0)
- {
- printf("Error opening \"%s\" for input.\n",sourcefile);
- exit();
- }
- if ((dfh = Open(destfile, MODE_NEWFILE)) == 0)
- {
- printf("Error opening \"%s\" for output.\n",destfile);
- Close(sfh);
- exit();
- }
- printf("Working..");
- do
- {
- charsread = Read(sfh,buffer,BUFFERSIZE);
- for(i=0; i<charsread; buffer[i++] -= 128);
- if (charsread > 0)
- returnedlength = Write(dfh,buffer,charsread);
- } while(charsread == BUFFERSIZE && returnedlength == charsread);
- Close(sfh);
- Close(dfh);
- printf("..done!\n");
- }
-
-
-