Skip to content

Commit 9511c35

Browse files
committed
Fix some absorption stuff
1 parent de06f45 commit 9511c35

File tree

6 files changed

+16
-18
lines changed

6 files changed

+16
-18
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ minecraft_version=1.18.1
66
yarn_mappings=1.18.1+build.2
77
loader_version=0.12.12
88
# Mod Properties
9-
mod_version=1.0.0-bc.5
9+
mod_version=1.0.0-bc.6
1010
maven_group=dev.thedocruby
1111
archives_base_name=resounding
1212
# Dependencies

src/main/java/dev/thedocruby/resounding/ResoundingEngine.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ private static double getBlockOcclusionD(final BlockState blockState) {
603603
double directGain = (auxOnly ? 0 : inWater ? pC.waterFilt : 1) * Math.pow(airAbsorptionHF, listenerPos.distanceTo(soundPos)) ;
604604

605605
if (data.reflRays().isEmpty()) {
606-
return new SoundProfile(sourceID, directGain, directGain * pC.globalAbsHFRcp, new double[pC.resolution + 1], new double[pC.resolution + 1]);
606+
return new SoundProfile(sourceID, directGain, Math.pow(directGain, pC.globalAbsHFRcp), new double[pC.resolution + 1], new double[pC.resolution + 1]);
607607
}
608608

609609
double bounceCount = 0.0D;
@@ -684,7 +684,7 @@ private static double getBlockOcclusionD(final BlockState blockState) {
684684
directGain *= Math.pow(airAbsorptionHF, listenerPos.distanceTo(soundPos))
685685
/ Math.pow(listenerPos.distanceTo(soundPos), 2.0 * missedSum)
686686
* MathHelper.lerp(sharedSum, 0d/*TODO: occlusion coeff from processing goes here IF fancy or fabulous occl*/, 1d);
687-
double directCutoff = Math.pow(directGain, pC.globalAbsHFRcp); // TODO: occlusion
687+
double directCutoff = Math.pow(directGain, pC.globalAbsHFRcp); // TODO: make sure this actually works.
688688

689689
SoundProfile profile = new SoundProfile(sourceID, directGain, directCutoff, sendGain, sendCutoff);
690690

src/main/java/dev/thedocruby/resounding/config/BlueTapePack/ConfigManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ private ConfigManager() {}
2626

2727
public static boolean resetOnReload;
2828

29-
public static final String configVersion = "1.0.0-bc.5";
29+
public static final String configVersion = "1.0.0-bc.6";
3030

3131
@Environment(EnvType.CLIENT)
3232
public static final ResoundingConfig DEFAULT = ResoundingEngine.env == EnvType.CLIENT ? new ResoundingConfig(){{

src/main/java/dev/thedocruby/resounding/config/PrecomputedConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,10 @@ public PrecomputedConfig(ResoundingConfig c) throws CloneNotSupportedException {
175175
globalRvrbGain = MathHelper.clamp(c.general.globalReverbGain/100d, 0.0d, 1.0d);
176176
energyFix = 1 / Math.max(c.general.globalReverbStrength, Double.MIN_NORMAL);
177177
resolution = c.quality.reverbResolution;
178-
globalRvrbHFRcp = (float) (1 / Math.max(c.general.globalReverbBrightness, Math.pow(10, -64)));
178+
globalRvrbHFRcp = 1 / Math.max(c.general.globalReverbBrightness, Double.MIN_NORMAL);
179179
rvrbDiff = MathHelper.clamp(c.general.globalReverbSmoothness, 0.0, 1.0);
180180
globalAbs = c.general.globalBlockAbsorption;
181-
globalAbsHFRcp = globalRvrbHFRcp /*c.general.globalAbsorptionBrightness*/; // TODO: Occlusion
181+
globalAbsHFRcp = 1 / Math.max(c.general.globalAbsorptionBrightness, Double.MIN_NORMAL);
182182
globalRefl = c.general.globalBlockReflectance;
183183
globalReflRcp = 1 / globalRefl;
184184
airAbs = (float) MathHelper.clamp(c.effects.airAbsorption, 0.0, 10.0);

src/main/java/dev/thedocruby/resounding/config/ResoundingConfig.java

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ public static class General{
6868
public double globalReverbSmoothness = 0.5;
6969

7070
@Comment("The brightness of reverberation.\n§7[•]§r Range: > 0 \n§7[•]§r Higher values result in more high frequencies in reverberation.\n§7[•]§r Lower values give a more muffled sound to the reverb.\n§7[•]§r 1.0 is neutral.\n§a[+]§r Performance Impact: Low")
71-
public double globalReverbBrightness = 0.8;
71+
public double globalReverbBrightness = 0.75;
7272

73-
@ConfigEntry.Gui.Excluded // TODO: Occlusion
74-
public double globalAbsorptionBrightness = 0.618;
73+
@Comment("The brightness of absorption.\n§7[•]§r Range: > 0 \n§7[•]§r Higher values result in more high frequencies in faded or occluded audio.\n§7[•]§r Lower values give a more muffled sound to faded or occluded audio.\n§7[•]§r 1.0 is neutral.\n§a[+]§r Performance Impact: Low")
74+
public double globalAbsorptionBrightness = 0.75;
7575

7676
@ConfigEntry.Gui.Excluded // TODO: Occlusion. Remove?
7777
//@Comment("The global amount of sound that will be absorbed when traveling through blocks. 0.1 - 4.0")
@@ -127,17 +127,14 @@ public static class Quality{
127127

128128
@Environment(EnvType.CLIENT)
129129
public static class Effects {
130-
@ConfigEntry.Gui.Excluded // TODO: AirAbs
131-
@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")
132-
public double airAbsorption = 0.0;
130+
@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")
131+
public double airAbsorption = 0.2;
133132

134-
@ConfigEntry.Gui.Excluded // TODO: AirAbs
135-
@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")
136-
public double humidityAbsorption = 0.0;
133+
@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")
134+
public double humidityAbsorption = 0.2;
137135

138-
@ConfigEntry.Gui.Excluded // TODO: AirAbs
139-
@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")
140-
public double rainAbsorption = 0.0;
136+
@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")
137+
public double rainAbsorption = 0.2;
141138

142139
@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")
143140
public double underwaterFilter = 0.75;

src/main/resources/assets/resounding/lang/en_us.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"text.autoconfig.resounding.option.general.globalReverbStrength": "Reverb strength",
1515
"text.autoconfig.resounding.option.general.globalReverbSmoothness": "Reverb smoothness",
1616
"text.autoconfig.resounding.option.general.globalReverbBrightness": "Reverb brightness",
17+
"text.autoconfig.resounding.option.general.globalAbsorptionBrightness": "Absorption brightness",
1718

1819
"text.autoconfig.resounding.option.quality.reverbResolution": "Reverb resolution",
1920
"text.autoconfig.resounding.option.quality.envEvalRays": "Rays per sound",

0 commit comments

Comments
 (0)