APIdia Launch Partner
Top Description Inners Fields Constructors Methods
javax.sound.sampled

public abstract Class EnumControl

extends Control
Class Inheritance

An EnumControl provides control over a set of discrete possible values, each represented by an object. In a graphical user interface, such a control might be represented by a set of buttons, each of which chooses one value or setting. For example, a reverb control might provide several preset reverberation settings, instead of providing continuously adjustable parameters of the sort that would be represented by FloatControl objects.

Controls that provide a choice between only two settings can often be implemented instead as a BooleanControl, and controls that provide a set of values along some quantifiable dimension might be implemented instead as a FloatControl with a coarse resolution. However, a key feature of EnumControl is that the returned values are arbitrary objects, rather than numerical or boolean values. This means that each returned object can provide further information. As an example, the settings of a REVERB control are instances of ReverbType that can be queried for the parameter values used for each setting.

Author
Kara Kytle
Since
1.3

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
EnumControl.Type

An instance of the EnumControl.Type inner class identifies one kind of enumerated control.

Field Summary

Modifier and TypeField and Description
private Object
value

The current value.

private final Object[]
values

The set of possible values.

Constructor Summary

AccessConstructor and Description
protected
EnumControl(EnumControl.Type
the type of control represented this enumerated control object
type
,
Object[]
the set of possible values for the control
values
,
Object
the initial control value
value
)

Constructs a new enumerated control object with the given parameters.

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

the current value
getValue
()

Obtains this control's current value.

public Object[]

Returns:

the set of possible values
getValues
()

Returns the set of possible values for this control.

private boolean

Returns:

true if the value is supported, otherwise false
isValueSupported
(Object
the value for which support is queried
value
)

Indicates whether the value specified is supported.

public void
setValue(Object
the desired new value
value
)

Sets the current value for the control.

public String

Returns:

a string representation of the enumerated control
toString
()

Overrides javax.sound.sampled.Control.toString.

Returns a string representation of the enumerated control.

Inherited from javax.sound.sampled.Control:
getType

Field Detail

valueback to summary
private Object value

The current value.

valuesback to summary
private final Object[] values

The set of possible values.

Constructor Detail

EnumControlback to summary
protected EnumControl(EnumControl.Type type, Object[] values, Object value)

Constructs a new enumerated control object with the given parameters.

Parameters
type:EnumControl.Type

the type of control represented this enumerated control object

values:Object[]

the set of possible values for the control

value:Object

the initial control value

Method Detail

getValueback to summary
public Object getValue()

Obtains this control's current value.

Returns:Object

the current value

getValuesback to summary
public Object[] getValues()

Returns the set of possible values for this control.

Returns:Object[]

the set of possible values

isValueSupportedback to summary
private boolean isValueSupported(Object value)

Indicates whether the value specified is supported.

Parameters
value:Object

the value for which support is queried

Returns:boolean

true if the value is supported, otherwise false

setValueback to summary
public void setValue(Object value)

Sets the current value for the control. The default implementation simply sets the value as indicated. If the value indicated is not supported, an IllegalArgumentException is thrown. Some controls require that their line be open before they can be affected by setting a value.

Parameters
value:Object

the desired new value

Exceptions
IllegalArgumentException:
if the value indicated does not fall within the allowable range
toStringback to summary
public String toString()

Overrides javax.sound.sampled.Control.toString.

Returns a string representation of the enumerated control.

Returns:String

a string representation of the enumerated control

Annotations
@Override
javax.sound.sampled back to summary

public Class EnumControl.Type

extends Type
Class Inheritance

An instance of the EnumControl.Type inner class identifies one kind of enumerated control. Static instances are provided for the common types.
Author
Kara Kytle
Since
1.3
See Also
EnumControl

Field Summary

Modifier and TypeField and Description
public static final EnumControl.Type
REVERB

Represents a control over a set of possible reverberation settings.

Constructor Summary

AccessConstructor and Description
protected
Type(final String
the name of the new enumerated control type
name
)

Constructs a new enumerated control type.

Method Summary

Inherited from javax.sound.sampled.Control.Type:
equalshashCodetoString

Field Detail

REVERBback to summary
public static final EnumControl.Type REVERB

Represents a control over a set of possible reverberation settings. Each reverberation setting is described by an instance of the ReverbType class. (To access these settings, invoke EnumControl#getValues on an enumerated control of type REVERB.)

Constructor Detail

Typeback to summary
protected Type(final String name)

Constructs a new enumerated control type.

Parameters
name:String

the name of the new enumerated control type