org.ocap.hardware.device
Class OCSound

java.lang.Object
  extended by org.havi.ui.HSound
      extended by org.ocap.hardware.device.OCSound

public class OCSound
extends HSound

Extends the HAVi HSound class, adding additional configuration options. Instances of this class provide control over audio gain level, muting, and output ports.

See Also:
AudioOutputPort

Constructor Summary
OCSound()
          Creates an OCSound object.
 
Method Summary
 void addAudioOutput(AudioOutputPort au)
          Add an AudioOutputPort to the set of audio output ports where this clip will be played.
 AudioOutputPort[] getAudioOutputs()
          Get the audio output ports on which this audio clip would be played.
 float getLevel()
          Get the current gain set for this OCSound as a value between 0.0 and 1.0.
 boolean isMuted()
          Get the mute state of the audio signal associated with this audio clip.
 void removeAudioOutput(AudioOutputPort au)
          Remove an AudioOutputPort from the set of audio ouput ports where this clip will be played.
 float setLevel(float level)
          Set the gain using a floating point scale with values between 0.0 and 1.0.
 void setMuted(boolean mute)
          Mute or unmute the signal associated with this OCSound.
 
Methods inherited from class org.havi.ui.HSound
dispose, load, load, loop, play, set, stop
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OCSound

public OCSound()
Creates an OCSound object. The following defaults apply upon construction:
Attribute Method Default
Level getLevel() 1.0
Mute isMuted() false
Outputs getAudioOutputs() the default audio output for the application constructing the OCSound instance

Method Detail

setLevel

public float setLevel(float level)
Set the gain using a floating point scale with values between 0.0 and 1.0. 0.0 is silence; 1.0 is the loudest level for associated audio output ports.

Parameters:
level - The new gain value specified in the level scale.
Returns:
The level that was actually set.
See Also:
getLevel(), AudioOutputPort.setLevel(float), AudioOutputPort.getLevel()

getLevel

public float getLevel()
Get the current gain set for this OCSound as a value between 0.0 and 1.0.

Returns:
The gain in the level scale (0.0-1.0).
See Also:
setLevel(float)

isMuted

public boolean isMuted()
Get the mute state of the audio signal associated with this audio clip.

Returns:
The current mute state: true if muted and false otherwise.
See Also:
setMuted(boolean)

setMuted

public void setMuted(boolean mute)
Mute or unmute the signal associated with this OCSound. Redundant invocations of this method are ignored. The mute state does not effect the gain (as represented by getLevel().

Parameters:
mute - The new mute state: true mutes the signal and false unmutes the signal.
See Also:
isMuted()

getAudioOutputs

public AudioOutputPort[] getAudioOutputs()
Get the audio output ports on which this audio clip would be played. By default, audio-clips will be played on the default audio output port for the application that created this OCSound. Unless AudioOutputPorts have been removed by calling removeAudioOutput, this method SHALL return the at least the default AudioOutputPort for the application. Unless AudioOutputPorts have been added by calling addAudioOutput, this method SHALL return at most the default AudioOutputPort for the application.

Returns:
The set of target AudioOutputPorts as an array. If all ports have been removed, then an empty array SHALL be returned.
See Also:
addAudioOutput(org.ocap.hardware.device.AudioOutputPort), removeAudioOutput(org.ocap.hardware.device.AudioOutputPort)

addAudioOutput

public void addAudioOutput(AudioOutputPort au)
Add an AudioOutputPort to the set of audio output ports where this clip will be played.

Redundant additions SHALL have no effect.

Parameters:
au - The AudioOutputPort to add.

removeAudioOutput

public void removeAudioOutput(AudioOutputPort au)
Remove an AudioOutputPort from the set of audio ouput ports where this clip will be played.

Attempting to remove an AudioOutputPort that is not currently in the set of audio output ports for this OCSound SHALL have no effect.

Parameters:
au - The AudioOutputPort to remove.