home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_progs / sound / newiff.lzh / NEWIFF / 8SVX.H next >
C/C++ Source or Header  |  1991-11-01  |  4KB  |  98 lines

  1. #ifndef EIGHTSVX_H
  2. #define EIGHTSVX_H
  3. /*-----------------------------------------------------------------------*
  4.  * 8SVX.H  Definitions for 8-bit sampled voice (VOX).   2/10/86
  5.  *
  6.  * By Jerry Morrison and Steve Hayes, Electronic Arts.
  7.  * This software is in the public domain.
  8.  *
  9.  * This version for the Commodore-Amiga computer.
  10.  *----------------------------------------------------------------------*/
  11. #ifndef COMPILER_H
  12. #include "iff/compiler.h"
  13. #endif
  14.  
  15. #include "iff/iff.h"
  16.  
  17. #define ID_8SVX      MakeID('8', 'S', 'V', 'X')
  18. #define ID_VHDR      MakeID('V', 'H', 'D', 'R')
  19. #define ID_NAME      MakeID('N', 'A', 'M', 'E')
  20. #define ID_Copyright MakeID('(', 'c', ')', ' ')
  21.  
  22. #define ID_AUTH      MakeID('A', 'U', 'T', 'H')
  23. #define ID_ANNO      MakeID('A', 'N', 'N', 'O')
  24.  
  25. #define ID_BODY      MakeID('B', 'O', 'D', 'Y')
  26.  
  27. #define ID_ATAK      MakeID('A', 'T', 'A', 'K')
  28. #define ID_RLSE      MakeID('R', 'L', 'S', 'E')
  29.  
  30. /* ---------- Voice8Header ---------------------------------------------*/
  31. typedef LONG Fixed;    /* A fixed-point value, 16 bits to the left of
  32.              * the point and 16 to the right. A Fixed is a
  33.              * number of 2**16ths, i.e. 65536ths. */
  34. #define Unity 0x10000L    /* Unity = Fixed 1.0 = maximum volume */
  35.  
  36. /* sCompression: Choice of compression algorithm applied to the samples. */
  37. #define sCmpNone       0    /* not compressed */
  38. #define sCmpFibDelta   1    /* Fibonacci-delta encoding (Appendix C) */
  39.                 /* Could be more kinds in the future. */
  40. typedef struct {
  41.     ULONG oneShotHiSamples,    /* # samples in the high octave 1-shot part */
  42.           repeatHiSamples,    /* # samples in the high octave repeat part */
  43.           samplesPerHiCycle;    /* # samples/cycle in high octave, else 0 */
  44.     UWORD samplesPerSec;    /* data sampling rate */
  45.     UBYTE ctOctave,        /* # of octaves of waveforms */
  46.           sCompression;        /* data compression technique used */
  47.     Fixed volume;        /* playback nominal volume from 0 to Unity
  48.                  * (full volume). Map this value into
  49.                  * the output hardware's dynamic range.
  50.                  */
  51.     } Voice8Header;
  52.  
  53. /* ---------- NAME -----------------------------------------------------*/
  54. /* NAME chunk contains a CHAR[], the voice's name. */
  55.  
  56. /* ---------- Copyright ------------------------------------------------*/
  57. /* "(c) " chunk contains a CHAR[], the FORM's copyright notice. */
  58.  
  59. /* ---------- AUTH -----------------------------------------------------*/
  60. /* AUTH chunk contains a CHAR[], the author's name. */
  61.  
  62. /* ---------- ANNO -----------------------------------------------------*/
  63. /* ANNO chunk contains a CHAR[], the author's text annotations. */
  64.  
  65. /* ---------- Envelope ATAK & RLSE -------------------------------------*/
  66. typedef struct {
  67.     UWORD duration;    /* segment duration in milliseconds, > 0 */
  68.     Fixed dest;        /* destination volume factor */
  69.     } EGPoint;
  70.  
  71. /* ATAK and RLSE chunks contain an EGPoint[], piecewise-linear envelope. */
  72.  
  73. /* The envelope defines a function of time returning Fixed values.
  74.  * It's used to scale the nominal volume specified in the Voice8Header.
  75.  */
  76.  
  77. /* ---------- BODY -----------------------------------------------------*/
  78. /* BODY chunk contains a BYTE[], array of audio data samples. */
  79. /* (8-bit signed numbers, -128 through 127.) */
  80.  
  81.  
  82. /* ---------- 8SVX Reader Support Routines -----------------------------*/
  83.  
  84. /* Just call this macro to read a VHDR chunk. */
  85. #define GetVHDR(context, vHdr)  \
  86.     IFFReadBytes(context, (BYTE *)vHdr, sizeof(Voice8Header))
  87.  
  88.  
  89. /* ---------- 8SVX Writer Support Routines -----------------------------*/
  90.  
  91. /* Just call this macro to write a VHDR chunk. */
  92. #define PutVHDR(context, vHdr)  \
  93.     PutCk(context, ID_VHDR, sizeof(Voice8Header), (BYTE *)vHdr)
  94.  
  95. #endif
  96.  
  97.  
  98.