com.threerings.media.sound
Class JavaSoundPlayer.SoundKey

java.lang.Object
  extended by com.threerings.media.sound.JavaSoundPlayer.SoundKey
All Implemented Interfaces:
SoundPlayer.Frob
Enclosing class:
JavaSoundPlayer

protected static class JavaSoundPlayer.SoundKey
extends Object
implements SoundPlayer.Frob

A key for tracking sounds.


Field Summary
 byte cmd
           
 String key
           
 float pan
          The pan, or 0 to center the sound.
 String pkgPath
           
 boolean running
          Should we still be running?
 long stamp
           
 Thread thread
          The player thread, if it's playing us.
 float volume
           
 
Constructor Summary
JavaSoundPlayer.SoundKey(byte cmd)
          Create a SoundKey that just contains the specified command.
JavaSoundPlayer.SoundKey(byte cmd, String pkgPath, String key)
          Quicky constructor for music keys and lock operations.
JavaSoundPlayer.SoundKey(byte cmd, String pkgPath, String key, int delay, float volume, float pan)
          Constructor for a sound effect soundkey.
 
Method Summary
 boolean equals(Object o)
           
 float getPan()
          Get the pan value of this sound.
 float getVolume()
          Get the volume of this sound.
 int hashCode()
           
 boolean isExpired()
          Has this sound key expired.
protected  boolean isLoop()
          If this key is one of the two loop types.
 void setPan(float newPan)
          Set the pan value for the sound.
 void setVolume(float vol)
          Set the volume of the sound.
 void stop()
          Stop playing or looping the sound.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

cmd

public byte cmd

pkgPath

public String pkgPath

key

public String key

stamp

public long stamp

running

public volatile boolean running
Should we still be running?


volume

public volatile float volume

pan

public volatile float pan
The pan, or 0 to center the sound.


thread

public Thread thread
The player thread, if it's playing us.

Constructor Detail

JavaSoundPlayer.SoundKey

public JavaSoundPlayer.SoundKey(byte cmd)
Create a SoundKey that just contains the specified command.


JavaSoundPlayer.SoundKey

public JavaSoundPlayer.SoundKey(byte cmd,
                                String pkgPath,
                                String key)
Quicky constructor for music keys and lock operations.


JavaSoundPlayer.SoundKey

public JavaSoundPlayer.SoundKey(byte cmd,
                                String pkgPath,
                                String key,
                                int delay,
                                float volume,
                                float pan)
Constructor for a sound effect soundkey.

Method Detail

stop

public void stop()
Description copied from interface: SoundPlayer.Frob
Stop playing or looping the sound. At present, the granularity of this command is limited to the buffer size of the line spooler, or about 8k of data. Thus, if playing an 11khz sample, it could take 8/11ths of a second for the sound to actually stop playing.

Specified by:
stop in interface SoundPlayer.Frob

setVolume

public void setVolume(float vol)
Description copied from interface: SoundPlayer.Frob
Set the volume of the sound.

Specified by:
setVolume in interface SoundPlayer.Frob

getVolume

public float getVolume()
Description copied from interface: SoundPlayer.Frob
Get the volume of this sound.

Specified by:
getVolume in interface SoundPlayer.Frob

setPan

public void setPan(float newPan)
Description copied from interface: SoundPlayer.Frob
Set the pan value for the sound. Valid values are -1 for left-only, 0 is centered, all the way to +1 for right-only.

Specified by:
setPan in interface SoundPlayer.Frob

getPan

public float getPan()
Description copied from interface: SoundPlayer.Frob
Get the pan value of this sound.

Specified by:
getPan in interface SoundPlayer.Frob

isExpired

public boolean isExpired()
Has this sound key expired.


isLoop

protected boolean isLoop()
If this key is one of the two loop types.


toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object