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

public abstract Class BooleanControl

extends Control
Class Inheritance
Known Direct Subclasses
com.sun.media.sound.DirectAudioDevice.DirectDL.Mute, com.sun.media.sound.PortMixer.BoolCtrl, com.sun.media.sound.SoftMixingDataLine.Mute, com.sun.media.sound.SoftMixingDataLine.ApplyReverb

A BooleanControl provides the ability to switch between two possible settings that affect a line's audio. The settings are boolean values (true and false). A graphical user interface might represent the control by a two-state button, an on/off switch, two mutually exclusive buttons, or a checkbox (among other possibilities). For example, depressing a button might activate a MUTE control to silence the line's audio.

As with other Control subclasses, a method is provided that returns string labels for the values, suitable for display in the user interface.

Author
Kara Kytle
Since
1.3

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
BooleanControl.Type

An instance of the BooleanControl.Type class identifies one kind of boolean control.

Field Summary

Modifier and TypeField and Description
private final String
falseStateLabel

The false state label, such as "false" or "off".

private final String
trueStateLabel

The true state label, such as "true" or "on".

private boolean
value

The current value.

Constructor Summary

AccessConstructor and Description
protected
BooleanControl(BooleanControl.Type
the type of control represented this float control object
type
,
boolean
the initial control value
initialValue
,
String
the label for the state represented by true, such as "true" or "on"
trueStateLabel
,
String
the label for the state represented by false, such as "false" or "off"
falseStateLabel
)

Constructs a new boolean control object with the given parameters.

protected
BooleanControl(BooleanControl.Type
the type of control represented by this float control object
type
,
boolean
the initial control value
initialValue
)

Constructs a new boolean control object with the given parameters.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the label for the specified state, such as "true" or "on" for true, or "false" or "off" for false
getStateLabel
(boolean
the state whose label will be returned
state
)

Obtains the label for the specified state.

public boolean

Returns:

current value
getValue
()

Obtains this control's current value.

public void
setValue(boolean
desired new value
value
)

Sets the current value for the control.

public String

Returns:

a string representation of the boolean control
toString
()

Overrides javax.sound.sampled.Control.toString.

Returns a string representation of the boolean control.

Inherited from javax.sound.sampled.Control:
getType

Field Detail

falseStateLabelback to summary
private final String falseStateLabel

The false state label, such as "false" or "off".

trueStateLabelback to summary
private final String trueStateLabel

The true state label, such as "true" or "on".

valueback to summary
private boolean value

The current value.

Constructor Detail

BooleanControlback to summary
protected BooleanControl(BooleanControl.Type type, boolean initialValue, String trueStateLabel, String falseStateLabel)

Constructs a new boolean control object with the given parameters.

Parameters
type:BooleanControl.Type

the type of control represented this float control object

initialValue:boolean

the initial control value

trueStateLabel:String

the label for the state represented by true, such as "true" or "on"

falseStateLabel:String

the label for the state represented by false, such as "false" or "off"

BooleanControlback to summary
protected BooleanControl(BooleanControl.Type type, boolean initialValue)

Constructs a new boolean control object with the given parameters. The labels for the true and false states default to "true" and "false".

Parameters
type:BooleanControl.Type

the type of control represented by this float control object

initialValue:boolean

the initial control value

Method Detail

getStateLabelback to summary
public String getStateLabel(boolean state)

Obtains the label for the specified state.

Parameters
state:boolean

the state whose label will be returned

Returns:String

the label for the specified state, such as "true" or "on" for true, or "false" or "off" for false

getValueback to summary
public boolean getValue()

Obtains this control's current value.

Returns:boolean

current value

setValueback to summary
public void setValue(boolean value)

Sets the current value for the control. The default implementation simply sets the value as indicated. Some controls require that their line be open before they can be affected by setting a value.

Parameters
value:boolean

desired new value

toStringback to summary
public String toString()

Overrides javax.sound.sampled.Control.toString.

Returns a string representation of the boolean control.

Returns:String

a string representation of the boolean control

Annotations
@Override
javax.sound.sampled back to summary

public Class BooleanControl.Type

extends Type
Class Inheritance
Known Direct Subclasses
com.sun.media.sound.PortMixer.BoolCtrl.BCT

An instance of the BooleanControl.Type class identifies one kind of boolean control. Static instances are provided for the common types.
Author
Kara Kytle
Since
1.3

Field Summary

Modifier and TypeField and Description
public static final BooleanControl.Type
APPLY_REVERB

Represents a control for whether reverberation is applied to a line.

public static final BooleanControl.Type
MUTE

Represents a control for the mute status of a line.

Constructor Summary

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

Constructs a new boolean control type.

Method Summary

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

Field Detail

APPLY_REVERBback to summary
public static final BooleanControl.Type APPLY_REVERB

Represents a control for whether reverberation is applied to a line. Note that the status of this control not affect the reverberation settings for a line, but does affect whether these settings are used.

MUTEback to summary
public static final BooleanControl.Type MUTE

Represents a control for the mute status of a line. Note that mute status does not affect gain.

Constructor Detail

Typeback to summary
protected Type(final String name)

Constructs a new boolean control type.

Parameters
name:String

the name of the new boolean control type