|
|
| version 1.3, 2003/10/18 09:02:38 | version 1.13, 2007/10/28 16:01:35 |
|---|---|
| Line 1 | Line 1 |
| enum { | enum { |
| #if defined(SUPPORT_PX) | |
| OPNCH_MAX = 30, | |
| #else // defined(SUPPORT_PX) | |
| OPNCH_MAX = 12, | OPNCH_MAX = 12, |
| OPNA_CLOCK = 3993600, | #endif // defined(SUPPORT_PX) |
| OPNA_CLOCK = 55466 * 72, | |
| OPN_CHMASK = 0x8000, | OPN_CHMASK = 0x80000000, |
| OPN_STEREO = 0x8000, | OPN_STEREO = 0x80000000, |
| OPN_MONORAL = 0x0000 | OPN_MONORAL = 0x00000000 |
| }; | }; |
| #ifdef OPNGENX86 | #if defined(OPNGENX86) |
| enum { | enum { |
| FMDIV_BITS = 8, | FMDIV_BITS = 8, |
| FMDIV_ENT = (1 << FMDIV_BITS), | FMDIV_ENT = (1 << FMDIV_BITS), |
| FMVOL_SFTBIT = 4, | FMVOL_SFTBIT = 4 |
| }; | |
| #define SIN_BITS 11 | |
| #define EVC_BITS 10 | |
| #define ENV_BITS 16 | |
| #define KF_BITS 6 | |
| #define FREQ_BITS 20 | |
| #define ENVTBL_BIT 14 | |
| #define SINTBL_BIT 14 | |
| #elif defined(OPNGENARM) | |
| SIN_BITS = 11, | enum { |
| EVC_BITS = 10, | FMDIV_BITS = 8, |
| ENV_BITS = 16, | FMDIV_ENT = (1 << FMDIV_BITS), |
| KF_BITS = 6, | FMVOL_SFTBIT = 4 |
| FREQ_BITS = 20, | |
| ENVTBL_BIT = 14, | |
| SINTBL_BIT = 14 | |
| }; | }; |
| #define SIN_BITS 8 | |
| #define EVC_BITS 7 | |
| #define ENV_BITS 16 | |
| #define KF_BITS 6 | |
| #define FREQ_BITS 20 | |
| #define ENVTBL_BIT 14 | |
| #define SINTBL_BIT 14 // env+sin 30bit max | |
| #else | #else |
| enum { | enum { |
| FMDIV_BITS = 8, | FMDIV_BITS = 8, |
| FMDIV_ENT = (1 << FMDIV_BITS), | FMDIV_ENT = (1 << FMDIV_BITS), |
| FMVOL_SFTBIT = 4, // CÈǤÏ̵»ë | FMVOL_SFTBIT = 4 |
| SIN_BITS = 10, | |
| EVC_BITS = 10, | |
| ENV_BITS = 16, | |
| KF_BITS = 6, | |
| FREQ_BITS = 20, | |
| ENVTBL_BIT = 14, | |
| SINTBL_BIT = 15 // env+sin 30bit max | |
| }; | }; |
| #define SIN_BITS 10 | |
| #define EVC_BITS 10 | |
| #define ENV_BITS 16 | |
| #define KF_BITS 6 | |
| #define FREQ_BITS 20 | |
| #define ENVTBL_BIT 14 | |
| #define SINTBL_BIT 15 | |
| #endif | #endif |
| #define TL_BITS (FREQ_BITS+2) | #define TL_BITS (FREQ_BITS+2) |
| Line 72 typedef struct { | Line 92 typedef struct { |
| SINT32 *detune1; // detune1 | SINT32 *detune1; // detune1 |
| SINT32 totallevel; // total level | SINT32 totallevel; // total level |
| SINT32 decaylevel; // decay level | SINT32 decaylevel; // decay level |
| const SINT32 *attack; // attack raito | const SINT32 *attack; // attack ratio |
| const SINT32 *decay1; // decay1 raito | const SINT32 *decay1; // decay1 ratio |
| const SINT32 *decay2; // decay2 raito | const SINT32 *decay2; // decay2 ratio |
| const SINT32 *release; // release raito | const SINT32 *release; // release ratio |
| SINT32 freq_cnt; // frequency count | SINT32 freq_cnt; // frequency count |
| SINT32 freq_inc; // frequency step | SINT32 freq_inc; // frequency step |
| SINT32 multiple; // multiple | SINT32 multiple; // multiple |
| BYTE keyscale; // key scale | UINT8 keyscale; // key scale |
| BYTE env_mode; // envelope mode | UINT8 env_mode; // envelope mode |
| BYTE envraito; // envelope raito | UINT8 envratio; // envelope ratio |
| BYTE ssgeg1; // SSG-EG | UINT8 ssgeg1; // SSG-EG |
| SINT32 env_cnt; // envelope count | SINT32 env_cnt; // envelope count |
| SINT32 env_end; // envelope end count | SINT32 env_end; // envelope end count |
| Line 95 const SINT32 *release; // release rait | Line 115 const SINT32 *release; // release rait |
| typedef struct { | typedef struct { |
| OPNSLOT slot[4]; | OPNSLOT slot[4]; |
| BYTE algorithm; // algorithm | UINT8 algorithm; // algorithm |
| BYTE feedback; // self feedback | UINT8 feedback; // self feedback |
| BYTE padding1[2]; | UINT8 playing; |
| UINT8 outslot; | |
| SINT32 op1fb; // operator1 feedback | SINT32 op1fb; // operator1 feedback |
| SINT32 *connect1; // operator1 connect | SINT32 *connect1; // operator1 connect |
| SINT32 *connect3; // operator3 connect | SINT32 *connect3; // operator3 connect |
| Line 105 typedef struct { | Line 126 typedef struct { |
| SINT32 *connect4; // operator4 connect | SINT32 *connect4; // operator4 connect |
| UINT32 keynote[4]; // key note // ver0.27 | UINT32 keynote[4]; // key note // ver0.27 |
| BYTE keyfunc[4]; // key function | UINT8 keyfunc[4]; // key function |
| BYTE kcode[4]; // key code | UINT8 kcode[4]; // key code |
| BYTE pan; // pan | UINT8 pan; // pan |
| BYTE extop; // extendopelator-enable | UINT8 extop; // extendopelator-enable |
| BYTE stereo; // stereo-enable | UINT8 stereo; // stereo-enable |
| BYTE padding2; | UINT8 padding2; |
| } OPNCH; | } OPNCH; |
| typedef struct { | typedef struct { |
| UINT playchannels; | UINT playchannels; |
| UINT playing; | |
| SINT32 feedback2; | SINT32 feedback2; |
| SINT32 feedback3; | SINT32 feedback3; |
| SINT32 feedback4; | SINT32 feedback4; |
| Line 122 typedef struct { | Line 144 typedef struct { |
| SINT32 outdc; | SINT32 outdc; |
| SINT32 outdr; | SINT32 outdr; |
| SINT32 calcremain; | SINT32 calcremain; |
| BYTE keyreg[OPNCH_MAX]; | UINT8 keyreg[OPNCH_MAX]; |
| } _OPNGEN, *OPNGEN; | } _OPNGEN, *OPNGEN; |
| typedef struct { | typedef struct { |
| Line 132 typedef struct { | Line 154 typedef struct { |
| UINT vr_en; | UINT vr_en; |
| SINT32 vr_l; | SINT32 vr_l; |
| SINT32 vr_r; | SINT32 vr_r; |
| SINT32 sintable[SIN_ENT]; | |
| SINT32 envtable[EVC_ENT]; | |
| SINT32 envcurve[EVC_ENT*2 + 1]; | |
| } OPNCFG; | } OPNCFG; |
| Line 141 extern "C" { | Line 167 extern "C" { |
| void opngen_initialize(UINT rate); | void opngen_initialize(UINT rate); |
| void opngen_setvol(UINT vol); | void opngen_setvol(UINT vol); |
| void opngen_setVR(BYTE channel, BYTE value); | void opngen_setVR(REG8 channel, REG8 value); |
| void opngen_reset(void); | void opngen_reset(void); |
| void opngen_setcfg(BYTE maxch, UINT flag); | void opngen_setcfg(REG8 maxch, UINT32 flag); |
| void opngen_setextch(UINT chnum, BYTE data); | void opngen_setextch(UINT chnum, REG8 data); |
| void opngen_setreg(BYTE chbase, BYTE reg, BYTE value); | void opngen_setreg(REG8 chbase, UINT reg, REG8 value); |
| void opngen_keyon(UINT chnum, BYTE value); | void opngen_keyon(UINT chnum, REG8 value); |
| void SOUNDCALL opngen_getpcm(void *hdl, SINT32 *buf, UINT count); | void SOUNDCALL opngen_getpcm(void *hdl, SINT32 *buf, UINT count); |
| void SOUNDCALL opngen_getpcmvr(void *hdl, SINT32 *buf, UINT count); | void SOUNDCALL opngen_getpcmvr(void *hdl, SINT32 *buf, UINT count); |