com.threerings.openal
Class Sounder.BaseClip

java.lang.Object
  extended by com.threerings.expr.SimpleScope
      extended by com.threerings.openal.Sounder.Implementation
          extended by com.threerings.openal.Sounder.BaseClip
All Implemented Interfaces:
Scope, ScopeUpdateListener
Direct Known Subclasses:
Sounder.Clip, Sounder.MetaClip, Sounder.VariableClip
Enclosing class:
Sounder

public abstract static class Sounder.BaseClip
extends Sounder.Implementation

Base class for Sounder.BaseClip, Sounder.MetaClip, and Sounder.VariableClip.


Field Summary
protected  SounderConfig.Original _config
          The implementation configuration.
protected  Sound _sound
          The (currently playing) sound.
protected  Vector3f _vector
          A result vector for computation.
 
Fields inherited from class com.threerings.openal.Sounder.Implementation
_ctx, _started, _transform
 
Fields inherited from class com.threerings.expr.SimpleScope
_parentScope
 
Fields inherited from interface com.threerings.expr.Scope
EPOCH, NOW
 
Constructor Summary
Sounder.BaseClip(AlContext ctx, Scope parentScope)
          Creates a new implementation.
 
Method Summary
protected  Sound getSound(String file, float gain, float pitch, Sound sound)
          Retrieves the sound corresponding to the specified file.
protected  Sound getSound(String file, Sound sound)
          Retrieves the sound corresponding to the specified file.
 boolean isPlaying()
          Checks whether the sound is currently playing.
protected  void playSound(float gain)
          Plays the sound.
 void scopeUpdated(ScopeEvent event)
          Called when the scope has been updated.
 void setConfig(SounderConfig.Original config)
          (Re)configures the implementation.
 void stop()
          Stops the sound.
 void update()
          Updates the sound.
protected abstract  void updateFromConfig()
          Updates the clip from its config.
protected  void updateSoundTransform()
          Updates the position and direction of the sound.
 
Methods inherited from class com.threerings.openal.Sounder.Implementation
dispose, getScopeName, loops, start
 
Methods inherited from class com.threerings.expr.SimpleScope
addListener, get, getParentScope, removeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_config

protected SounderConfig.Original _config
The implementation configuration.


_sound

protected Sound _sound
The (currently playing) sound.


_vector

protected Vector3f _vector
A result vector for computation.

Constructor Detail

Sounder.BaseClip

public Sounder.BaseClip(AlContext ctx,
                        Scope parentScope)
Creates a new implementation.

Method Detail

setConfig

public void setConfig(SounderConfig.Original config)
(Re)configures the implementation.


stop

public void stop()
Description copied from class: Sounder.Implementation
Stops the sound.

Specified by:
stop in class Sounder.Implementation

isPlaying

public boolean isPlaying()
Description copied from class: Sounder.Implementation
Checks whether the sound is currently playing.

Specified by:
isPlaying in class Sounder.Implementation

update

public void update()
Description copied from class: Sounder.Implementation
Updates the sound.

Overrides:
update in class Sounder.Implementation

scopeUpdated

public void scopeUpdated(ScopeEvent event)
Description copied from interface: ScopeUpdateListener
Called when the scope has been updated.

Specified by:
scopeUpdated in interface ScopeUpdateListener
Overrides:
scopeUpdated in class SimpleScope

updateFromConfig

protected abstract void updateFromConfig()
Updates the clip from its config.


playSound

protected void playSound(float gain)
Plays the sound.


updateSoundTransform

protected void updateSoundTransform()
Updates the position and direction of the sound.


getSound

protected Sound getSound(String file,
                         Sound sound)
Retrieves the sound corresponding to the specified file.

Parameters:
sound - an existing sound to reuse, if appropriate.

getSound

protected Sound getSound(String file,
                         float gain,
                         float pitch,
                         Sound sound)
Retrieves the sound corresponding to the specified file.

Parameters:
sound - an existing sound to reuse, if appropriate.