00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef __FMOPL_H_
00010 #define __FMOPL_H_
00011
00012
00013
00014 #define alChar 0x20
00015 #define alScale 0x40
00016 #define alAttack 0x60
00017 #define alSus 0x80
00018 #define alWave 0xe0
00019
00020 #define alFreqL 0xa0
00021 #define alFreqH 0xb0
00022 #define alFeedCon 0xc0
00023
00024 #define alEffects 0xbd
00025
00026 #define OPL_OUTPUT_BIT 16
00027
00028 typedef unsigned char UINT8;
00029 typedef unsigned short UINT16;
00030 typedef unsigned long UINT32;
00031 typedef signed char INT8;
00032 typedef signed short INT16;
00033 typedef signed long INT32;
00034
00035 #if (OPL_OUTPUT_BIT==16)
00036 typedef INT16 OPLSAMPLE;
00037 #endif
00038 #if (OPL_OUTPUT_BIT==8)
00039 typedef unsigned char OPLSAMPLE;
00040 #endif
00041
00042
00043 typedef struct fm_opl_slot
00044 {
00045 INT32 TL;
00046 INT32 TLL;
00047 UINT8 KSR;
00048 INT32 *AR;
00049 INT32 *DR;
00050 INT32 SL;
00051 INT32 *RR;
00052 UINT8 ksl;
00053 UINT8 ksr;
00054 UINT32 mul;
00055 UINT32 Cnt;
00056 UINT32 Incr;
00057
00058 UINT8 eg_typ;
00059 UINT8 evm;
00060 INT32 evc;
00061 INT32 eve;
00062 INT32 evs;
00063 INT32 evsa;
00064 INT32 evsd;
00065 INT32 evsr;
00066
00067 UINT8 ams;
00068 UINT8 vib;
00069
00070 INT32 **wavetable;
00071 } OPL_SLOT;
00072
00073
00074 typedef struct fm_opl_channel
00075 {
00076 OPL_SLOT SLOT[2];
00077 UINT8 CON;
00078 UINT8 FB;
00079 INT32 *connect1;
00080 INT32 *connect2;
00081 INT32 op1_out[2];
00082
00083 UINT32 block_fnum;
00084 UINT8 kcode;
00085 UINT32 fc;
00086 UINT32 ksl_base;
00087 UINT8 keyon;
00088 } OPL_CH;
00089
00090
00091 typedef struct fm_opl_f {
00092 UINT8 type;
00093 int clock;
00094 int rate;
00095 double freqbase;
00096 UINT8 address;
00097 UINT32 mode;
00098
00099 OPL_CH *P_CH;
00100 int max_ch;
00101
00102 UINT8 rythm;
00103
00104 INT32 AR_TABLE[75];
00105 INT32 DR_TABLE[75];
00106 UINT32 FN_TABLE[1024];
00107
00108 INT32 *ams_table;
00109 INT32 *vib_table;
00110 INT32 amsCnt;
00111 INT32 amsIncr;
00112 INT32 vibCnt;
00113 INT32 vibIncr;
00114
00115 UINT8 wavesel;
00116 } FM_OPL;
00117
00118
00119 #define OPL_TYPE_YM3812 0
00120
00121 FM_OPL *OPLCreate(int type, int clock, int rate);
00122 void OPLDestroy(FM_OPL *OPL);
00123
00124 void OPLResetChip(FM_OPL *OPL);
00125 void OPLWrite(FM_OPL *OPL,int a,int v);
00126 unsigned char OPLRead(FM_OPL *OPL,int a);
00127
00128 void YM3812UpdateOne(FM_OPL *OPL, void *buffer, int length);
00129
00130 #endif
00131
00132
00133
00134