com.threerings.openal
Class Sounder

java.lang.Object
  extended by com.threerings.expr.SimpleScope
      extended by com.threerings.openal.Sounder
All Implemented Interfaces:
ConfigUpdateListener<SounderConfig>, Scope, ScopeUpdateListener

public class Sounder
extends SimpleScope
implements ConfigUpdateListener<SounderConfig>

Plays a sound.


Nested Class Summary
static class Sounder.BaseClip
          Base class for Sounder.BaseClip, Sounder.MetaClip, and Sounder.VariableClip.
static class Sounder.BaseStream
          Base class for Sounder.BaseStream and Sounder.MetaStream.
static class Sounder.Clip
          Plays a sound clip.
static class Sounder.Compound
          Plays several sub-sounders at once.
static class Sounder.Conditional
          Plays the first sounder whose condition evaluates to true.
static class Sounder.Implementation
          The actual sounder implementation.
static class Sounder.MetaClip
          Plays a randomly selected clip.
static class Sounder.MetaStream
          Selects from a number of streams.
static class Sounder.Random
          Plays the first sounder whose condition evaluates to true.
static class Sounder.Scripted
          Plays a scripted sequence of sounders.
static class Sounder.Sequential
          Plays multiple sub-sounders in sequence.
static class Sounder.Stream
          Plays a sound stream.
static class Sounder.VariableClip
          Plays a clip with variable parameters.
 
Field Summary
 
Fields inherited from interface com.threerings.expr.Scope
EPOCH, NOW
 
Constructor Summary
Sounder(AlContext ctx, Scope parentScope, Transform3D transform)
          Creates a new sounder with a null configuration.
Sounder(AlContext ctx, Scope parentScope, Transform3D transform, ConfigReference<SounderConfig> ref)
          Creates a new sounder with the referenced configuration.
Sounder(AlContext ctx, Scope parentScope, Transform3D transform, SounderConfig config)
          Creates a new sounder with the given configuration.
 
Method Summary
 void configUpdated(ConfigEvent<SounderConfig> event)
          Called when a configuration has been updated.
 void dispose()
          Releases the resources associated with this scope.
 String getScopeName()
          Returns the name of this scope for purposes of qualification.
 boolean isPlaying()
          Checks whether the sound is currently playing.
 boolean loops()
          Checks whether the configured sound loops.
 void scopeUpdated(ScopeEvent event)
          Called when the scope has been updated.
 void setConfig(ConfigReference<SounderConfig> ref)
          Sets the configuration of this sounder.
 void setConfig(SounderConfig config)
          Sets the configuration of this sounder.
 void start()
          Starts playing the sound.
 void stop()
          Stops playing the sound.
 void update()
          Updates the sound for the current frame.
 
Methods inherited from class com.threerings.expr.SimpleScope
addListener, get, getParentScope, removeListener
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sounder

public Sounder(AlContext ctx,
               Scope parentScope,
               Transform3D transform)
Creates a new sounder with a null configuration.

Parameters:
transform - a reference to the sound transform to use.

Sounder

public Sounder(AlContext ctx,
               Scope parentScope,
               Transform3D transform,
               ConfigReference<SounderConfig> ref)
Creates a new sounder with the referenced configuration.

Parameters:
transform - a reference to the sound transform to use.

Sounder

public Sounder(AlContext ctx,
               Scope parentScope,
               Transform3D transform,
               SounderConfig config)
Creates a new sounder with the given configuration.

Parameters:
transform - a reference to the sound transform to use.
Method Detail

setConfig

public void setConfig(ConfigReference<SounderConfig> ref)
Sets the configuration of this sounder.


setConfig

public void setConfig(SounderConfig config)
Sets the configuration of this sounder.


loops

public boolean loops()
Checks whether the configured sound loops.


start

public void start()
Starts playing the sound.


stop

public void stop()
Stops playing the sound.


isPlaying

public boolean isPlaying()
Checks whether the sound is currently playing.


update

public void update()
Updates the sound for the current frame. Invocation of this method is not guaranteed; in particular, while ViewerEffectConfig.Sound calls this method, ActionConfig.PlaySound does not.


configUpdated

public void configUpdated(ConfigEvent<SounderConfig> event)
Description copied from interface: ConfigUpdateListener
Called when a configuration has been updated.

Specified by:
configUpdated in interface ConfigUpdateListener<SounderConfig>

getScopeName

public String getScopeName()
Description copied from interface: Scope
Returns the name of this scope for purposes of qualification. Can return null if qualified symbols cannot specifically address this scope.

Specified by:
getScopeName in interface Scope
Overrides:
getScopeName in class SimpleScope

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

dispose

public void dispose()
Description copied from class: SimpleScope
Releases the resources associated with this scope.

Overrides:
dispose in class SimpleScope


Copyright © 2011. All Rights Reserved.