AudioTrack : prevented audio track to be looped even if the channel loopMode is dontLoop

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9866 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 12 years ago
parent 53afc0f02e
commit a61bdf1d47
  1. 41
      engine/src/core/com/jme3/animation/AudioTrack.java

@ -44,8 +44,8 @@ import java.util.logging.Level;
import java.util.logging.Logger;
/**
* AudioTrack is a track to add to an existing animation, to paly a sound during an animations
* for example : gun shot, foot step, shout, etc...
* AudioTrack is a track to add to an existing animation, to paly a sound during
* an animations for example : gun shot, foot step, shout, etc...
*
* usage is
* <pre>
@ -54,7 +54,8 @@ import java.util.logging.Logger;
* control.getAnim("TheAnim").addTrack(track);
* </pre>
*
* This is mostly intended for short sounds, playInstance will be called on the AudioNode at time 0 + startOffset.
* This is mostly intended for short sounds, playInstance will be called on the
* AudioNode at time 0 + startOffset.
*
*
* @author Nehon
@ -76,7 +77,6 @@ public class AudioTrack implements ClonableTrack {
}
public void onAnimChange(AnimControl control, AnimChannel channel, String animName) {
stop();
}
}
@ -88,8 +88,10 @@ public class AudioTrack implements ClonableTrack {
/**
* Creates an AudioTrack
*
* @param audio the AudioNode
* @param length the length of the track (usually the length of the animation you want to add the track to)
* @param length the length of the track (usually the length of the
* animation you want to add the track to)
*/
public AudioTrack(AudioNode audio, float length) {
this.audio = audio;
@ -99,9 +101,12 @@ public class AudioTrack implements ClonableTrack {
/**
* Creates an AudioTrack
*
* @param audio the AudioNode
* @param length the length of the track (usually the length of the animation you want to add the track to)
* @param startOffset the time in second when the sound will be played after the animation starts (default is 0)
* @param length the length of the track (usually the length of the
* animation you want to add the track to)
* @param startOffset the time in second when the sound will be played after
* the animation starts (default is 0)
*/
public AudioTrack(AudioNode audio, float length, float startOffset) {
this(audio, length);
@ -110,10 +115,15 @@ public class AudioTrack implements ClonableTrack {
/**
* Internal use only
* @see Track#setTime(float, float, com.jme3.animation.AnimControl, com.jme3.animation.AnimChannel, com.jme3.util.TempVars)
*
* @see Track#setTime(float, float, com.jme3.animation.AnimControl,
* com.jme3.animation.AnimChannel, com.jme3.util.TempVars)
*/
public void setTime(float time, float weight, AnimControl control, AnimChannel channel, TempVars vars) {
if (time == length) {
return;
}
if (!initialized) {
control.addListener(new OnEndListener());
initialized = true;
@ -132,6 +142,7 @@ public class AudioTrack implements ClonableTrack {
/**
* Retruns the length of the track
*
* @return length of the track
*/
public float getLength() {
@ -140,6 +151,7 @@ public class AudioTrack implements ClonableTrack {
/**
* Clone this track
*
* @return
*/
@Override
@ -148,8 +160,11 @@ public class AudioTrack implements ClonableTrack {
}
/**
* This method clone the Track and search for the cloned counterpart of the original audio node in the given cloned spatial.
* The spatial is assumed to be the Spatial holding the AnimControl controling the animation using this Track.
* This method clone the Track and search for the cloned counterpart of the
* original audio node in the given cloned spatial. The spatial is assumed
* to be the Spatial holding the AnimControl controling the animation using
* this Track.
*
* @param spatial the Spatial holding the AnimControl
* @return the cloned Track with proper reference
*/
@ -173,6 +188,7 @@ public class AudioTrack implements ClonableTrack {
/**
* recursive function responsible for finding the newly cloned AudioNode
*
* @param spat
* @return
*/
@ -220,7 +236,6 @@ public class AudioTrack implements ClonableTrack {
}
}
/**
*
* @return the audio node used by this track
@ -231,6 +246,7 @@ public class AudioTrack implements ClonableTrack {
/**
* sets the audio node to be used for this track
*
* @param audio
*/
public void setAudio(AudioNode audio) {
@ -252,6 +268,7 @@ public class AudioTrack implements ClonableTrack {
/**
* set the start offset of the track
*
* @param startOffset
*/
public void setStartOffset(float startOffset) {
@ -260,6 +277,7 @@ public class AudioTrack implements ClonableTrack {
/**
* Internal use only serialization
*
* @param ex exporter
* @throws IOException exception
*/
@ -272,6 +290,7 @@ public class AudioTrack implements ClonableTrack {
/**
* Internal use only serialization
*
* @param im importer
* @throws IOException Exception
*/

Loading…
Cancel
Save