Skip to content

Commit

Permalink
Fix config
Browse files Browse the repository at this point in the history
  • Loading branch information
thedocruby committed Feb 25, 2022
1 parent 3a1d39e commit de06f45
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
12 changes: 6 additions & 6 deletions src/main/java/dev/thedocruby/resounding/ResoundingEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -644,11 +644,11 @@ private static double getBlockOcclusionD(final BlockState blockState) {
}

if (Math.max(traceDownRefl, traceUpRefl) == traceUpRefl){
smoothSharedEnergy[i] = Math.sqrt(traceUpRefl);
smoothSharedDistance[i] = Math.sqrt(traceUpDistance);
smoothSharedEnergy[i] = traceUpRefl;
smoothSharedDistance[i] = traceUpDistance;
} else {
smoothSharedEnergy[i] = Math.sqrt(traceDownRefl);
smoothSharedDistance[i] = Math.sqrt(traceDownDistance);
smoothSharedEnergy[i] = traceDownRefl;
smoothSharedDistance[i] = traceDownDistance;
}
}
}
Expand Down Expand Up @@ -698,7 +698,7 @@ private static double getBlockOcclusionD(final BlockState blockState) {
}

@Environment(EnvType.CLIENT)
public static void setEnv(final @NotNull SoundProfile profile) { // TODO: Add slot selection here
public static void setEnv(final @NotNull SoundProfile profile) {
if (ResoundingEngine.isOff) throw new IllegalStateException("ResoundingEngine must be started first! ");

if (profile.sendGain().length != pC.resolution + 1 || profile.sendCutoff().length != pC.resolution + 1) {
Expand Down Expand Up @@ -728,7 +728,7 @@ public static void setEnv(final @NotNull SoundProfile profile) { // TODO: Add sl
int imax = 0; for (int i = 1; i <= pC.resolution; i++) { if (sendGain[i] == max){ imax=i; break; } }

final int iavg;
if (false) { // Different selection method, can't decide which one is better. TODO: Do something with this.
if (false) { // Different fast selection method, can't decide which one is better. TODO: Do something with this.
double sum = 0;
double weightedSum = 0;
for (int i = 1; i <= pC.resolution; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public class PrecomputedConfig {
@Environment(EnvType.CLIENT)
public double globalRvrbHFRcp;
@Environment(EnvType.CLIENT)
public double rvrbDensity;
public double rvrbDiff;
@Environment(EnvType.CLIENT)
public double globalAbs;
@Environment(EnvType.CLIENT)
Expand Down Expand Up @@ -176,7 +176,7 @@ public PrecomputedConfig(ResoundingConfig c) throws CloneNotSupportedException {
energyFix = 1 / Math.max(c.general.globalReverbStrength, Double.MIN_NORMAL);
resolution = c.quality.reverbResolution;
globalRvrbHFRcp = (float) (1 / Math.max(c.general.globalReverbBrightness, Math.pow(10, -64)));
rvrbDensity = 1 - MathHelper.clamp(c.general.globalReverbSmoothness, 0.0, 1.0);
rvrbDiff = MathHelper.clamp(c.general.globalReverbSmoothness, 0.0, 1.0);
globalAbs = c.general.globalBlockAbsorption;
globalAbsHFRcp = globalRvrbHFRcp /*c.general.globalAbsorptionBrightness*/; // TODO: Occlusion
globalRefl = c.general.globalBlockReflectance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static class General{
public int globalReverbGain = 75;

@Comment("The strength of the reverb effect.\n§7[•]§r Range: >= 0.0\n§7[•]§r Higher values make the echo last longer.\n§7[•]§r Lower values make the echos shorter.\n§a[+]§r Performance Impact: Low")
public double globalReverbStrength = 5;
public double globalReverbStrength = 1.0;

@Comment("The smoothness of the reverb.\n§7[•]§r Range: 0.0 - 1.0\n§7[•]§r Affects how uniform the reverb is.\n§7[•]§r Low values cause a distinct fluttering or bouncing echo.\n§7[•]§r High values make this effect less distinct by smoothing out the reverb.\n§a[+]§r Performance Impact: Low")
public double globalReverbSmoothness = 0.5;
Expand Down Expand Up @@ -127,14 +127,17 @@ public static class Quality{

@Environment(EnvType.CLIENT)
public static class Effects {
@Comment("Represents how aggressively air absorbs high frequencies over distance.\n§7[•]§r Range: 0.0 - 10.0\n§7[•]§r A value of 1.0 is physically correct for air with normal humidity and temperature.\n§7[•]§r Higher values mean air will absorb more high frequencies with distance.\n§7[•]§r A value of 0.0 disables this effect.\n§a[+]§r Performance Impact: Low")
public double airAbsorption = 1.0;
@ConfigEntry.Gui.Excluded // TODO: AirAbs
@Comment("Represents how aggressively air absorbs high frequencies over distance.\n§7[•]§r Range: 0.0 - 10.0\n§7[•]§r A value of 1.0 is physically correct for air with normal humidity and temperature.\n§7[•]§r Higher values mean air will absorb more high frequencies with distance.\n§7[•]§r A value of 0.0 disables this effect.\n§a[+]§r Performance Impact: Low")
public double airAbsorption = 0.0;

@Comment("How much humidity contributes to the air absorption.\n§7[•]§r Range: 0.0 - 4.0\n§7[•]§r A value of 1.0 is physically correct.\n§7[•]§r Higher values mean air will absorb more high frequencies with distance,\n depending on the local humidity.\n§7[•]§r A value of 0.0 disables this effect.\n§a[+]§r Performance Impact: Low")
public double humidityAbsorption = 1.0;
@ConfigEntry.Gui.Excluded // TODO: AirAbs
@Comment("How much humidity contributes to the air absorption.\n§7[•]§r Range: 0.0 - 4.0\n§7[•]§r A value of 1.0 is physically correct.\n§7[•]§r Higher values mean air will absorb more high frequencies with distance,\n depending on the local humidity.\n§7[•]§r A value of 0.0 disables this effect.\n§a[+]§r Performance Impact: Low")
public double humidityAbsorption = 0.0;

@Comment("How much rain drops contribute to the air absorption.\n§7[•]§r Range: 0.0 - 2.0\n§7[•]§r A value of 1.0 is approximately physically correct.\n§7[•]§r Higher values mean air will absorb more high frequencies with distance,\n depending on the local rainfall.\n§7[•]§r A value of 0.0 disables this effect.\n§a[+]§r Performance Impact: Low")
public double rainAbsorption = 1.0;
@ConfigEntry.Gui.Excluded // TODO: AirAbs
@Comment("How much rain drops contribute to the air absorption.\n§7[•]§r Range: 0.0 - 2.0\n§7[•]§r A value of 1.0 is approximately physically correct.\n§7[•]§r Higher values mean air will absorb more high frequencies with distance,\n depending on the local rainfall.\n§7[•]§r A value of 0.0 disables this effect.\n§a[+]§r Performance Impact: Low")
public double rainAbsorption = 0.0;

@Comment("How much sound is filtered when the player is underwater.\n§7[•]§r Range: 0.0 - 1.0\n§7[•]§r 0.0 means no filter. 1.0 means fully filtered.\n§a[+]§r Performance Impact: Low")
public double underwaterFilter = 0.75;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private static void initEAXReverb(){
setEffect(i - 1,
(float) Math.max(t * pC.maxDecayTime, 0.1),
(float) (t * 0.5 + 0.5),
(float) MathHelper.lerp(t, 0.1 + (0.9 * pC.rvrbDensity), 0.8 + (0.2 * (1 - pC.rvrbDensity))),
(float) MathHelper.lerp(pC.rvrbDiff, 1-t, 1),
(float) (0.95 - (0.75 * t)),
(float) Math.max(0.95 - (0.3 * t), 0.1),
(float) Math.max(Math.pow(1 - t, 0.5) + 0.618, 0.1),
Expand Down

0 comments on commit de06f45

Please sign in to comment.