home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume6 / glib / part02 / cz.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-05-21  |  4.2 KB  |  160 lines

  1. /* $Id: cz.h,v 1.6 89/05/06 17:13:13 lee Exp $
  2.  * CZ Synthesizer Family Parameter Definitions
  3.  *
  4.  *  Filename:   cz.h
  5.  *  Date:       03/25/89, Mark R. Rinfret
  6.  * 
  7.  *
  8.  *  Note:   One of the preprocessor flags, CZ1 or CZ101, must be defined
  9.  *          by the source file including this package.
  10.  * $Log:    cz.h,v $
  11.  * Revision 1.6  89/05/06  17:13:13  lee
  12.  * rel. to comp.sources.misc
  13.  * 
  14.  */
  15.  
  16. #ifdef CZ101
  17. #define CZ_NAME "CZ-101"
  18. #endif
  19.  
  20.  
  21. #ifdef CZ1
  22. #ifdef CZ_NAME
  23. #include "You may not define CZ1 and CZ101 in the same compile!"
  24. #endif
  25. #define CZ_NAME "CZ-1"
  26. #endif
  27.  
  28. #ifndef CZ_NAME
  29. #include "You MUST define either CZ1 or CZ101!"
  30. #endif
  31.  
  32. #ifndef UBYTE
  33. #define UBYTE   unsigned char
  34. #define USHORT  unsigned short
  35. #endif
  36.  
  37. #define ENVELOPESIZE            16      /* 8 rate/level pairs */
  38. #define END_SYSTEM_EXCLUSIVE    0xF7
  39.  
  40. /* MIDI note-on and note-off commands */
  41.  
  42. #define MIDI_NOTE_ON            0x90
  43. #define MIDI_NOTE_OFF           0x80
  44.  
  45. #define MIDI_STATUS_MASK        0x80
  46.  
  47.  
  48. #ifdef CZ101
  49. struct ToneData {
  50.     UBYTE lineselect_octave;
  51.  
  52.     UBYTE detune_sign;
  53.     UBYTE detune_fine;
  54.     UBYTE detune_course;
  55.  
  56.     UBYTE vibrato_wave;
  57.     UBYTE vibrato_time[3];
  58.     UBYTE vibrato_rate[3];
  59.     UBYTE vibrato_depth[3];
  60.  
  61.     UBYTE DCO1_wave_form[2];
  62.     UBYTE DCA1_key_follow[2];
  63.     UBYTE DCW1_key_follow[2];
  64.     UBYTE DCA1_end_step;
  65.     UBYTE DCA1_envelope[ENVELOPESIZE];
  66.     UBYTE DCW1_end_step;
  67.     UBYTE DCW1_envelope[ENVELOPESIZE];
  68.     UBYTE DCO1_end_step;
  69.     UBYTE DCO1_envelope[ENVELOPESIZE];
  70.  
  71.     UBYTE DCO2_wave_form[2];
  72.     UBYTE DCA2_key_follow[2];
  73.     UBYTE DCW2_Key_follow[2];
  74.     UBYTE DCA2_end_step;
  75.     UBYTE DCA2_envelope[ENVELOPESIZE];
  76.     UBYTE DWA2_end_step;
  77.     UBYTE DWA2_envelope[ENVELOPESIZE];
  78.     UBYTE DCO2_end_step;
  79.     UBYTE DCO2_envelope[ENVELOPESIZE];
  80. };
  81. #endif
  82.  
  83. #ifdef CZ1
  84.  
  85. #define MIDI_CHANNEL_MASK       0x0f
  86. #define MIDI_FUNCTION_MASK      0xf0
  87.  
  88. /* Misc. MIDI status definitions */
  89.  
  90. #define MIDI_PITCH_BEND         0xe0
  91.  
  92. /* MIDI note-on and note-off commands */
  93.  
  94. #define MIDI_NOTE_ON            0x90
  95. #define MIDI_NOTE_OFF           0x80
  96.  
  97. #define MIDI_STATUS_MASK        0x80
  98.  
  99. #define FIRST_INTERNAL          0x00
  100. #define LAST_INTERNAL           0x3F
  101. #define FIRST_CARTRIDGE         0x40
  102. #define LAST_CARTRIDGE          0x4F
  103. #define SOUND_DATA              0x60
  104.  
  105. /* CZ-1 Tone Data Structure.
  106.  * The only major difference between this and CZ101 is the addition of
  107.  * the "name" field.
  108.  */
  109.  
  110. struct ToneData {
  111.     UBYTE lineAndOctave;
  112.  
  113.     UBYTE detuneSign;
  114.     UBYTE detuneFine;
  115.     UBYTE detuneCoarse;
  116.  
  117.     UBYTE vibratoWave;
  118.     UBYTE vibratoTime[3];
  119.     UBYTE vibratoRate[3];
  120.     UBYTE vibratoDepth[3];
  121.  
  122. /* What follows is a very unfortunate KLUDGE!  Though we would like to
  123.  * represent the two sets of waveform data as a two-item array, the MANX
  124.  * compiler forces word alignment (somewhere), giving us a total structure
  125.  * size of 146 bytes when what we really want is 144 bytes.  ARGH!
  126.  */
  127.  
  128.     UBYTE waveForms1[2];                  /* ugly, packed format */
  129.  
  130.     /* NOTE: The key follow entries actually comprise a two-byte
  131.        word but, again, the compiler won't let us do that.  The
  132.        top 4 bits of the first byte (d) represents the level value,
  133.        using the formula d = 15 - level. The bottom 4 bits of the
  134.        first byte represents the "visual" key follow value, in the
  135.        range 0 - 9.  The second byte is some magic mapping of the
  136.        visual value to an internal value.                           */
  137.     UBYTE DCA1_KeyFollow[2];
  138.     UBYTE DCW1_KeyFollow[2];
  139.     UBYTE DCA_EndStep1;                         /* DCA velocity */
  140.     UBYTE DCA_Envelope1[ENVELOPESIZE];
  141.     UBYTE DCW_EndStep1;                         /* DCW velocity */
  142.     UBYTE DCW_Envelope1[ENVELOPESIZE];
  143.     UBYTE DCO_EndStep1;                         /* DCO1 velocity */
  144.     UBYTE DCO_Envelope1[ENVELOPESIZE];
  145.  
  146.     UBYTE waveForms2[2];           /* slightly different than waveForms1! */
  147.     UBYTE DCA2_KeyFollow[2];
  148.     UBYTE DCW2_KeyFollow[2];
  149.     UBYTE DCA_EndStep2;                         /* DCA velocity */
  150.     UBYTE DCA_Envelope2[ENVELOPESIZE];
  151.     UBYTE DCW_EndStep2;                         /* DCW velocity */
  152.     UBYTE DCW_Envelope2[ENVELOPESIZE];
  153.     UBYTE DCO_EndStep2;                         /* DCO1 velocity */
  154.     UBYTE DCO_Envelope2[ENVELOPESIZE];
  155.  
  156.     UBYTE name[16];
  157. };
  158. #endif
  159.  
  160.