|
|
| version 1.8, 2003/12/08 00:55:33 | version 1.10, 2004/07/26 18:52:55 |
|---|---|
| Line 52 static const int fmslot[4] = {0, 2, 1, 3 | Line 52 static const int fmslot[4] = {0, 2, 1, 3 |
| void opngen_initialize(UINT rate) { | void opngen_initialize(UINT rate) { |
| UINT ratebit; | |
| int i; | int i; |
| int j; | int j; |
| double pom; | double pom; |
| double freq; | double freq; |
| UINT32 calcrate; | UINT32 calcrate; |
| calcrate = rate * 55466 / 44100; | if (rate == 44100) { |
| ratebit = 0; | |
| opncfg.calc1024 = FMDIV_ENT * 44100 / 55466; | } |
| else if (rate == 22050) { | |
| ratebit = 1; | |
| } | |
| else { | |
| ratebit = 2; | |
| } | |
| calcrate = (OPNA_CLOCK / 72) >> ratebit; | |
| opncfg.calc1024 = FMDIV_ENT * 44100 / (OPNA_CLOCK / 72); | |
| for (i=0; i<EVC_ENT; i++) { | for (i=0; i<EVC_ENT; i++) { |
| #ifdef OPNGENX86 | #ifdef OPNGENX86 |
| Line 357 static void channleupdate(OPNCH *ch) { | Line 366 static void channleupdate(OPNCH *ch) { |
| int i; | int i; |
| UINT32 fc = ch->keynote[0]; // ver0.27 | UINT32 fc = ch->keynote[0]; // ver0.27 |
| BYTE kc = ch->kcode[0]; | UINT8 kc = ch->kcode[0]; |
| BYTE evr; | UINT evr; |
| OPNSLOT *slot; | OPNSLOT *slot; |
| int s; | int s; |
| Line 366 static void channleupdate(OPNCH *ch) { | Line 375 static void channleupdate(OPNCH *ch) { |
| if (!(ch->extop)) { | if (!(ch->extop)) { |
| for (i=0; i<4; i++, slot++) { | for (i=0; i<4; i++, slot++) { |
| slot->freq_inc = (fc + slot->detune1[kc]) * slot->multiple; | slot->freq_inc = (fc + slot->detune1[kc]) * slot->multiple; |
| evr = (BYTE)(kc >> slot->keyscale); | evr = kc >> slot->keyscale; |
| if (slot->envratio != evr) { | if (slot->envratio != evr) { |
| slot->envratio = evr; | slot->envratio = evr; |
| slot->env_inc_attack = slot->attack[evr]; | slot->env_inc_attack = slot->attack[evr]; |
| Line 381 static void channleupdate(OPNCH *ch) { | Line 390 static void channleupdate(OPNCH *ch) { |
| s = extendslot[i]; | s = extendslot[i]; |
| slot->freq_inc = (ch->keynote[s] + slot->detune1[ch->kcode[s]]) | slot->freq_inc = (ch->keynote[s] + slot->detune1[ch->kcode[s]]) |
| * slot->multiple; | * slot->multiple; |
| evr = (BYTE)(ch->kcode[s] >> slot->keyscale); | evr = ch->kcode[s] >> slot->keyscale; |
| if (slot->envratio != evr) { | if (slot->envratio != evr) { |
| slot->envratio = evr; | slot->envratio = evr; |
| slot->env_inc_attack = slot->attack[evr]; | slot->env_inc_attack = slot->attack[evr]; |
| Line 474 void opngen_setreg(REG8 chbase, REG8 reg | Line 483 void opngen_setreg(REG8 chbase, REG8 reg |
| OPNCH *ch; | OPNCH *ch; |
| OPNSLOT *slot; | OPNSLOT *slot; |
| UINT fn; | UINT fn; |
| BYTE blk; | UINT8 blk; |
| chpos = reg & 3; | chpos = reg & 3; |
| if (chpos == 3) { | if (chpos == 3) { |
| Line 549 void opngen_setreg(REG8 chbase, REG8 reg | Line 558 void opngen_setreg(REG8 chbase, REG8 reg |
| break; | break; |
| case 0xb0: | case 0xb0: |
| ch->algorithm = (BYTE)(value & 7); | ch->algorithm = (UINT8)(value & 7); |
| value = (value >> 3) & 7; | value = (value >> 3) & 7; |
| if (value) { | if (value) { |
| ch->feedback = 8 - value; | ch->feedback = 8 - value; |
| Line 561 void opngen_setreg(REG8 chbase, REG8 reg | Line 570 void opngen_setreg(REG8 chbase, REG8 reg |
| break; | break; |
| case 0xb4: | case 0xb4: |
| ch->pan = (BYTE)(value & 0xc0); | ch->pan = (UINT8)(value & 0xc0); |
| set_algorithm(ch); | set_algorithm(ch); |
| break; | break; |
| } | } |
| Line 609 void opngen_keyon(UINT chnum, REG8 value | Line 618 void opngen_keyon(UINT chnum, REG8 value |
| slot++; | slot++; |
| bit <<= 1; | bit <<= 1; |
| } | } |
| keydisp_fmkeyon((BYTE)chnum, value); | keydisp_fmkeyon((UINT8)chnum, value); |
| } | } |