Made the methods called from the audio thread final because

no good can come from overriding them.  Also made those
variables volatile so that other threads are guaranteed to
see the right values.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7874 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
PSp..om 14 years ago
parent 287bc0167c
commit 1e8dea8eba
  1. 8
      engine/src/core/com/jme3/audio/AudioNode.java

@ -66,8 +66,8 @@ public class AudioNode extends Node {
protected Filter dryFilter; protected Filter dryFilter;
protected AudioKey key; protected AudioKey key;
protected transient AudioData data = null; protected transient AudioData data = null;
protected transient Status status = Status.Stopped; protected transient volatile Status status = Status.Stopped;
protected transient int channel = -1; protected transient volatile int channel = -1;
protected Vector3f velocity = new Vector3f(); protected Vector3f velocity = new Vector3f();
protected boolean reverbEnabled = true; protected boolean reverbEnabled = true;
protected float maxDistance = 200; // 200 meters protected float maxDistance = 200; // 200 meters
@ -262,7 +262,7 @@ public class AudioNode extends Node {
/** /**
* Do not use. * Do not use.
*/ */
public void setChannel(int channel) { public final void setChannel(int channel) {
if (status != Status.Stopped) { if (status != Status.Stopped) {
throw new IllegalStateException("Can only set source id when stopped"); throw new IllegalStateException("Can only set source id when stopped");
} }
@ -341,7 +341,7 @@ public class AudioNode extends Node {
/** /**
* Do not use. * Do not use.
*/ */
public void setStatus(Status status) { public final void setStatus(Status status) {
this.status = status; this.status = status;
} }

Loading…
Cancel
Save