|
|
| version 1.9, 2004/02/03 08:24:40 | version 1.14, 2011/02/04 14:43:55 |
|---|---|
| Line 54 void opngen_initialize(UINT rate) { | Line 54 void opngen_initialize(UINT rate) { |
| UINT ratebit; | UINT ratebit; |
| int i; | int i; |
| char sft; | |
| int j; | int j; |
| double pom; | double pom; |
| long detune; | |
| double freq; | double freq; |
| UINT32 calcrate; | UINT32 calcrate; |
| Line 73 void opngen_initialize(UINT rate) { | Line 75 void opngen_initialize(UINT rate) { |
| for (i=0; i<EVC_ENT; i++) { | for (i=0; i<EVC_ENT; i++) { |
| #ifdef OPNGENX86 | #ifdef OPNGENX86 |
| char sft; | |
| sft = ENVTBL_BIT; | sft = ENVTBL_BIT; |
| while(sft < (ENVTBL_BIT + 8)) { | while(sft < (ENVTBL_BIT + 8)) { |
| pom = (double)(1 << sft) / pow(10.0, EG_STEP*(EVC_ENT-i)/20.0); | pom = (double)(1 << sft) / pow(10.0, EG_STEP*(EVC_ENT-i)/20.0); |
| Line 133 void opngen_initialize(UINT rate) { | Line 134 void opngen_initialize(UINT rate) { |
| for (i=0; i<4; i++) { | for (i=0; i<4; i++) { |
| for (j=0; j<32; j++) { | for (j=0; j<32; j++) { |
| #if (FREQ_BITS >= 21) | detune = dttable[i*32 + j]; |
| freq = FREQBASE4096 * dttable[i*32 + j] * | sft = ratebit + (FREQ_BITS - 21); |
| (1 << (FREQ_BITS-21)); | if (sft >= 0) { |
| #else | detune <<= sft; |
| freq = FREQBASE4096 * dttable[i*32 + j] / | } |
| (1 << (21-FREQ_BITS)); | else { |
| #endif | detune >>= (0 - sft); |
| detunetable[i][j] = (long)freq; | } |
| detunetable[i+4][j] = (long)-freq; | |
| detunetable[i][j] = detune; | |
| detunetable[i+4][j] = -detune; | |
| } | } |
| } | } |
| for (i=0; i<4; i++) { | for (i=0; i<4; i++) { |
| Line 164 void opngen_initialize(UINT rate) { | Line 167 void opngen_initialize(UINT rate) { |
| decaytable[i] = (long)(freq / OPM_DRRATE); | decaytable[i] = (long)(freq / OPM_DRRATE); |
| #endif | #endif |
| if (attacktable[i] >= EC_DECAY) { | if (attacktable[i] >= EC_DECAY) { |
| TRACEOUT(("attacktable %d %d %d", i, attacktable[i], EC_DECAY)); | TRACEOUT(("attacktable %d %d %ld", i, attacktable[i], EC_DECAY)); |
| } | } |
| if (decaytable[i] >= EC_DECAY) { | if (decaytable[i] >= EC_DECAY) { |
| TRACEOUT(("decaytable %d %d %d", i, decaytable[i], EC_DECAY)); | TRACEOUT(("decaytable %d %d %ld", i, decaytable[i], EC_DECAY)); |
| } | } |
| } | } |
| attacktable[62] = EC_DECAY - 1; | attacktable[62] = EC_DECAY - 1; |
| Line 366 static void channleupdate(OPNCH *ch) { | Line 369 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 375 static void channleupdate(OPNCH *ch) { | Line 378 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 390 static void channleupdate(OPNCH *ch) { | Line 393 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 435 void opngen_reset(void) { | Line 438 void opngen_reset(void) { |
| ch++; | ch++; |
| } | } |
| for (i=0x30; i<0xc0; i++) { | for (i=0x30; i<0xc0; i++) { |
| opngen_setreg(0, (REG8)i, 0xff); | opngen_setreg(0, i, 0xff); |
| opngen_setreg(3, (REG8)i, 0xff); | opngen_setreg(3, i, 0xff); |
| opngen_setreg(6, (REG8)i, 0xff); | opngen_setreg(6, i, 0xff); |
| opngen_setreg(9, (REG8)i, 0xff); | opngen_setreg(9, i, 0xff); |
| } | } |
| } | } |
| void opngen_setcfg(REG8 maxch, UINT flag) { | void opngen_setcfg(REG8 maxch, UINT32 flag) { |
| OPNCH *ch; | OPNCH *ch; |
| UINT i; | UINT i; |
| Line 477 void opngen_setextch(UINT chnum, REG8 da | Line 480 void opngen_setextch(UINT chnum, REG8 da |
| ch[chnum].extop = data; | ch[chnum].extop = data; |
| } | } |
| void opngen_setreg(REG8 chbase, REG8 reg, REG8 value) { | void opngen_setreg(REG8 chbase, UINT reg, REG8 value) { |
| UINT chpos; | UINT chpos; |
| 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 558 void opngen_setreg(REG8 chbase, REG8 reg | Line 561 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 570 void opngen_setreg(REG8 chbase, REG8 reg | Line 573 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 618 void opngen_keyon(UINT chnum, REG8 value | Line 621 void opngen_keyon(UINT chnum, REG8 value |
| slot++; | slot++; |
| bit <<= 1; | bit <<= 1; |
| } | } |
| keydisp_fmkeyon((BYTE)chnum, value); | keydisp_fmkeyon((UINT8)chnum, value); |
| } | } |