36 lines
911 B
Java
36 lines
911 B
Java
package com.mojang.blaze3d.audio;
|
|
|
|
import com.mojang.math.Vector3f;
|
|
import org.lwjgl.openal.AL10;
|
|
import net.minecraft.world.phys.Vec3;
|
|
|
|
public class Listener {
|
|
private float gain;
|
|
|
|
public Listener() {
|
|
this.gain = 1.0f;
|
|
}
|
|
|
|
public void setListenerPosition(final Vec3 cvl) {
|
|
AL10.alListener3f(4100, (float)cvl.x, (float)cvl.y, (float)cvl.z);
|
|
}
|
|
|
|
public void setListenerOrientation(final Vector3f e1, final Vector3f e2) {
|
|
AL10.alListenerfv(4111, new float[] { e1.x(), e1.y(), e1.z(), e2.x(), e2.y(), e2.z() });
|
|
}
|
|
|
|
public void setGain(final float float1) {
|
|
AL10.alListenerf(4106, float1);
|
|
this.gain = float1;
|
|
}
|
|
|
|
public float getGain() {
|
|
return this.gain;
|
|
}
|
|
|
|
public void reset() {
|
|
this.setListenerPosition(Vec3.ZERO);
|
|
this.setListenerOrientation(Vector3f.ZN, Vector3f.YP);
|
|
}
|
|
}
|