net.sf.freecol.client.gui.sound
Class SoundPlayer

java.lang.Object
  extended by net.sf.freecol.client.gui.sound.SoundPlayer

public class SoundPlayer
extends java.lang.Object

Stripped down class for playing sound.


Nested Class Summary
private  class SoundPlayer.SoundPlayerThread
          Thread for playing sound files.
 
Field Summary
private static java.util.logging.Logger logger
           
private  javax.sound.sampled.Mixer mixer
           
private  SoundPlayer.SoundPlayerThread soundPlayerThread
           
private  int volume
           
 
Constructor Summary
SoundPlayer(AudioMixerOption mixerOption, PercentageOption volumeOption)
          Creates a sound player.
 
Method Summary
 javax.sound.sampled.Mixer getMixer()
          Gets the mixer.
 int getVolume()
          Gets the volume.
 void playOnce(java.io.File file)
          Plays a file once.
private  void setMixer(AudioMixerOption.MixerWrapper mw)
           
private  void setVolume(int volume)
           
 void stop()
          Stops the current sound.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static java.util.logging.Logger logger

mixer

private javax.sound.sampled.Mixer mixer

volume

private int volume

soundPlayerThread

private SoundPlayer.SoundPlayerThread soundPlayerThread
Constructor Detail

SoundPlayer

public SoundPlayer(AudioMixerOption mixerOption,
                   PercentageOption volumeOption)
Creates a sound player.

Parameters:
mixerOption - The option for setting the mixer to use.
volumeOption - The volume option to use when playing audio.
Method Detail

getMixer

public javax.sound.sampled.Mixer getMixer()
Gets the mixer.

Returns:
The current mixer.

setMixer

private void setMixer(AudioMixerOption.MixerWrapper mw)

getVolume

public int getVolume()
Gets the volume.

Returns:
The current volume.

setVolume

private void setVolume(int volume)

playOnce

public void playOnce(java.io.File file)
Plays a file once.

Parameters:
file - The File to be played.

stop

public void stop()
Stops the current sound.