Renamed Synth methods/fields

This commit is contained in:
Pazaz 2022-06-27 15:27:37 -04:00
parent 5aaf6a9ad0
commit cd68c3d0f9
4 changed files with 247 additions and 247 deletions

View file

@ -9,88 +9,88 @@ import org.openrs2.deob.annotation.Pc;
public final class SynthEnvelope {
@OriginalMember(owner = "client!ff", name = "b", descriptor = "I")
public int anInt1958;
public int wavetable;
@OriginalMember(owner = "client!ff", name = "d", descriptor = "I")
public int anInt1959;
public int minInterval;
@OriginalMember(owner = "client!ff", name = "f", descriptor = "I")
public int anInt1960;
public int maxInterval;
@OriginalMember(owner = "client!ff", name = "g", descriptor = "I")
private int anInt1961;
private int phase;
@OriginalMember(owner = "client!ff", name = "h", descriptor = "I")
private int anInt1962;
private int level;
@OriginalMember(owner = "client!ff", name = "i", descriptor = "I")
private int anInt1963;
private int slope;
@OriginalMember(owner = "client!ff", name = "j", descriptor = "I")
private int anInt1964;
private int nextTime;
@OriginalMember(owner = "client!ff", name = "k", descriptor = "I")
private int anInt1965;
private int time;
@OriginalMember(owner = "client!ff", name = "a", descriptor = "I")
private int anInt1957 = 2;
private int stages = 2;
@OriginalMember(owner = "client!ff", name = "e", descriptor = "[I")
private int[] anIntArray157 = new int[2];
private int[] times = new int[2];
@OriginalMember(owner = "client!ff", name = "c", descriptor = "[I")
private int[] anIntArray156 = new int[2];
private int[] levels = new int[2];
@OriginalMember(owner = "client!ff", name = "<init>", descriptor = "()V")
public SynthEnvelope() {
this.anIntArray157[0] = 0;
this.anIntArray157[1] = 65535;
this.anIntArray156[0] = 0;
this.anIntArray156[1] = 65535;
this.times[0] = 0;
this.times[1] = 65535;
this.levels[0] = 0;
this.levels[1] = 65535;
}
@OriginalMember(owner = "client!ff", name = "a", descriptor = "(I)I")
public final int method1512(@OriginalArg(0) int arg0) {
if (this.anInt1965 >= this.anInt1964) {
this.anInt1962 = this.anIntArray156[this.anInt1961++] << 15;
if (this.anInt1961 >= this.anInt1957) {
this.anInt1961 = this.anInt1957 - 1;
public final int nextLevel(@OriginalArg(0) int arg0) {
if (this.time >= this.nextTime) {
this.level = this.levels[this.phase++] << 15;
if (this.phase >= this.stages) {
this.phase = this.stages - 1;
}
this.anInt1964 = (int) ((double) this.anIntArray157[this.anInt1961] / 65536.0D * (double) arg0);
if (this.anInt1964 > this.anInt1965) {
this.anInt1963 = ((this.anIntArray156[this.anInt1961] << 15) - this.anInt1962) / (this.anInt1964 - this.anInt1965);
this.nextTime = (int) ((double) this.times[this.phase] / 65536.0D * (double) arg0);
if (this.nextTime > this.time) {
this.slope = ((this.levels[this.phase] << 15) - this.level) / (this.nextTime - this.time);
}
}
this.anInt1962 += this.anInt1963;
this.anInt1965++;
return this.anInt1962 - this.anInt1963 >> 15;
this.level += this.slope;
this.time++;
return this.level - this.slope >> 15;
}
@OriginalMember(owner = "client!ff", name = "a", descriptor = "()V")
public final void method1513() {
this.anInt1964 = 0;
this.anInt1961 = 0;
this.anInt1963 = 0;
this.anInt1962 = 0;
this.anInt1965 = 0;
public final void reset() {
this.nextTime = 0;
this.phase = 0;
this.slope = 0;
this.level = 0;
this.time = 0;
}
@OriginalMember(owner = "client!ff", name = "a", descriptor = "(Lclient!wa;)V")
public final void method1514(@OriginalArg(0) Buffer arg0) {
this.anInt1957 = arg0.g1();
this.anIntArray157 = new int[this.anInt1957];
this.anIntArray156 = new int[this.anInt1957];
for (@Pc(16) int local16 = 0; local16 < this.anInt1957; local16++) {
this.anIntArray157[local16] = arg0.g2();
this.anIntArray156[local16] = arg0.g2();
public final void decodeStages(@OriginalArg(0) Buffer arg0) {
this.stages = arg0.g1();
this.times = new int[this.stages];
this.levels = new int[this.stages];
for (@Pc(16) int local16 = 0; local16 < this.stages; local16++) {
this.times[local16] = arg0.g2();
this.levels[local16] = arg0.g2();
}
}
@OriginalMember(owner = "client!ff", name = "b", descriptor = "(Lclient!wa;)V")
public final void method1515(@OriginalArg(0) Buffer arg0) {
this.anInt1958 = arg0.g1();
this.anInt1959 = arg0.g4();
this.anInt1960 = arg0.g4();
this.method1514(arg0);
public final void decode(@OriginalArg(0) Buffer arg0) {
this.wavetable = arg0.g1();
this.minInterval = arg0.g4();
this.maxInterval = arg0.g4();
this.decodeStages(arg0);
}
}

View file

@ -9,117 +9,117 @@ import org.openrs2.deob.annotation.Pc;
public final class SynthFilter {
@OriginalMember(owner = "client!nl", name = "f", descriptor = "[[I")
public static final int[][] anIntArrayArray32 = new int[2][8];
public static final int[][] coefficients = new int[2][8];
@OriginalMember(owner = "client!nl", name = "b", descriptor = "[[F")
public static final float[][] aFloatArrayArray2 = new float[2][8];
public static final float[][] floatingCoefficients = new float[2][8];
@OriginalMember(owner = "client!nl", name = "d", descriptor = "F")
public static float aFloat22;
public static float floatingInverseA0;
@OriginalMember(owner = "client!nl", name = "g", descriptor = "I")
public static int anInt4191;
public static int inverseA0;
@OriginalMember(owner = "client!nl", name = "e", descriptor = "[I")
public final int[] anIntArray368 = new int[2];
public final int[] pairs = new int[2];
@OriginalMember(owner = "client!nl", name = "c", descriptor = "[[[I")
private final int[][][] anIntArrayArrayArray15 = new int[2][2][4];
private final int[][][] gain = new int[2][2][4];
@OriginalMember(owner = "client!nl", name = "a", descriptor = "[[[I")
private final int[][][] anIntArrayArrayArray14 = new int[2][2][4];
private final int[][][] octaves = new int[2][2][4];
@OriginalMember(owner = "client!nl", name = "h", descriptor = "[I")
private final int[] anIntArray369 = new int[2];
private final int[] inverseGain = new int[2];
@OriginalMember(owner = "client!nl", name = "a", descriptor = "(F)F")
public static float method3250(@OriginalArg(0) float arg0) {
public static float getOctavePhase(@OriginalArg(0) float arg0) {
@Pc(7) float local7 = (float) Math.pow(2.0D, (double) arg0) * 32.703197F;
return local7 * 3.1415927F / 11025.0F;
}
@OriginalMember(owner = "client!nl", name = "a", descriptor = "(Lclient!wa;Lclient!ff;)V")
public final void method3249(@OriginalArg(0) Buffer arg0, @OriginalArg(1) SynthEnvelope arg1) {
public final void decode(@OriginalArg(0) Buffer arg0, @OriginalArg(1) SynthEnvelope arg1) {
@Pc(3) int local3 = arg0.g1();
this.anIntArray368[0] = local3 >> 4;
this.anIntArray368[1] = local3 & 0xF;
this.pairs[0] = local3 >> 4;
this.pairs[1] = local3 & 0xF;
if (local3 == 0) {
this.anIntArray369[0] = this.anIntArray369[1] = 0;
this.inverseGain[0] = this.inverseGain[1] = 0;
return;
}
this.anIntArray369[0] = arg0.g2();
this.anIntArray369[1] = arg0.g2();
this.inverseGain[0] = arg0.g2();
this.inverseGain[1] = arg0.g2();
@Pc(37) int local37 = arg0.g1();
@Pc(39) int local39;
@Pc(44) int local44;
for (local39 = 0; local39 < 2; local39++) {
for (local44 = 0; local44 < this.anIntArray368[local39]; local44++) {
this.anIntArrayArrayArray14[local39][0][local44] = arg0.g2();
this.anIntArrayArrayArray15[local39][0][local44] = arg0.g2();
for (local44 = 0; local44 < this.pairs[local39]; local44++) {
this.octaves[local39][0][local44] = arg0.g2();
this.gain[local39][0][local44] = arg0.g2();
}
}
for (local39 = 0; local39 < 2; local39++) {
for (local44 = 0; local44 < this.anIntArray368[local39]; local44++) {
for (local44 = 0; local44 < this.pairs[local39]; local44++) {
if ((local37 & 0x1 << local39 * 4 << local44) == 0) {
this.anIntArrayArrayArray14[local39][1][local44] = this.anIntArrayArrayArray14[local39][0][local44];
this.anIntArrayArrayArray15[local39][1][local44] = this.anIntArrayArrayArray15[local39][0][local44];
this.octaves[local39][1][local44] = this.octaves[local39][0][local44];
this.gain[local39][1][local44] = this.gain[local39][0][local44];
} else {
this.anIntArrayArrayArray14[local39][1][local44] = arg0.g2();
this.anIntArrayArrayArray15[local39][1][local44] = arg0.g2();
this.octaves[local39][1][local44] = arg0.g2();
this.gain[local39][1][local44] = arg0.g2();
}
}
}
if (local37 != 0 || this.anIntArray369[1] != this.anIntArray369[0]) {
arg1.method1514(arg0);
if (local37 != 0 || this.inverseGain[1] != this.inverseGain[0]) {
arg1.decodeStages(arg0);
}
}
@OriginalMember(owner = "client!nl", name = "a", descriptor = "(IF)I")
public final int method3251(@OriginalArg(0) int arg0, @OriginalArg(1) float arg1) {
public final int compute(@OriginalArg(0) int arg0, @OriginalArg(1) float arg1) {
@Pc(20) float local20;
if (arg0 == 0) {
local20 = (float) this.anIntArray369[0] + (float) (this.anIntArray369[1] - this.anIntArray369[0]) * arg1;
local20 = (float) this.inverseGain[0] + (float) (this.inverseGain[1] - this.inverseGain[0]) * arg1;
@Pc(24) float local24 = local20 * 0.0030517578F;
aFloat22 = (float) Math.pow(0.1D, (double) (local24 / 20.0F));
anInt4191 = (int) (aFloat22 * 65536.0F);
floatingInverseA0 = (float) Math.pow(0.1D, (double) (local24 / 20.0F));
inverseA0 = (int) (floatingInverseA0 * 65536.0F);
}
if (this.anIntArray368[arg0] == 0) {
if (this.pairs[arg0] == 0) {
return 0;
}
local20 = this.method3253(arg0, 0, arg1);
aFloatArrayArray2[arg0][0] = -2.0F * local20 * (float) Math.cos((double) this.method3254(arg0, 0, arg1));
aFloatArrayArray2[arg0][1] = local20 * local20;
local20 = this.getAmplitude(arg0, 0, arg1);
floatingCoefficients[arg0][0] = -2.0F * local20 * (float) Math.cos((double) this.method3254(arg0, 0, arg1));
floatingCoefficients[arg0][1] = local20 * local20;
@Pc(77) int local77;
for (local77 = 1; local77 < this.anIntArray368[arg0]; local77++) {
local20 = this.method3253(arg0, local77, arg1);
for (local77 = 1; local77 < this.pairs[arg0]; local77++) {
local20 = this.getAmplitude(arg0, local77, arg1);
@Pc(102) float local102 = -2.0F * local20 * (float) Math.cos((double) this.method3254(arg0, local77, arg1));
@Pc(106) float local106 = local20 * local20;
aFloatArrayArray2[arg0][local77 * 2 + 1] = aFloatArrayArray2[arg0][local77 * 2 - 1] * local106;
aFloatArrayArray2[arg0][local77 * 2] = aFloatArrayArray2[arg0][local77 * 2 - 1] * local102 + aFloatArrayArray2[arg0][local77 * 2 - 2] * local106;
floatingCoefficients[arg0][local77 * 2 + 1] = floatingCoefficients[arg0][local77 * 2 - 1] * local106;
floatingCoefficients[arg0][local77 * 2] = floatingCoefficients[arg0][local77 * 2 - 1] * local102 + floatingCoefficients[arg0][local77 * 2 - 2] * local106;
for (@Pc(162) int local162 = local77 * 2 - 1; local162 >= 2; local162--) {
aFloatArrayArray2[arg0][local162] += aFloatArrayArray2[arg0][local162 - 1] * local102 + aFloatArrayArray2[arg0][local162 - 2] * local106;
floatingCoefficients[arg0][local162] += floatingCoefficients[arg0][local162 - 1] * local102 + floatingCoefficients[arg0][local162 - 2] * local106;
}
aFloatArrayArray2[arg0][1] += aFloatArrayArray2[arg0][0] * local102 + local106;
aFloatArrayArray2[arg0][0] += local102;
floatingCoefficients[arg0][1] += floatingCoefficients[arg0][0] * local102 + local106;
floatingCoefficients[arg0][0] += local102;
}
if (arg0 == 0) {
for (local77 = 0; local77 < this.anIntArray368[0] * 2; local77++) {
aFloatArrayArray2[0][local77] *= aFloat22;
for (local77 = 0; local77 < this.pairs[0] * 2; local77++) {
floatingCoefficients[0][local77] *= floatingInverseA0;
}
}
for (local77 = 0; local77 < this.anIntArray368[arg0] * 2; local77++) {
anIntArrayArray32[arg0][local77] = (int) (aFloatArrayArray2[arg0][local77] * 65536.0F);
for (local77 = 0; local77 < this.pairs[arg0] * 2; local77++) {
coefficients[arg0][local77] = (int) (floatingCoefficients[arg0][local77] * 65536.0F);
}
return this.anIntArray368[arg0] * 2;
return this.pairs[arg0] * 2;
}
@OriginalMember(owner = "client!nl", name = "a", descriptor = "(IIF)F")
private float method3253(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1, @OriginalArg(2) float arg2) {
@Pc(30) float local30 = (float) this.anIntArrayArrayArray15[arg0][0][arg1] + arg2 * (float) (this.anIntArrayArrayArray15[arg0][1][arg1] - this.anIntArrayArrayArray15[arg0][0][arg1]);
private float getAmplitude(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1, @OriginalArg(2) float arg2) {
@Pc(30) float local30 = (float) this.gain[arg0][0][arg1] + arg2 * (float) (this.gain[arg0][1][arg1] - this.gain[arg0][0][arg1]);
@Pc(34) float local34 = local30 * 0.0015258789F;
return 1.0F - (float) Math.pow(10.0D, (double) (-local34 / 20.0F));
}
@OriginalMember(owner = "client!nl", name = "b", descriptor = "(IIF)F")
private float method3254(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1, @OriginalArg(2) float arg2) {
@Pc(30) float local30 = (float) this.anIntArrayArrayArray14[arg0][0][arg1] + arg2 * (float) (this.anIntArrayArrayArray14[arg0][1][arg1] - this.anIntArrayArrayArray14[arg0][0][arg1]);
@Pc(30) float local30 = (float) this.octaves[arg0][0][arg1] + arg2 * (float) (this.octaves[arg0][1][arg1] - this.octaves[arg0][0][arg1]);
@Pc(34) float local34 = local30 * 1.2207031E-4F;
return method3250(local34);
return getOctavePhase(local34);
}
}

View file

@ -10,83 +10,83 @@ import org.openrs2.deob.annotation.Pc;
public final class SynthInstrument {
@OriginalMember(owner = "client!pj", name = "o", descriptor = "[I")
public static final int[] anIntArray398 = new int[220500];
public static final int[] samples = new int[220500];
@OriginalMember(owner = "client!pj", name = "p", descriptor = "[I")
public static final int[] anIntArray399 = new int[5];
public static final int[] oscillatorIntervalRanges = new int[5];
@OriginalMember(owner = "client!pj", name = "q", descriptor = "[I")
public static final int[] anIntArray400 = new int[5];
public static final int[] oscillatorMinIntervals = new int[5];
@OriginalMember(owner = "client!pj", name = "r", descriptor = "[I")
public static final int[] anIntArray401 = new int[5];
public static final int[] oscillatorTimes = new int[5];
@OriginalMember(owner = "client!pj", name = "s", descriptor = "[I")
public static final int[] anIntArray402 = new int[5];
public static final int[] oscillatorStartSamples = new int[5];
@OriginalMember(owner = "client!pj", name = "t", descriptor = "[I")
public static final int[] anIntArray403 = new int[5];
public static final int[] scaledOscillatorAmplitudes = new int[5];
@OriginalMember(owner = "client!pj", name = "k", descriptor = "[I")
private static final int[] anIntArray395 = new int[32768];
private static final int[] NOISE = new int[32768];
@OriginalMember(owner = "client!pj", name = "h", descriptor = "[I")
private static final int[] anIntArray394;
private static final int[] SINE;
@OriginalMember(owner = "client!pj", name = "a", descriptor = "Lclient!ff;")
private SynthEnvelope aClass42_1;
private SynthEnvelope amplitudeModulationAmplitudeEnvelope;
@OriginalMember(owner = "client!pj", name = "b", descriptor = "Lclient!ff;")
private SynthEnvelope aClass42_2;
private SynthEnvelope gateClosedPhaseEnvelope;
@OriginalMember(owner = "client!pj", name = "d", descriptor = "Lclient!ff;")
private SynthEnvelope aClass42_3;
private SynthEnvelope amplitudeEnvelope;
@OriginalMember(owner = "client!pj", name = "e", descriptor = "Lclient!ff;")
private SynthEnvelope aClass42_4;
private SynthEnvelope gateOpenPhaseEnvelope;
@OriginalMember(owner = "client!pj", name = "f", descriptor = "Lclient!ff;")
private SynthEnvelope aClass42_5;
private SynthEnvelope phaseEnvelope;
@OriginalMember(owner = "client!pj", name = "i", descriptor = "Lclient!ff;")
private SynthEnvelope aClass42_6;
private SynthEnvelope filterEnvelope;
@OriginalMember(owner = "client!pj", name = "l", descriptor = "Lclient!ff;")
private SynthEnvelope aClass42_7;
private SynthEnvelope amplitudeModulationEnvelope;
@OriginalMember(owner = "client!pj", name = "w", descriptor = "Lclient!nl;")
private SynthFilter aClass110_1;
private SynthFilter filter;
@OriginalMember(owner = "client!pj", name = "x", descriptor = "Lclient!ff;")
private SynthEnvelope aClass42_8;
private SynthEnvelope phaseModulationAmplitudeEnvelope;
@OriginalMember(owner = "client!pj", name = "y", descriptor = "Lclient!ff;")
private SynthEnvelope aClass42_9;
private SynthEnvelope phaseModulationEnvelope;
@OriginalMember(owner = "client!pj", name = "c", descriptor = "I")
public int anInt4546 = 500;
public int length = 500;
@OriginalMember(owner = "client!pj", name = "g", descriptor = "I")
private int anInt4547 = 0;
private int reverbDelay = 0;
@OriginalMember(owner = "client!pj", name = "j", descriptor = "I")
public int anInt4548 = 0;
public int start = 0;
@OriginalMember(owner = "client!pj", name = "m", descriptor = "[I")
private final int[] anIntArray396 = new int[] { 0, 0, 0, 0, 0 };
private final int[] harmonicVolume = new int[] { 0, 0, 0, 0, 0 };
@OriginalMember(owner = "client!pj", name = "n", descriptor = "[I")
private final int[] anIntArray397 = new int[] { 0, 0, 0, 0, 0 };
private final int[] harmonicDelay = new int[] { 0, 0, 0, 0, 0 };
@OriginalMember(owner = "client!pj", name = "u", descriptor = "I")
private int anInt4549 = 100;
private int reverbVolume = 100;
@OriginalMember(owner = "client!pj", name = "v", descriptor = "[I")
private final int[] anIntArray404 = new int[] { 0, 0, 0, 0, 0 };
private final int[] harmonicSemitone = new int[] { 0, 0, 0, 0, 0 };
static {
@Pc(7) Random local7 = new Random(0L);
@Pc(7) Random rand = new Random(0L);
@Pc(9) int local9;
for (local9 = 0; local9 < 32768; local9++) {
anIntArray395[local9] = (local7.nextInt() & 0x2) - 1;
NOISE[local9] = (rand.nextInt() & 0x2) - 1;
}
anIntArray394 = new int[32768];
SINE = new int[32768];
for (local9 = 0; local9 < 32768; local9++) {
anIntArray394[local9] = (int) (Math.sin((double) local9 / 5215.1903D) * 16384.0D);
SINE[local9] = (int) (Math.sin((double) local9 / 5215.1903D) * 16384.0D);
}
}
@ -95,51 +95,51 @@ public final class SynthInstrument {
if (arg2 == 1) {
return (arg0 & 0x7FFF) < 16384 ? arg1 : -arg1;
} else if (arg2 == 2) {
return anIntArray394[arg0 & 0x7FFF] * arg1 >> 14;
return SINE[arg0 & 0x7FFF] * arg1 >> 14;
} else if (arg2 == 3) {
return ((arg0 & 0x7FFF) * arg1 >> 14) - arg1;
} else if (arg2 == 4) {
return anIntArray395[arg0 / 2607 & 0x7FFF] * arg1;
return NOISE[arg0 / 2607 & 0x7FFF] * arg1;
} else {
return 0;
}
}
@OriginalMember(owner = "client!pj", name = "a", descriptor = "(II)[I")
public final int[] method3505(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1) {
ArrayUtils.clear(anIntArray398, 0, arg0);
public final int[] getSamples(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1) {
ArrayUtils.clear(samples, 0, arg0);
if (arg1 < 10) {
return anIntArray398;
return samples;
}
@Pc(16) double local16 = (double) arg0 / ((double) arg1 + 0.0D);
this.aClass42_5.method1513();
this.aClass42_3.method1513();
this.phaseEnvelope.reset();
this.amplitudeEnvelope.reset();
@Pc(24) int local24 = 0;
@Pc(26) int local26 = 0;
@Pc(28) int local28 = 0;
if (this.aClass42_9 != null) {
this.aClass42_9.method1513();
this.aClass42_8.method1513();
local24 = (int) ((double) (this.aClass42_9.anInt1960 - this.aClass42_9.anInt1959) * 32.768D / local16);
local26 = (int) ((double) this.aClass42_9.anInt1959 * 32.768D / local16);
if (this.phaseModulationEnvelope != null) {
this.phaseModulationEnvelope.reset();
this.phaseModulationAmplitudeEnvelope.reset();
local24 = (int) ((double) (this.phaseModulationEnvelope.maxInterval - this.phaseModulationEnvelope.minInterval) * 32.768D / local16);
local26 = (int) ((double) this.phaseModulationEnvelope.minInterval * 32.768D / local16);
}
@Pc(63) int local63 = 0;
@Pc(65) int local65 = 0;
@Pc(67) int local67 = 0;
if (this.aClass42_7 != null) {
this.aClass42_7.method1513();
this.aClass42_1.method1513();
local63 = (int) ((double) (this.aClass42_7.anInt1960 - this.aClass42_7.anInt1959) * 32.768D / local16);
local65 = (int) ((double) this.aClass42_7.anInt1959 * 32.768D / local16);
if (this.amplitudeModulationEnvelope != null) {
this.amplitudeModulationEnvelope.reset();
this.amplitudeModulationAmplitudeEnvelope.reset();
local63 = (int) ((double) (this.amplitudeModulationEnvelope.maxInterval - this.amplitudeModulationEnvelope.minInterval) * 32.768D / local16);
local65 = (int) ((double) this.amplitudeModulationEnvelope.minInterval * 32.768D / local16);
}
@Pc(102) int local102;
for (local102 = 0; local102 < 5; local102++) {
if (this.anIntArray396[local102] != 0) {
anIntArray401[local102] = 0;
anIntArray402[local102] = (int) ((double) this.anIntArray397[local102] * local16);
anIntArray403[local102] = (this.anIntArray396[local102] << 14) / 100;
anIntArray399[local102] = (int) ((double) (this.aClass42_5.anInt1960 - this.aClass42_5.anInt1959) * 32.768D * Math.pow(1.0057929410678534D, (double) this.anIntArray404[local102]) / local16);
anIntArray400[local102] = (int) ((double) this.aClass42_5.anInt1959 * 32.768D / local16);
if (this.harmonicVolume[local102] != 0) {
oscillatorTimes[local102] = 0;
oscillatorStartSamples[local102] = (int) ((double) this.harmonicDelay[local102] * local16);
scaledOscillatorAmplitudes[local102] = (this.harmonicVolume[local102] << 14) / 100;
oscillatorIntervalRanges[local102] = (int) ((double) (this.phaseEnvelope.maxInterval - this.phaseEnvelope.minInterval) * 32.768D * Math.pow(1.0057929410678534D, (double) this.harmonicSemitone[local102]) / local16);
oscillatorMinIntervals[local102] = (int) ((double) this.phaseEnvelope.minInterval * 32.768D / local16);
}
}
@Pc(185) int local185;
@ -147,43 +147,43 @@ public final class SynthInstrument {
@Pc(198) int local198;
@Pc(203) int local203;
for (local102 = 0; local102 < arg0; local102++) {
local185 = this.aClass42_5.method1512(arg0);
local190 = this.aClass42_3.method1512(arg0);
if (this.aClass42_9 != null) {
local198 = this.aClass42_9.method1512(arg0);
local203 = this.aClass42_8.method1512(arg0);
local185 += this.method3504(local28, local203, this.aClass42_9.anInt1958) >> 1;
local185 = this.phaseEnvelope.nextLevel(arg0);
local190 = this.amplitudeEnvelope.nextLevel(arg0);
if (this.phaseModulationEnvelope != null) {
local198 = this.phaseModulationEnvelope.nextLevel(arg0);
local203 = this.phaseModulationAmplitudeEnvelope.nextLevel(arg0);
local185 += this.method3504(local28, local203, this.phaseModulationEnvelope.wavetable) >> 1;
local28 += (local198 * local24 >> 16) + local26;
}
if (this.aClass42_7 != null) {
local198 = this.aClass42_7.method1512(arg0);
local203 = this.aClass42_1.method1512(arg0);
local190 = local190 * ((this.method3504(local67, local203, this.aClass42_7.anInt1958) >> 1) + 32768) >> 15;
if (this.amplitudeModulationEnvelope != null) {
local198 = this.amplitudeModulationEnvelope.nextLevel(arg0);
local203 = this.amplitudeModulationAmplitudeEnvelope.nextLevel(arg0);
local190 = local190 * ((this.method3504(local67, local203, this.amplitudeModulationEnvelope.wavetable) >> 1) + 32768) >> 15;
local67 += (local198 * local63 >> 16) + local65;
}
for (local198 = 0; local198 < 5; local198++) {
if (this.anIntArray396[local198] != 0) {
local203 = local102 + anIntArray402[local198];
if (this.harmonicVolume[local198] != 0) {
local203 = local102 + oscillatorStartSamples[local198];
if (local203 < arg0) {
anIntArray398[local203] += this.method3504(anIntArray401[local198], local190 * anIntArray403[local198] >> 15, this.aClass42_5.anInt1958);
anIntArray401[local198] += (local185 * anIntArray399[local198] >> 16) + anIntArray400[local198];
samples[local203] += this.method3504(oscillatorTimes[local198], local190 * scaledOscillatorAmplitudes[local198] >> 15, this.phaseEnvelope.wavetable);
oscillatorTimes[local198] += (local185 * oscillatorIntervalRanges[local198] >> 16) + oscillatorMinIntervals[local198];
}
}
}
}
@Pc(356) int local356;
if (this.aClass42_2 != null) {
this.aClass42_2.method1513();
this.aClass42_4.method1513();
if (this.gateClosedPhaseEnvelope != null) {
this.gateClosedPhaseEnvelope.reset();
this.gateOpenPhaseEnvelope.reset();
local102 = 0;
@Pc(341) boolean local341 = true;
for (local198 = 0; local198 < arg0; local198++) {
local203 = this.aClass42_2.method1512(arg0);
local356 = this.aClass42_4.method1512(arg0);
local203 = this.gateClosedPhaseEnvelope.nextLevel(arg0);
local356 = this.gateOpenPhaseEnvelope.nextLevel(arg0);
if (local341) {
local185 = this.aClass42_2.anInt1959 + ((this.aClass42_2.anInt1960 - this.aClass42_2.anInt1959) * local203 >> 8);
local185 = this.gateClosedPhaseEnvelope.minInterval + ((this.gateClosedPhaseEnvelope.maxInterval - this.gateClosedPhaseEnvelope.minInterval) * local203 >> 8);
} else {
local185 = this.aClass42_2.anInt1959 + ((this.aClass42_2.anInt1960 - this.aClass42_2.anInt1959) * local356 >> 8);
local185 = this.gateClosedPhaseEnvelope.minInterval + ((this.gateClosedPhaseEnvelope.maxInterval - this.gateClosedPhaseEnvelope.minInterval) * local356 >> 8);
}
local102 += 256;
if (local102 >= local185) {
@ -191,21 +191,21 @@ public final class SynthInstrument {
local341 = !local341;
}
if (local341) {
anIntArray398[local198] = 0;
samples[local198] = 0;
}
}
}
if (this.anInt4547 > 0 && this.anInt4549 > 0) {
local102 = (int) ((double) this.anInt4547 * local16);
if (this.reverbDelay > 0 && this.reverbVolume > 0) {
local102 = (int) ((double) this.reverbDelay * local16);
for (local185 = local102; local185 < arg0; local185++) {
anIntArray398[local185] += anIntArray398[local185 - local102] * this.anInt4549 / 100;
samples[local185] += samples[local185 - local102] * this.reverbVolume / 100;
}
}
if (this.aClass110_1.anIntArray368[0] > 0 || this.aClass110_1.anIntArray368[1] > 0) {
this.aClass42_6.method1513();
local102 = this.aClass42_6.method1512(arg0 + 1);
local185 = this.aClass110_1.method3251(0, (float) local102 / 65536.0F);
local190 = this.aClass110_1.method3251(1, (float) local102 / 65536.0F);
if (this.filter.pairs[0] > 0 || this.filter.pairs[1] > 0) {
this.filterEnvelope.reset();
local102 = this.filterEnvelope.nextLevel(arg0 + 1);
local185 = this.filter.compute(0, (float) local102 / 65536.0F);
local190 = this.filter.compute(1, (float) local102 / 65536.0F);
if (arg0 >= local185 + local190) {
local198 = 0;
local203 = local190;
@ -214,15 +214,15 @@ public final class SynthInstrument {
}
@Pc(523) int local523;
while (local198 < local203) {
local356 = (int) ((long) anIntArray398[local198 + local185] * (long) SynthFilter.anInt4191 >> 16);
local356 = (int) ((long) samples[local198 + local185] * (long) SynthFilter.inverseA0 >> 16);
for (local523 = 0; local523 < local185; local523++) {
local356 += (int) ((long) anIntArray398[local198 + local185 - local523 - 1] * (long) SynthFilter.anIntArrayArray32[0][local523] >> 16);
local356 += (int) ((long) samples[local198 + local185 - local523 - 1] * (long) SynthFilter.coefficients[0][local523] >> 16);
}
for (local523 = 0; local523 < local198; local523++) {
local356 -= (int) ((long) anIntArray398[local198 - local523 - 1] * (long) SynthFilter.anIntArrayArray32[1][local523] >> 16);
local356 -= (int) ((long) samples[local198 - local523 - 1] * (long) SynthFilter.coefficients[1][local523] >> 16);
}
anIntArray398[local198] = local356;
local102 = this.aClass42_6.method1512(arg0 + 1);
samples[local198] = local356;
local102 = this.filterEnvelope.nextLevel(arg0 + 1);
local198++;
}
local203 = 128;
@ -231,94 +231,94 @@ public final class SynthInstrument {
local203 = arg0 - local185;
}
while (local198 < local203) {
local356 = (int) ((long) anIntArray398[local198 + local185] * (long) SynthFilter.anInt4191 >> 16);
local356 = (int) ((long) samples[local198 + local185] * (long) SynthFilter.inverseA0 >> 16);
for (local523 = 0; local523 < local185; local523++) {
local356 += (int) ((long) anIntArray398[local198 + local185 - local523 - 1] * (long) SynthFilter.anIntArrayArray32[0][local523] >> 16);
local356 += (int) ((long) samples[local198 + local185 - local523 - 1] * (long) SynthFilter.coefficients[0][local523] >> 16);
}
for (local523 = 0; local523 < local190; local523++) {
local356 -= (int) ((long) anIntArray398[local198 - local523 - 1] * (long) SynthFilter.anIntArrayArray32[1][local523] >> 16);
local356 -= (int) ((long) samples[local198 - local523 - 1] * (long) SynthFilter.coefficients[1][local523] >> 16);
}
anIntArray398[local198] = local356;
local102 = this.aClass42_6.method1512(arg0 + 1);
samples[local198] = local356;
local102 = this.filterEnvelope.nextLevel(arg0 + 1);
local198++;
}
if (local198 >= arg0 - local185) {
while (local198 < arg0) {
local356 = 0;
for (local523 = local198 + local185 - arg0; local523 < local185; local523++) {
local356 += (int) ((long) anIntArray398[local198 + local185 - local523 - 1] * (long) SynthFilter.anIntArrayArray32[0][local523] >> 16);
local356 += (int) ((long) samples[local198 + local185 - local523 - 1] * (long) SynthFilter.coefficients[0][local523] >> 16);
}
for (local523 = 0; local523 < local190; local523++) {
local356 -= (int) ((long) anIntArray398[local198 - local523 - 1] * (long) SynthFilter.anIntArrayArray32[1][local523] >> 16);
local356 -= (int) ((long) samples[local198 - local523 - 1] * (long) SynthFilter.coefficients[1][local523] >> 16);
}
anIntArray398[local198] = local356;
this.aClass42_6.method1512(arg0 + 1);
samples[local198] = local356;
this.filterEnvelope.nextLevel(arg0 + 1);
local198++;
}
break;
}
local185 = this.aClass110_1.method3251(0, (float) local102 / 65536.0F);
local190 = this.aClass110_1.method3251(1, (float) local102 / 65536.0F);
local185 = this.filter.compute(0, (float) local102 / 65536.0F);
local190 = this.filter.compute(1, (float) local102 / 65536.0F);
local203 += 128;
}
}
}
for (local102 = 0; local102 < arg0; local102++) {
if (anIntArray398[local102] < -32768) {
anIntArray398[local102] = -32768;
if (samples[local102] < -32768) {
samples[local102] = -32768;
}
if (anIntArray398[local102] > 32767) {
anIntArray398[local102] = 32767;
if (samples[local102] > 32767) {
samples[local102] = 32767;
}
}
return anIntArray398;
return samples;
}
@OriginalMember(owner = "client!pj", name = "a", descriptor = "(Lclient!wa;)V")
public final void method3506(@OriginalArg(0) Buffer arg0) {
this.aClass42_5 = new SynthEnvelope();
this.aClass42_5.method1515(arg0);
this.aClass42_3 = new SynthEnvelope();
this.aClass42_3.method1515(arg0);
this.phaseEnvelope = new SynthEnvelope();
this.phaseEnvelope.decode(arg0);
this.amplitudeEnvelope = new SynthEnvelope();
this.amplitudeEnvelope.decode(arg0);
@Pc(21) int local21 = arg0.g1();
if (local21 != 0) {
arg0.offset--;
this.aClass42_9 = new SynthEnvelope();
this.aClass42_9.method1515(arg0);
this.aClass42_8 = new SynthEnvelope();
this.aClass42_8.method1515(arg0);
this.phaseModulationEnvelope = new SynthEnvelope();
this.phaseModulationEnvelope.decode(arg0);
this.phaseModulationAmplitudeEnvelope = new SynthEnvelope();
this.phaseModulationAmplitudeEnvelope.decode(arg0);
}
local21 = arg0.g1();
if (local21 != 0) {
arg0.offset--;
this.aClass42_7 = new SynthEnvelope();
this.aClass42_7.method1515(arg0);
this.aClass42_1 = new SynthEnvelope();
this.aClass42_1.method1515(arg0);
this.amplitudeModulationEnvelope = new SynthEnvelope();
this.amplitudeModulationEnvelope.decode(arg0);
this.amplitudeModulationAmplitudeEnvelope = new SynthEnvelope();
this.amplitudeModulationAmplitudeEnvelope.decode(arg0);
}
local21 = arg0.g1();
if (local21 != 0) {
arg0.offset--;
this.aClass42_2 = new SynthEnvelope();
this.aClass42_2.method1515(arg0);
this.aClass42_4 = new SynthEnvelope();
this.aClass42_4.method1515(arg0);
this.gateClosedPhaseEnvelope = new SynthEnvelope();
this.gateClosedPhaseEnvelope.decode(arg0);
this.gateOpenPhaseEnvelope = new SynthEnvelope();
this.gateOpenPhaseEnvelope.decode(arg0);
}
for (@Pc(109) int local109 = 0; local109 < 10; local109++) {
@Pc(116) int local116 = arg0.gsmarts();
if (local116 == 0) {
break;
}
this.anIntArray396[local109] = local116;
this.anIntArray404[local109] = arg0.gsmart();
this.anIntArray397[local109] = arg0.gsmarts();
this.harmonicVolume[local109] = local116;
this.harmonicSemitone[local109] = arg0.gsmart();
this.harmonicDelay[local109] = arg0.gsmarts();
}
this.anInt4547 = arg0.gsmarts();
this.anInt4549 = arg0.gsmarts();
this.anInt4546 = arg0.g2();
this.anInt4548 = arg0.g2();
this.aClass110_1 = new SynthFilter();
this.aClass42_6 = new SynthEnvelope();
this.aClass110_1.method3249(arg0, this.aClass42_6);
this.reverbDelay = arg0.gsmarts();
this.reverbVolume = arg0.gsmarts();
this.length = arg0.g2();
this.start = arg0.g2();
this.filter = new SynthFilter();
this.filterEnvelope = new SynthEnvelope();
this.filter.decode(arg0, this.filterEnvelope);
}
}

View file

@ -9,13 +9,13 @@ import org.openrs2.deob.annotation.Pc;
public final class SynthSound {
@OriginalMember(owner = "client!sl", name = "b", descriptor = "[Lclient!pj;")
private final SynthInstrument[] aClass123Array1 = new SynthInstrument[10];
private final SynthInstrument[] instruments = new SynthInstrument[10];
@OriginalMember(owner = "client!sl", name = "c", descriptor = "I")
private int anInt5207;
private int start;
@OriginalMember(owner = "client!sl", name = "a", descriptor = "I")
private int anInt5206;
private int end;
@OriginalMember(owner = "client!sl", name = "<init>", descriptor = "(Lclient!wa;)V")
public SynthSound(@OriginalArg(0) Buffer arg0) {
@ -23,12 +23,12 @@ public final class SynthSound {
@Pc(14) int local14 = arg0.g1();
if (local14 != 0) {
arg0.offset--;
this.aClass123Array1[local7] = new SynthInstrument();
this.aClass123Array1[local7].method3506(arg0);
this.instruments[local7] = new SynthInstrument();
this.instruments[local7].method3506(arg0);
}
}
this.anInt5207 = arg0.g2();
this.anInt5206 = arg0.g2();
this.start = arg0.g2();
this.end = arg0.g2();
}
@OriginalMember(owner = "client!sl", name = "a", descriptor = "(Lclient!ve;II)Lclient!sl;")
@ -38,12 +38,12 @@ public final class SynthSound {
}
@OriginalMember(owner = "client!sl", name = "a", descriptor = "()[B")
private byte[] method3987() {
private byte[] getSamples() {
@Pc(1) int local1 = 0;
@Pc(3) int local3;
for (local3 = 0; local3 < 10; local3++) {
if (this.aClass123Array1[local3] != null && this.aClass123Array1[local3].anInt4546 + this.aClass123Array1[local3].anInt4548 > local1) {
local1 = this.aClass123Array1[local3].anInt4546 + this.aClass123Array1[local3].anInt4548;
if (this.instruments[local3] != null && this.instruments[local3].length + this.instruments[local3].start > local1) {
local1 = this.instruments[local3].length + this.instruments[local3].start;
}
}
if (local1 == 0) {
@ -52,10 +52,10 @@ public final class SynthSound {
local3 = local1 * 22050 / 1000;
@Pc(52) byte[] local52 = new byte[local3];
for (@Pc(54) int local54 = 0; local54 < 10; local54++) {
if (this.aClass123Array1[local54] != null) {
@Pc(72) int local72 = this.aClass123Array1[local54].anInt4546 * 22050 / 1000;
@Pc(82) int local82 = this.aClass123Array1[local54].anInt4548 * 22050 / 1000;
@Pc(94) int[] local94 = this.aClass123Array1[local54].method3505(local72, this.aClass123Array1[local54].anInt4546);
if (this.instruments[local54] != null) {
@Pc(72) int local72 = this.instruments[local54].length * 22050 / 1000;
@Pc(82) int local82 = this.instruments[local54].start * 22050 / 1000;
@Pc(94) int[] local94 = this.instruments[local54].getSamples(local72, this.instruments[local54].length);
for (@Pc(96) int local96 = 0; local96 < local72; local96++) {
@Pc(111) int local111 = local52[local96 + local82] + (local94[local96] >> 8);
if ((local111 + 128 & 0xFFFFFF00) != 0) {
@ -70,8 +70,8 @@ public final class SynthSound {
@OriginalMember(owner = "client!sl", name = "b", descriptor = "()Lclient!kj;")
public final PcmSound toPcmSound() {
@Pc(2) byte[] local2 = this.method3987();
return new PcmSound(22050, local2, this.anInt5207 * 22050 / 1000, this.anInt5206 * 22050 / 1000);
@Pc(2) byte[] local2 = this.getSamples();
return new PcmSound(22050, local2, this.start * 22050 / 1000, this.end * 22050 / 1000);
}
@OriginalMember(owner = "client!sl", name = "c", descriptor = "()I")
@ -79,24 +79,24 @@ public final class SynthSound {
@Pc(1) int local1 = 9999999;
@Pc(3) int local3;
for (local3 = 0; local3 < 10; local3++) {
if (this.aClass123Array1[local3] != null && this.aClass123Array1[local3].anInt4548 / 20 < local1) {
local1 = this.aClass123Array1[local3].anInt4548 / 20;
if (this.instruments[local3] != null && this.instruments[local3].start / 20 < local1) {
local1 = this.instruments[local3].start / 20;
}
}
if (this.anInt5207 < this.anInt5206 && this.anInt5207 / 20 < local1) {
local1 = this.anInt5207 / 20;
if (this.start < this.end && this.start / 20 < local1) {
local1 = this.start / 20;
}
if (local1 == 9999999 || local1 == 0) {
return 0;
}
for (local3 = 0; local3 < 10; local3++) {
if (this.aClass123Array1[local3] != null) {
this.aClass123Array1[local3].anInt4548 -= local1 * 20;
if (this.instruments[local3] != null) {
this.instruments[local3].start -= local1 * 20;
}
}
if (this.anInt5207 < this.anInt5206) {
this.anInt5207 -= local1 * 20;
this.anInt5206 -= local1 * 20;
if (this.start < this.end) {
this.start -= local1 * 20;
this.end -= local1 * 20;
}
return local1;
}