This commit is contained in:
Sen 2025-03-18 13:12:54 +01:00
parent b3fff0134f
commit c22c04a6d1
6 changed files with 0 additions and 3019 deletions

View file

@ -48,8 +48,6 @@ public class AudioInterface implements Runnable {
private final Thread thread; private final Thread thread;
private final List<Command> cmds = Lists.newArrayList(); private final List<Command> cmds = Lists.newArrayList();
private final short[] volumes = new short[Volume.values().length]; private final short[] volumes = new short[Volume.values().length];
// private final int[] mix = new int[Volume.values().length];
// private final int[] attn = new int[Volume.values().length];
private final Channel[] channels = new Channel[32]; private final Channel[] channels = new Channel[32];
private SourceDataLine line; private SourceDataLine line;
@ -92,11 +90,9 @@ public class AudioInterface implements Runnable {
private short generate() { private short generate() {
long mix = 0; long mix = 0;
// long attn = 0; // (32767 * 100) / 95);
for(int z = 0; z < this.channels.length; z++) { for(int z = 0; z < this.channels.length; z++) {
Channel ch = this.channels[z]; Channel ch = this.channels[z];
if(ch.run) { if(ch.run) {
// attn += (long)ch.level * (long)this.volumes[ch.type]; // (this.attn[ch.type] * 95) / 100;
mix += (long)ch.buffer[ch.pos] * (long)ch.level * (((long)this.volumes[ch.type] * (long)this.volumes[0]) / 32767); mix += (long)ch.buffer[ch.pos] * (long)ch.level * (((long)this.volumes[ch.type] * (long)this.volumes[0]) / 32767);
if(++ch.pos >= ch.buffer.length) { if(++ch.pos >= ch.buffer.length) {
ch.pos = 0; ch.pos = 0;
@ -105,10 +101,6 @@ public class AudioInterface implements Runnable {
} }
} }
} }
// for(int z = 1; z < this.volumes.length; z++) {
// if(this.attn[z] > 0)
// this.mix[0] += (short)(int)(((this.mix[z] * 32767 / this.attn[z]) * (int)this.volumes[z]) / 32767);
// }
mix /= 32767L * 32767L; mix /= 32767L * 32767L;
long amp = Math.abs(mix); long amp = Math.abs(mix);
if(amp > 32767L) if(amp > 32767L)
@ -116,7 +108,6 @@ public class AudioInterface implements Runnable {
else if(this.peak > 32767L) else if(this.peak > 32767L)
this.peak = Math.max(this.peak - 3L, 32767L); this.peak = Math.max(this.peak - 3L, 32767L);
return (short)((mix * 32767L) / this.peak); return (short)((mix * 32767L) / this.peak);
// return attn == 0L ? 0 : (short)(mix / Math.min(attn, 32767L * 32767L * 2L));
} }
private void dispatch(Object buf, Cmd op, short addr, int param) { private void dispatch(Object buf, Cmd op, short addr, int param) {

File diff suppressed because it is too large Load diff

View file

@ -14,7 +14,6 @@ public class MovingSoundMinecart extends MovingSound
super(SoundEvent.CART); super(SoundEvent.CART);
this.minecart = minecartIn; this.minecart = minecartIn;
this.repeat = true; this.repeat = true;
// this.repeatDelay = 0;
} }
/** /**

View file

@ -17,7 +17,6 @@ public class MovingSoundMinecartRiding extends MovingSound
this.minecart = minecart; this.minecart = minecart;
this.attenuationType = false; this.attenuationType = false;
this.repeat = true; this.repeat = true;
// this.repeatDelay = 0;
} }
/** /**

View file

@ -7,7 +7,6 @@ public abstract class Sound
protected final SoundEvent event; protected final SoundEvent event;
protected Volume type = Volume.SFX; protected Volume type = Volume.SFX;
protected float volume = 1.0F; protected float volume = 1.0F;
// protected float pitch = 1.0F;
protected float xPosF; protected float xPosF;
protected float yPosF; protected float yPosF;
protected float zPosF; protected float zPosF;
@ -34,11 +33,6 @@ public abstract class Sound
return this.volume; return this.volume;
} }
// public float getPitch()
// {
// return this.pitch;
// }
public float getXPosF() public float getXPosF()
{ {
return this.xPosF; return this.xPosF;

View file

@ -19,7 +19,6 @@ public class SoundManager {
private class Source { private class Source {
private final boolean attModel; private final boolean attModel;
private final float distOrRoll; private final float distOrRoll;
// private final short[] buffer;
private final int source; private final int source;
private float positionX; private float positionX;
@ -34,7 +33,6 @@ public class SoundManager {
this.positionZ = z; this.positionZ = z;
this.attModel = attModel; this.attModel = attModel;
this.distOrRoll = distOrRoll; this.distOrRoll = distOrRoll;
// this.buffer = buffer;
this.volume = volume; this.volume = volume;
this.source = SoundManager.this.getNextChannel(sourcename); this.source = SoundManager.this.getNextChannel(sourcename);
updateGain(); updateGain();