org.jrabbit.standard.game.sound
Class Channel

java.lang.Object
  extended by org.jrabbit.standard.game.sound.Channel
All Implemented Interfaces:
Referenced, ControllableAudio

public class Channel
extends java.lang.Object
implements Referenced, ControllableAudio

A Channel is a referenced object that maintains audio settings. It is used to set general audio and pitch settings for groups of Sounds in the same category.

Author:
Chris Molini

Field Summary
protected  float pitch
          The pitch setting.
protected  java.lang.String reference
          The identifier of this Channel (basically, the name of the category that these audio settings affect).
protected  float volume
          The volume setting.
 
Constructor Summary
Channel(java.lang.String reference)
          Creates a Channel with the indicated name.
Channel(java.lang.String reference, float volume, float pitch)
          Creates a Channel with the indicated name and audio settings.
 
Method Summary
 float pitch()
          Accesses this Channel's audio settings.
 java.lang.String reference()
          Learns this Channel's name.
 void setPitch(float pitch)
          Redefines this Channel's pitch setting.
 void setVolume(float volume)
          Redefines this Channel's volume setting.
 float volume()
          Accesses this Channel's audio settings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

reference

protected java.lang.String reference
The identifier of this Channel (basically, the name of the category that these audio settings affect).


volume

protected float volume
The volume setting. This is a multiplier, not the number of decibels that should be emitted.


pitch

protected float pitch
The pitch setting. Again, this is a multiplier.

Constructor Detail

Channel

public Channel(java.lang.String reference)
Creates a Channel with the indicated name. The volume and pitch settings are set to 1.

Parameters:
reference - The name of the Channel.

Channel

public Channel(java.lang.String reference,
               float volume,
               float pitch)
Creates a Channel with the indicated name and audio settings.

Parameters:
reference - The name of the Channel.
volume - The initial volume setting.
pitch - The initial pitch setting.
Method Detail

reference

public java.lang.String reference()
Learns this Channel's name.

Specified by:
reference in interface Referenced
Returns:
The String that identifies this Channel.

volume

public float volume()
Accesses this Channel's audio settings.

Specified by:
volume in interface ControllableAudio
Returns:
The current volume setting.

setVolume

public void setVolume(float volume)
Redefines this Channel's volume setting. NOTE: This method only takes effect if the supplied value isn't negative.

Specified by:
setVolume in interface ControllableAudio
Parameters:
volume - The new setting for volume.

pitch

public float pitch()
Accesses this Channel's audio settings.

Specified by:
pitch in interface ControllableAudio
Returns:
The current pitch setting.

setPitch

public void setPitch(float pitch)
Redefines this Channel's pitch setting. NOTE: This method only takes effect if the supplied value isn't negative.

Specified by:
setPitch in interface ControllableAudio
Parameters:
pitch - The new setting for pitch.