Class AudioTrack

java.lang.Object
com.jme3.animation.AudioTrack
All Implemented Interfaces:
ClonableTrack, Track, Savable, JmeCloneable, Cloneable

@Deprecated public class AudioTrack extends Object implements ClonableTrack
Deprecated.
AudioTrack is a track to add to an existing animation, to play a sound during an animations for example : gunshot, footstep, shout, etcetera. Typical usage is:
 AnimControl control model.getControl(AnimControl.class);
 AudioTrack track = new AudioTrack(existingAudioNode, control.getAnim("TheAnim").getLength());
 control.getAnim("TheAnim").addTrack(track);
 
This is mostly intended for short sounds, playInstance will be called on the AudioNode at time 0 + startOffset.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Deprecated.
    constructor for serialization only
     
    AudioTrack(AudioNode audio, float length)
    Deprecated.
    Creates an AudioTrack
     
    AudioTrack(AudioNode audio, float length, float startOffset)
    Deprecated.
    Creates an AudioTrack
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Deprecated.
    Method responsible for cleaning UserData on referenced Spatials when the Track is deleted
    Deprecated.
    Clone this track
    void
    cloneFields(Cloner cloner, Object original)
    Deprecated.
    Implemented to perform deep cloning for this object, resolving local cloned references using the specified cloner.
    Deprecated.
    This method clone the Track and search for the cloned counterpart of the original audio node in the given cloned spatial.
    Deprecated.
     
    float[]
    Deprecated.
    Get the times in seconds for all keyframes.
    float
    Deprecated.
    Return the length of the track
    float
    Deprecated.
     
    Deprecated.
    Performs a regular shallow clone of the object.
    void
    Deprecated.
    Internal use only serialization
    void
    Deprecated.
    sets the audio node to be used for this track
    void
    setStartOffset(float startOffset)
    Deprecated.
    set the start offset of the track
    void
    setTime(float time, float weight, AnimControl control, AnimChannel channel, TempVars vars)
    Deprecated.
    Internal use only
    void
    Deprecated.
    Internal use only serialization

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AudioTrack

      protected AudioTrack()
      Deprecated.
      constructor for serialization only
    • AudioTrack

      public AudioTrack(AudioNode audio, float length)
      Deprecated.
      Creates an AudioTrack
      Parameters:
      audio - the AudioNode
      length - the length of the track (usually the length of the animation you want to add the track to)
    • AudioTrack

      public AudioTrack(AudioNode audio, float length, float startOffset)
      Deprecated.
      Creates an AudioTrack
      Parameters:
      audio - the AudioNode
      length - the length of the track (usually the length of the animation you want to add the track to)
      startOffset - the time in second when the sound will be played after the animation starts (default is 0)
  • Method Details

    • setTime

      public void setTime(float time, float weight, AnimControl control, AnimChannel channel, TempVars vars)
      Deprecated.
      Internal use only
      Specified by:
      setTime in interface Track
      Parameters:
      time - The time in the animation
      weight - The weight from 0 to 1 on how much to apply the track
      control - The control which the track should affect
      channel - The channel which the track should affect
      vars - temporary storage
      See Also:
    • getLength

      public float getLength()
      Deprecated.
      Return the length of the track
      Specified by:
      getLength in interface Track
      Returns:
      length of the track
    • getKeyFrameTimes

      public float[] getKeyFrameTimes()
      Deprecated.
      Description copied from interface: Track
      Get the times in seconds for all keyframes. All keyframe times should be between 0.0 and length. Modifying the provided array is not allowed, as it may corrupt internal state.
      Specified by:
      getKeyFrameTimes in interface Track
      Returns:
      the keyframe times
    • clone

      public AudioTrack clone()
      Deprecated.
      Clone this track
      Specified by:
      clone in interface Track
      Overrides:
      clone in class Object
      Returns:
      a new track
    • cloneForSpatial

      public Track cloneForSpatial(Spatial spatial)
      Deprecated.
      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 controlling the animation using this Track.
      Specified by:
      cloneForSpatial in interface ClonableTrack
      Parameters:
      spatial - the Spatial holding the AnimControl
      Returns:
      the cloned Track with proper reference
    • jmeClone

      public Object jmeClone()
      Deprecated.
      Description copied from interface: JmeCloneable
      Performs a regular shallow clone of the object. Some fields may also be cloned but generally only if they will never be shared with other objects. (For example, local Vector3fs and so on.)

      This method is separate from the regular clone() method so that objects might still maintain their own regular java clone() semantics (perhaps even using Cloner for those methods). However, because Java's clone() has specific features in the sense of Object's clone() implementation, it's usually best to have some path for subclasses to bypass the public clone() method that might be cloning fields and instead get at the superclass protected clone() methods. For example, through super.jmeClone() or another protected clone method that some base class eventually calls super.clone() in.

      Specified by:
      jmeClone in interface JmeCloneable
      Returns:
      a new instance
    • cloneFields

      public void cloneFields(Cloner cloner, Object original)
      Deprecated.
      Description copied from interface: JmeCloneable
      Implemented to perform deep cloning for this object, resolving local cloned references using the specified cloner. The object can call cloner.clone(fieldValue) to deep clone any of its fields.

      Note: during normal clone operations the original object will not be needed as the clone has already had all of the fields shallow copied.

      Specified by:
      cloneFields in interface JmeCloneable
      Parameters:
      cloner - The cloner that is performing the cloning operation. The cloneFields method can call back into the cloner to make clones of its subordinate fields.
      original - The original object from which this object was cloned. This is provided for the very rare case that this object needs to refer to its original for some reason. In general, all of the relevant values should have been transferred during the shallow clone, and this object need only clone what it wants.
    • cleanUp

      public void cleanUp()
      Deprecated.
      Description copied from interface: ClonableTrack
      Method responsible for cleaning UserData on referenced Spatials when the Track is deleted
      Specified by:
      cleanUp in interface ClonableTrack
    • getAudio

      public AudioNode getAudio()
      Deprecated.
      Returns:
      the audio node used by this track
    • setAudio

      public void setAudio(AudioNode audio)
      Deprecated.
      sets the audio node to be used for this track
      Parameters:
      audio - the desired AudioNode (alias created)
    • getStartOffset

      public float getStartOffset()
      Deprecated.
      Returns:
      the start offset of the track
    • setStartOffset

      public void setStartOffset(float startOffset)
      Deprecated.
      set the start offset of the track
      Parameters:
      startOffset - the desired start offset
    • write

      public void write(JmeExporter ex) throws IOException
      Deprecated.
      Internal use only serialization
      Specified by:
      write in interface Savable
      Parameters:
      ex - exporter
      Throws:
      IOException - exception
    • read

      public void read(JmeImporter im) throws IOException
      Deprecated.
      Internal use only serialization
      Specified by:
      read in interface Savable
      Parameters:
      im - importer
      Throws:
      IOException - Exception