PulpCore

pulpcore.sound
Class Playback

java.lang.Object
  extended by pulpcore.sound.Playback

public abstract class Playback
extends Object

The Playback class allows a Sound be modified while it is playing.


Field Summary
 Fixed level
          The level, from 0 to 1.
 Fixed pan
          The pan, from -1 to 1.
 
Constructor Summary
Playback(Fixed level, Fixed pan)
           
 
Method Summary
abstract  int getFramePosition()
          Gets the current playback position in frames.
 long getMicrosecondPosition()
          Gets the current playback position in microseconds.
abstract  int getSampleRate()
          Gets the sound's sample rate.
abstract  boolean isFinished()
          Returns true if the playback is finished.
abstract  boolean isPaused()
          Checks if this playback is currently paused and playback can continue.
 void rewind()
          Sets the current plaback position to the first frame.
abstract  void setFramePosition(int framePosition)
          Sets the current playback position.
 void setMicrosecondPosition(long pos)
          Sets the current playback position, in microseconds.
abstract  void setPaused(boolean paused)
          Pauses this playback or continues playback after pausing.
abstract  void stop()
          Stops this playback as soon as possible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

level

public final Fixed level
The level, from 0 to 1. The level animation is synchronized with the Sound's playback time, and can't be animated with a Timeline.


pan

public final Fixed pan
The pan, from -1 to 1. The pan animation is synchronized with the Sound's playback time, and can't be animated with a Timeline.

Constructor Detail

Playback

public Playback(Fixed level,
                Fixed pan)
Method Detail

getSampleRate

public abstract int getSampleRate()
Gets the sound's sample rate.


getFramePosition

public abstract int getFramePosition()
Gets the current playback position in frames.


getMicrosecondPosition

public final long getMicrosecondPosition()
Gets the current playback position in microseconds.


rewind

public final void rewind()
Sets the current plaback position to the first frame. This method returns immediately, but there may be a slight delay (a few milliseconds) before the frame position is actually set (to avoid clicks/pops).


setFramePosition

public abstract void setFramePosition(int framePosition)
Sets the current playback position. This method returns immediately, but there may be a slight delay (a few milliseconds) before the frame position is actually set (to avoid clicks/pops).


setMicrosecondPosition

public final void setMicrosecondPosition(long pos)
Sets the current playback position, in microseconds. This method returns immediately, but there may be a slight delay (a few milliseconds) before the frame position is actually set (to avoid clicks/pops).


setPaused

public abstract void setPaused(boolean paused)
Pauses this playback or continues playback after pausing. A paused sound may continue to send data (in the form of inaudible sound) to the sound engine until the playback is stopped.

If playback is paused and the garbage collector determines no references to this Playback object exist (for example, when music is paused, but the Scene with the Playback object no longer exists), the playback will automatically stop, and data will no longer be sent to the sound engine. For example:

        Sound music = Sound.load("music.wav");
        Playback musicPlayback = music.play();
        ...
        // Playback is paused, but still active and ready to be unpaused.
        musicPlayback.setPaused(true); 
        ...
        // Paused playback will automatically become inactive at a future point in time.
        musicPlayback = null; 
        


isPaused

public abstract boolean isPaused()
Checks if this playback is currently paused and playback can continue.


stop

public abstract void stop()
Stops this playback as soon as possible. A stopped playback cannot be restarted.


isFinished

public abstract boolean isFinished()
Returns true if the playback is finished. Once finished, the playback cannot be restarted.


PulpCore

Copyright © 2007-2009 Interactive Pulp, LLC.