net.sf.freecol.common.option
Class AudioMixerOption

java.lang.Object
  extended by net.sf.freecol.common.model.FreeColObject
      extended by net.sf.freecol.common.option.AbstractOption<AudioMixerOption.MixerWrapper>
          extended by net.sf.freecol.common.option.AudioMixerOption
All Implemented Interfaces:
Option

public class AudioMixerOption
extends AbstractOption<AudioMixerOption.MixerWrapper>

Option for selecting an audio mixer.

Element MixerWrapper may return a null value in getMixerInfo().
Element MixerWrapper may be null in getValue() (unusual).


Nested Class Summary
static class AudioMixerOption.MixerWrapper
           
 
Field Summary
private static java.util.Comparator<AudioMixerOption.MixerWrapper> audioMixerComparator
           
private static java.util.Map<java.lang.String,AudioMixerOption.MixerWrapper> audioMixers
           
static java.lang.String AUTO
           
private static javax.sound.sampled.Mixer AUTODETECT_MIXER
           
private static AudioMixerOption.MixerWrapper DEFAULT
           
private static java.util.logging.Logger logger
           
private  AudioMixerOption.MixerWrapper value
           
 
Fields inherited from class net.sf.freecol.common.option.AbstractOption
isDefined, previewEnabled
 
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, INFINITY, NO_ID, PARTIAL_ATTRIBUTE, UNDEFINED, VALUE_TAG
 
Constructor Summary
AudioMixerOption(javax.xml.stream.XMLStreamReader in)
          Creates a new AudioMixerOption.
 
Method Summary
private  void findAudioMixers()
          Finds the audioMixers available.
 AudioMixerOption.MixerWrapper[] getOptions()
          Returns a list of the available audioMixers.
 AudioMixerOption.MixerWrapper getValue()
          Get the Value value.
static java.lang.String getXMLElementTagName()
          Gets the tag name of the root element representing this object.
protected  void readAttributes(javax.xml.stream.XMLStreamReader in)
          Reads the attributes of this object from an XML stream.
 void setValue(AudioMixerOption.MixerWrapper newValue)
          Set the Value value.
protected  void setValue(java.lang.String valueString, java.lang.String defaultValueString)
          Sets the value of this Option from the given string representation.
protected  void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
          This method writes an XML-representation of this object to the given stream.
private static javax.sound.sampled.Mixer tryGetDefaultMixer()
           
protected  void writeAttributes(javax.xml.stream.XMLStreamWriter out)
          Write the attributes of this object to a stream.
 
Methods inherited from class net.sf.freecol.common.option.AbstractOption
getGroup, isPreviewEnabled, readFromXMLImpl, setGroup, setPreviewEnabled
 
Methods inherited from class net.sf.freecol.common.model.FreeColObject
addPropertyChangeListener, addPropertyChangeListener, dumpObject, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getId, getPropertyChangeListeners, getPropertyChangeListeners, getSpecification, hasAbility, hasAttribute, hasListeners, readAttributes, readChild, readChild, readChildren, readChildren, readFromArrayElement, readFromArrayElement, readFromListElement, readFromXML, readFromXMLElement, readFromXMLImpl, readFromXMLPartialImpl, removePropertyChangeListener, removePropertyChangeListener, save, save, setId, toXML, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, toXMLPartialImpl, writeAttribute, writeChildren
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.freecol.common.option.Option
addPropertyChangeListener, getId, readFromXML, readFromXMLElement, removePropertyChangeListener, toString, toXML, toXMLElement
 

Field Detail

logger

private static java.util.logging.Logger logger

audioMixers

private static final java.util.Map<java.lang.String,AudioMixerOption.MixerWrapper> audioMixers

AUTO

public static final java.lang.String AUTO

AUTODETECT_MIXER

private static final javax.sound.sampled.Mixer AUTODETECT_MIXER

DEFAULT

private static final AudioMixerOption.MixerWrapper DEFAULT

audioMixerComparator

private static java.util.Comparator<AudioMixerOption.MixerWrapper> audioMixerComparator

value

private AudioMixerOption.MixerWrapper value
Constructor Detail

AudioMixerOption

public AudioMixerOption(javax.xml.stream.XMLStreamReader in)
                 throws javax.xml.stream.XMLStreamException
Creates a new AudioMixerOption.

Parameters:
in - The XMSStreamReader to read the data from
Throws:
javax.xml.stream.XMLStreamException - if an error occurs
Method Detail

tryGetDefaultMixer

private static javax.sound.sampled.Mixer tryGetDefaultMixer()

getValue

public final AudioMixerOption.MixerWrapper getValue()
Get the Value value.

Specified by:
getValue in class AbstractOption<AudioMixerOption.MixerWrapper>
Returns:
a String value

setValue

public final void setValue(AudioMixerOption.MixerWrapper newValue)
Set the Value value.

Specified by:
setValue in class AbstractOption<AudioMixerOption.MixerWrapper>
Parameters:
newValue - The new Value value.

setValue

protected void setValue(java.lang.String valueString,
                        java.lang.String defaultValueString)
Sets the value of this Option from the given string representation. Both parameters must not be null at the same time.

Overrides:
setValue in class AbstractOption<AudioMixerOption.MixerWrapper>
Parameters:
valueString - the string representation of the value of this Option
defaultValueString - the string representation of the default value of this Option

getOptions

public AudioMixerOption.MixerWrapper[] getOptions()
Returns a list of the available audioMixers.

Returns:
The available audioMixers in a human readable format.

findAudioMixers

private void findAudioMixers()
Finds the audioMixers available.


toXMLImpl

protected void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
                  throws javax.xml.stream.XMLStreamException
This method writes an XML-representation of this object to the given stream.

Specified by:
toXMLImpl in class FreeColObject
Parameters:
out - The target stream.
Throws:
javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.

writeAttributes

protected void writeAttributes(javax.xml.stream.XMLStreamWriter out)
                        throws javax.xml.stream.XMLStreamException
Write the attributes of this object to a stream.

Overrides:
writeAttributes in class FreeColObject
Parameters:
out - The target stream.
Throws:
javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.

readAttributes

protected void readAttributes(javax.xml.stream.XMLStreamReader in)
                       throws javax.xml.stream.XMLStreamException
Reads the attributes of this object from an XML stream.

Overrides:
readAttributes in class AbstractOption<AudioMixerOption.MixerWrapper>
Parameters:
in - The XML input stream.
Throws:
javax.xml.stream.XMLStreamException - if a problem was encountered during parsing.

getXMLElementTagName

public static java.lang.String getXMLElementTagName()
Gets the tag name of the root element representing this object.

Returns:
"audioMixerOption".