1
0
Fork 0

opl types update 5 (fixed!)

This commit is contained in:
Sen 2025-08-25 14:58:40 +02:00
parent 54247c848b
commit b100930722
Signed by: sen
GPG key ID: 3AC50A6F47D1B722

View file

@ -25,8 +25,8 @@ public class OPLChip {
public ModGen mod;
public int fb;
public short prout;
public short eg_rout;
public short eg_out;
public int eg_rout;
public int eg_out;
public EnvState eg_gen;
public int eg_ksl;
public ModGen trem;
@ -90,15 +90,14 @@ public class OPLChip {
int reg_rate = 0;
int ks;
int eg_shift, shift;
short eg_rout;
short eg_inc;
int eg_rout;
int eg_inc;
boolean eg_off;
boolean reset = false;
if(this.retrigger) {
this.eg_rout = 0x1ff;
}
this.eg_out = (short)(this.eg_rout + (this.reg_tl << 2)
+ (this.eg_ksl >> KSL_SHIFT[this.reg_ksl]) + this.trem.getModulation());
this.eg_out = this.eg_rout + (this.reg_tl << 2) + (this.eg_ksl >> KSL_SHIFT[this.reg_ksl]) + this.trem.getModulation();
if (this.key && this.eg_gen == EnvState.RELEASE)
{
reset = true;
@ -198,7 +197,7 @@ public class OPLChip {
}
else if (this.key && shift > 0 && rate_hi != 0x0f)
{
eg_inc = (short)(~this.eg_rout >> (4 - shift));
eg_inc = ((~this.eg_rout) & 0xffff) >> (4 - shift);
}
break;
case DECAY:
@ -208,18 +207,18 @@ public class OPLChip {
}
else if (!eg_off && !reset && shift > 0)
{
eg_inc = (short)(1 << (shift - 1));
eg_inc = 1 << (shift - 1);
}
break;
case SUSTAIN:
case RELEASE:
if (!eg_off && !reset && shift > 0)
{
eg_inc = (short)(1 << (shift - 1));
eg_inc = 1 << (shift - 1);
}
break;
}
this.eg_rout = (short)((eg_rout + eg_inc) & 0x1ff);
this.eg_rout = (eg_rout + eg_inc) & 0x1ff;
/* Key off */
if (reset)
{