| [354] | 1 | /* SCCSID = %W% %E% */
|
|---|
| 2 | /****************************************************************************
|
|---|
| 3 | * *
|
|---|
| 4 | * Copyright (c) IBM Corporation 1994 - 1997. *
|
|---|
| 5 | * Copyright (c) Voyetra Technologies 1990-1993. All rights reserved *
|
|---|
| 6 | * *
|
|---|
| 7 | * The following IBM OS/2 source code is provided to you solely for the *
|
|---|
| 8 | * the purpose of assisting you in your development of OS/2 device drivers. *
|
|---|
| 9 | * You may use this code in accordance with the IBM License Agreement *
|
|---|
| 10 | * provided in the IBM Device Driver Source Kit for OS/2. *
|
|---|
| 11 | * *
|
|---|
| 12 | ****************************************************************************/
|
|---|
| 13 | /**@internal %W%
|
|---|
| 14 | * General purpose #define's for FMSYNTH.
|
|---|
| 15 | * @version %I%
|
|---|
| 16 | * @context
|
|---|
| 17 | * Unless otherwise noted, all interfaces are Ring-0, 16-bit, kernel stack.
|
|---|
| 18 | * @notes
|
|---|
| 19 | * @history
|
|---|
| 20 | */
|
|---|
| 21 |
|
|---|
| 22 | #ifndef ADLIB_INCLUDED
|
|---|
| 23 | #define ADLIB_INCLUDED
|
|---|
| 24 |
|
|---|
| 25 | #define MAX_NUMBER_OF_OPERATORS 14 // 6 vx, 5 drum, 3 2op
|
|---|
| 26 | #define MAX_NUMBER_OF_VOICES 14
|
|---|
| 27 | #define NUMBER_OF_CHANNELS 16
|
|---|
| 28 | #define NUMBER_OF_BUILT_IN_VOICES 128
|
|---|
| 29 | #define DEF_PERCUSSION_CHANNEL (16-1)
|
|---|
| 30 | #define PERCUSSION_CHANNEL percussion_channel
|
|---|
| 31 | #define DEF_PERC_MODE 1
|
|---|
| 32 | #define MIN_PGM_FOR_CTRL 126
|
|---|
| 33 |
|
|---|
| 34 | #define BD (6 + 3)
|
|---|
| 35 | #define SD (7 + 3)
|
|---|
| 36 | #define TOM (8 + 3)
|
|---|
| 37 | #define CYMB (9 + 3)
|
|---|
| 38 | #define HIHAT (10 +3)
|
|---|
| 39 |
|
|---|
| 40 | #define DRUM_PATCH_OFFSET 128
|
|---|
| 41 |
|
|---|
| 42 | /* long cur_bender[] is calc-ed so that 2048 * NR_STEP_PITCH is one half step */
|
|---|
| 43 | #define NR_STEP_PITCH 25 /* 25 steps within a half-tone for pitch bend */
|
|---|
| 44 |
|
|---|
| 45 | /* Parameters of each voice: */
|
|---|
| 46 | #define nbLocParam 5
|
|---|
| 47 | #define OLD_LOC_PARAM 14
|
|---|
| 48 |
|
|---|
| 49 | #define prmKsl 1
|
|---|
| 50 | #define prmLevel 1
|
|---|
| 51 | #define prmWaveSel 4 /* wave select */
|
|---|
| 52 | #define prmFm 4
|
|---|
| 53 | #define prmFeedBack prmFm /* use for opr. 0 only */
|
|---|
| 54 |
|
|---|
| 55 | #define MAX_VOLUME 0x7f
|
|---|
| 56 | #define MAX_PITCH 0x3fff
|
|---|
| 57 | #define MID_PITCH 0x2000
|
|---|
| 58 |
|
|---|
| 59 | #define MID_C 60 /* MIDI standard mid C */
|
|---|
| 60 | #define CHIP_MID_C 48 /* sound chip mid C */
|
|---|
| 61 | #define NR_NOTES 96 /* # of notes we can play on chip */
|
|---|
| 62 |
|
|---|
| 63 | #define MAX_MELO_MODE_VX 5 // 0..8
|
|---|
| 64 | #define MAX_PERC_MODE_VX 5 // 0..5
|
|---|
| 65 |
|
|---|
| 66 | #define NUM_SLOTS_CHIP 36 /* OPL3 looks like 2 ADLIB chips */
|
|---|
| 67 | #define NUMBER_OF_OPERATORS_CHIP 6
|
|---|
| 68 | #define NUM_SLOTS_HALF 18
|
|---|
| 69 |
|
|---|
| 70 | #define MODE_MELO 0 // 9 VX MELODIC MODE (MAY BE STEREO)
|
|---|
| 71 | #define MODE_PERC 1 // PERC MODE
|
|---|
| 72 |
|
|---|
| 73 | #define TOT_SLOTS (NUM_SLOTS_CHIP) /* number of raw voice slots on card */
|
|---|
| 74 |
|
|---|
| 75 | /**************** MISC DEFINED FOR FM CHIPS *****************/
|
|---|
| 76 | #define MY_BEST_BD_PITCH CHIP_MID_C
|
|---|
| 77 |
|
|---|
| 78 | #define PATCH_NAME_LEN 16
|
|---|
| 79 | #define PATCH_PAD_LEN 4
|
|---|
| 80 | #define EXTRA_DATA_LENGTH 0
|
|---|
| 81 | #define PATCH_LENGTH (4 * nbLocParam + EXTRA_DATA_LENGTH)
|
|---|
| 82 | #define OLD_PATCH_LENGTH (4 * OLD_LOC_PARAM + PATCH_NAME_LEN + PATCH_PAD_LEN)
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 | /*********** CHANNEL_ENTRY STRUCTURE *******************/
|
|---|
| 86 | /*********** USED TO KEEP TRACK OF A MIDI CHANNEL ******/
|
|---|
| 87 |
|
|---|
| 88 | typedef struct
|
|---|
| 89 | {
|
|---|
| 90 | char program; // Last MIDI program change received on this channel
|
|---|
| 91 | // Tells what timbre to use with next notes played on this channel
|
|---|
| 92 | char volume; // Last MIDI volume message.
|
|---|
| 93 | unsigned bender; // Last pitch bend message. Used to determine note pitches
|
|---|
| 94 | char pan; // Last MIDI pan message value
|
|---|
| 95 | char sus_pedal; // Current state of the Damper (sustenuto) pedal
|
|---|
| 96 | } CHANNEL_ENTRY;
|
|---|
| 97 |
|
|---|
| 98 | /********* VOICE_STATUS_ENTRY STRUCTURE *******************/
|
|---|
| 99 | /* NOTE: in this case, a voice is:
|
|---|
| 100 | * a 4 op combination in the 2 op driver
|
|---|
| 101 | */
|
|---|
| 102 | typedef struct
|
|---|
| 103 | {
|
|---|
| 104 | BYTE cur_pitch; // pitch, in midi note number, of this voice
|
|---|
| 105 | BYTE cur_chan; // midi channel that triggered this voice.
|
|---|
| 106 | // this is used often, especially by for_all_ops_on_channel,
|
|---|
| 107 | // when you need to do something on a channel basis.
|
|---|
| 108 | } VOICE_STATUS_ENTRY;
|
|---|
| 109 |
|
|---|
| 110 |
|
|---|
| 111 | /********* STRUCTURE DEFINES FOR VOICE ALLOCATION FUNCTIONS **********/
|
|---|
| 112 |
|
|---|
| 113 | /* OFF_ENTRY STRUCTURE
|
|---|
| 114 | *
|
|---|
| 115 | * used to make pseudo linked lists from arrays
|
|---|
| 116 | * these pseudo lists are character arrays where the character is
|
|---|
| 117 | * the next array position in the list. There is no data stored
|
|---|
| 118 | * in the list, as the array position is the data.
|
|---|
| 119 | */
|
|---|
| 120 | typedef struct
|
|---|
| 121 | {
|
|---|
| 122 | signed char next;
|
|---|
| 123 | } OFF_ENTRY;
|
|---|
| 124 |
|
|---|
| 125 | typedef struct
|
|---|
| 126 | {
|
|---|
| 127 | int freelist;
|
|---|
| 128 | int usedlist;
|
|---|
| 129 | int usedcount;
|
|---|
| 130 | int lastused;
|
|---|
| 131 | OFF_ENTRY * data;
|
|---|
| 132 | VOICE_STATUS_ENTRY * op_stats;
|
|---|
| 133 | } ALLOC_Q, near * NPALLOC_Q;
|
|---|
| 134 |
|
|---|
| 135 | /***************** DERIVE DEFINE FROM DRUM_PATCH_LEN *************/
|
|---|
| 136 |
|
|---|
| 137 | #define DRUM_PATCH_LEN (2 * nbLocParam)
|
|---|
| 138 |
|
|---|
| 139 | // Constants used by for_all_ops_on_chan() to select function.
|
|---|
| 140 | #define ID_do_handle_pitch_bend 1
|
|---|
| 141 | #define ID_shut_off_chan_voice 2
|
|---|
| 142 | #define ID_do_sus_off 3
|
|---|
| 143 |
|
|---|
| 144 | #endif // ADLIB_INCLUDED
|
|---|
| 145 |
|
|---|