Skip to content

Commit a72326a

Browse files
committed
Improved master volume handling
1 parent a59f9fa commit a72326a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/net/raphimc/noteblocktool/audio/soundsystem/impl/JavaxSoundSystem.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public synchronized void playSound(final String sound, final float pitch, final
6565
this.playingSounds.remove(0);
6666
}
6767

68-
this.playingSounds.add(new SoundInstance(this.sounds.get(sound), pitch, volume * this.masterVolume, panning));
68+
this.playingSounds.add(new SoundInstance(this.sounds.get(sound), pitch, volume, panning));
6969
}
7070

7171
@Override
@@ -123,6 +123,7 @@ protected byte[] writeNormalized(final long[] samples) {
123123
final float weight = (float) i / this.volumeDividers.length;
124124
div = Math.max(div, this.volumeDividers[i] * weight);
125125
}
126+
div /= this.masterVolume;
126127
System.arraycopy(this.volumeDividers, 1, this.volumeDividers, 0, this.volumeDividers.length - 1);
127128
for (int i = 0; i < samples.length; i++) {
128129
final short conv = (short) (samples[i] / div);

0 commit comments

Comments
 (0)