home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / sound / nh10src / vocwalk.c < prev    next >
Encoding:
Text File  |  1991-12-15  |  1.2 KB  |  36 lines

  1. //┌───────────────────────────────────────────────────────────────────────┐//
  2. //│                                                                       │//
  3. //└───────────────────────────────────────────────────────────────────────┘//
  4. VOC_freqency()
  5. {
  6.    FILE *fin
  7.      VOCHDR VH;
  8.    long type_size, size;
  9.    char type, frequency;
  10.    long freq;
  11. //.........................................................................
  12.    freq = 0;
  13.    if ((fin = fopen (input_file, "rb")) == NULL) show_error(2, input_file);
  14.    if (fread (&VH, sizeof(VH), 1, fin) == 0) show_error(5, input_file);
  15.    if (fseek (fin, VH.voice_offset, SEEK_SET) != 0) show_error(5, input_file);
  16.      while (!feof(fin))
  17.      {
  18.       if (fread (&type_size, 4, 1, fin) == 0 && !feof(fin)) show_error(5, input_file);
  19.       type = type_size & 0x000000FF;
  20.       size = type_size >> 8;
  21.       if (type == 0) break;
  22.             if (feof(fin)) break;
  23.       if (type == 1)
  24.       {
  25.          fread (&frequency, 1, 1, fin);
  26.          freq = 1000000/(256-(unsigned char)frequency);
  27.          break;
  28.       }
  29.       if (fseek (fin, size, SEEK_CUR) != 0) show_error (5, input_file);
  30.      }
  31.    fclose(fin);
  32.      return;
  33. }
  34.  
  35.  
  36.