home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 497a.lha / ComSMUS_v2.2 / voicebank.prog / voiceiff.c < prev   
C/C++ Source or Header  |  1991-04-07  |  2KB  |  65 lines

  1. /* voiceiff - construct Karl's IFF VOCE FORM files */
  2.  
  3. #include <stdio.h>
  4. #include <fcntl.h>
  5. #include <exec/lists.h>
  6. #include <hackercorp/iff.h>
  7. #include <hackercorp/8svx.h>
  8. #include <hackercorp/sample.h>
  9. #include <hackercorp/voicebank.h>
  10.  
  11. short buffer[512];
  12.  
  13. main(argc,argv)
  14. int argc;
  15. char *argv[];
  16. {
  17.     int voicefd;
  18.     UBYTE *outp;
  19.     int i;
  20.     struct VDAT_struct vdat;
  21.     char s[100];
  22.     unsigned int first_note, last_note, reference_note, low_velocity, high_velocity;
  23.     char samplename[50];
  24.  
  25.     if (argc != 2)
  26.     {
  27.         fprintf(stderr,"usage: voiceiff <filename.input outIFFfile\n");
  28.         exit(1);
  29.     }
  30.  
  31.     /* get that IFF file open, we have to cleanup from now on */
  32.     if ((voicefd = CreateIFF(argv[1],ID_FORM,ID_VOCE)) == -1)
  33.         panic("unable to create IFF VOCE file\n");
  34.  
  35.     if (!WriteTextChunk(voicefd,ID_NAME,argv[1]))
  36.         panic("unable to write NAME chunk");
  37.  
  38.     if (!WriteTextChunk(voicefd,ID_Copyright,"Copyright (C) 1989 Hackercorp.  All Rights Reserved."))
  39.         panic("unable to write Copyright chunk");
  40.  
  41.     if (!WriteTextChunk(voicefd,ID_ANNO,"Contact Karl Lehenbauer 3918 Panorama, Missouri City, TX  USA for more info"));
  42.  
  43.     while (gets(s))
  44.     {
  45.         sscanf(s,"%d %d %d %d %d %s",&first_note,&last_note,&reference_note,&low_velocity,&high_velocity,&samplename[0]);
  46.  
  47.         printf("'%s' first %d, last %d, reference %d, lo vel %d, hi vel %d\n",samplename,first_note,last_note,reference_note,low_velocity,high_velocity);
  48.  
  49.         vdat.first_note = first_note;
  50.         vdat.last_note = last_note;
  51.         vdat.reference_note = reference_note;
  52.         vdat.low_velocity = low_velocity;
  53.         vdat.high_velocity = high_velocity;
  54.         strcpy(&vdat.samplename[0],samplename);
  55.  
  56.         if (!WriteChunk(voicefd,ID_VDAT,&vdat,sizeof(vdat)))
  57.             panic("unable to write VHDR chunk");
  58.     }
  59.  
  60.     done:
  61.     Rewrite_IFF_header(voicefd);
  62.     exit(0);
  63. }
  64.  
  65.