com.threerings.openal
Class Sounder.Conditional

java.lang.Object
  extended by com.threerings.expr.SimpleScope
      extended by com.threerings.openal.Sounder.Implementation
          extended by com.threerings.openal.Sounder.Conditional
All Implemented Interfaces:
Scope, ScopeUpdateListener
Enclosing class:
Sounder

public static class Sounder.Conditional
extends Sounder.Implementation

Plays the first sounder whose condition evaluates to true.


Field Summary
protected  SounderConfig.Conditional _config
          The sounder configuration.
protected  Sounder _defaultSounder
          The default sounder.
protected  BooleanExpression.Evaluator[] _evaluators
          The case evaluators.
protected  Sounder _sounder
          The currently playing sounder, if any.
protected  Sounder[] _sounders
          The case sounders.
 
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.Conditional(AlContext ctx, Scope parentScope, SounderConfig.Conditional config)
          Creates a new conditional implementation.
 
Method Summary
 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(SounderConfig.Conditional config)
          (Re)configures the implementation.
 void start()
          Starts playing the sound.
 void stop()
          Stops the sound.
 void update()
          Updates the sound.
protected  void updateFromConfig()
          Updates the sounder from its configuration.
 
Methods inherited from class com.threerings.openal.Sounder.Implementation
dispose, getScopeName
 
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.Conditional _config
The sounder configuration.


_evaluators

protected BooleanExpression.Evaluator[] _evaluators
The case evaluators.


_sounders

protected Sounder[] _sounders
The case sounders.


_defaultSounder

protected Sounder _defaultSounder
The default sounder.


_sounder

protected Sounder _sounder
The currently playing sounder, if any.

Constructor Detail

Sounder.Conditional

public Sounder.Conditional(AlContext ctx,
                           Scope parentScope,
                           SounderConfig.Conditional config)
Creates a new conditional implementation.

Method Detail

setConfig

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


loops

public boolean loops()
Description copied from class: Sounder.Implementation
Checks whether the configured sound loops.

Overrides:
loops in class Sounder.Implementation

start

public void start()
Description copied from class: Sounder.Implementation
Starts playing the sound.

Specified by:
start in class Sounder.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 void updateFromConfig()
Updates the sounder from its configuration.