Skip to content

Commit d59d66e

Browse files
committed
minor improve
1 parent 3801a2b commit d59d66e

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ mod_name=Channel
3030
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
3131
mod_license=GNU GPL 3.0
3232
# The mod version. See https://semver.org/
33-
mod_version=26.1.2-21+beta
33+
mod_version=26.1.2-22+beta
3434
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
3535
# This should match the base package used for the mod sources.
3636
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html

src/main/java/cn/ussshenzhou/channel/audio/client/receive/Audio.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public Audio(int sampleRate) {
3737
alSourcef(alSource, AL_GAIN, 1);
3838
alSourcef(alSource, AL_PITCH, 1);
3939
alSourcef(alSource, AL_LOOPING, AL_FALSE);
40-
alSourcef(alSource, AL_REFERENCE_DISTANCE, 1.5f);
40+
alSourcef(alSource, AL_REFERENCE_DISTANCE, 2);
4141
alSourcef(alSource, AL_MAX_GAIN, AudioHelper.db2factor(30));
4242
if (ChannelClientConfig.get().rayTraceAudio) {
4343
alSourcef(alSource, AL_ROLLOFF_FACTOR, 0);

src/main/java/cn/ussshenzhou/channel/audio/client/receive/SpeakerAudio.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class SpeakerAudio extends Audio {
2727
private final WeakReference<SpeakerBlockEntity> speakerBlockEntity;
2828
private final ConcurrentHashMap<UUID, MpscArrayQueue<short[]>> audioBuffers = new ConcurrentHashMap<>();
2929
protected int x, y, z;
30-
public static final float REVERB_ENHANCE = 1.5f;
30+
public static final float REVERB_ENHANCE = 3f;
3131

3232
public SpeakerAudio(SpeakerBlockEntity speakerBlockEntity, int sampleRate) {
3333
super(sampleRate);
@@ -59,12 +59,12 @@ public void updateSourceParameters(SourceAudioData data, int auxSlot) {
5959
if (distance >= 32) {
6060
extraDecay = 1 - (distance - 32) / 32;
6161
}
62-
double wallDecay = Math.pow(0.5, data.wallThickness());
63-
alFilterf(this.alDirectFilter, AL_LOWPASS_GAIN, (float) (extraDecay * correctedGain * wallDecay / REVERB_ENHANCE));
62+
double directWallDecay = Math.pow(0.5, data.wallThickness());
63+
alFilterf(this.alDirectFilter, AL_LOWPASS_GAIN, (float) (extraDecay * correctedGain * directWallDecay));
6464
alFilterf(this.alDirectFilter, AL_LOWPASS_GAINHF, data.directHF());
6565
alSourcei(this.alSource, AL_DIRECT_FILTER, this.alDirectFilter);
6666

67-
alFilterf(this.alReverbFilter, AL_LOWPASS_GAIN, (float) (extraDecay * wallDecay));
67+
alFilterf(this.alReverbFilter, AL_LOWPASS_GAIN, (float) (Math.sqrt(data.reverbGain()) * REVERB_ENHANCE));
6868
alFilterf(this.alReverbFilter, AL_LOWPASS_GAINHF, 1);
6969
alSource3i(this.alSource, AL_AUXILIARY_SEND_FILTER, auxSlot, 0, this.alReverbFilter);
7070

@@ -83,7 +83,7 @@ public boolean play() {
8383

8484
@Override
8585
protected float getGain() {
86-
return REVERB_ENHANCE * AudioHelper.db2factor(ChannelClientConfig.get().outputAdjust);
86+
return AudioHelper.db2factor(ChannelClientConfig.get().outputAdjust);
8787
}
8888

8989
@Override

0 commit comments

Comments
 (0)