APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.media.sound

pack-priv abstract Class AbstractLine

extends Object
implements Line
Class Inheritance
All Implemented Interfaces
javax.sound.sampled.Line, java.lang.AutoCloseable
Known Direct Subclasses
com.sun.media.sound.AbstractMixer, com.sun.media.sound.PortMixer.PortMixerPort, com.sun.media.sound.AbstractDataLine
Imports
java.util.Map, .Vector, .WeakHashMap, javax.sound.sampled.AudioSystem, .Control, .Line, .LineEvent, .LineListener, .LineUnavailableException

AbstractLine
Author
Kara Kytle

Field Summary

Modifier and TypeField and Description
protected Control[]
private static final Map<ThreadGroup, EventDispatcher>
dispatchers

Contains event dispatcher per thread group.

protected final Line.Info
private final Vector<Object>
pack-priv AbstractMixer
private volatile boolean

Constructor Summary

AccessConstructor and Description
protected
AbstractLine(Line.Info info, AbstractMixer
the mixer with which this line is associated
mixer
,
Control[]
set of supported controls
controls
)

Constructs a new AbstractLine.

Method Summary

Modifier and TypeMethod and Description
public final void
addLineListener(LineListener listener)

Implements javax.sound.sampled.Line.addLineListener.

Adds a listener to this line.

public abstract void
close()

Redeclares javax.sound.sampled.Line.close.

Closes the line, indicating that any system resources in use by the line can be released.

public final Control
getControl(Control.Type controlType)

Implements javax.sound.sampled.Line.getControl.

Obtains a control of the specified type, if there is any.

public final Control[]

Returns:

control set
getControls
()

Implements javax.sound.sampled.Line.getControls.

Obtains the set of controls supported by the line.

pack-priv final EventDispatcher
public final int
getFramePosition()

This is an error in the API: getFramePosition should return a long value.

public final Line.Info
getLineInfo()

Implements javax.sound.sampled.Line.getLineInfo.

Obtains the Line.Info object describing this line.

public long
getLongFramePosition()

Return the frame position in a long value This implementation returns AudioSystem.NOT_SPECIFIED.

pack-priv final AbstractMixer
public final boolean
isControlSupported(Control.Type controlType)

Implements javax.sound.sampled.Line.isControlSupported.

Indicates whether the line supports a control of the specified type.

public final boolean
isOpen()

Implements javax.sound.sampled.Line.isOpen.

Indicates whether the line is open, meaning that it has reserved system resources and is operational, although it might not currently be playing or capturing sound.

public abstract void
open()

Redeclares javax.sound.sampled.Line.open.

Opens the line, indicating that it should acquire any required system resources and become operational.

public final void
removeLineListener(LineListener
listener to remove
listener
)

Implements javax.sound.sampled.Line.removeLineListener.

Removes an audio listener.

pack-priv final void
sendEvents(LineEvent event)

Send line events.

pack-priv final void
setOpen(boolean open)

This method sets the open state and generates events if it changes.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

controlsback to summary
protected Control[] controls
dispatchersback to summary
private static final Map<ThreadGroup, EventDispatcher> dispatchers

Contains event dispatcher per thread group.

infoback to summary
protected final Line.Info info
listenersback to summary
private final Vector<Object> listeners
mixerback to summary
pack-priv AbstractMixer mixer
openback to summary
private volatile boolean open

Constructor Detail

AbstractLineback to summary
protected AbstractLine(Line.Info info, AbstractMixer mixer, Control[] controls)

Constructs a new AbstractLine.

Parameters
mixer:AbstractMixer

the mixer with which this line is associated

controls:Control[]

set of supported controls

Method Detail

addLineListenerback to summary
public final void addLineListener(LineListener listener)

Implements javax.sound.sampled.Line.addLineListener.

Doc from javax.sound.sampled.Line.addLineListener.

Adds a listener to this line. Whenever the line's status changes, the listener's update() method is called with a LineEvent object that describes the change.

Annotations
@Override
closeback to summary
public abstract void close()

Redeclares javax.sound.sampled.Line.close.

Doc from javax.sound.sampled.Line.close.

Closes the line, indicating that any system resources in use by the line can be released. If this operation succeeds, the line is marked closed and a CLOSE event is dispatched to the line's listeners.

Annotations
@Override
getControlback to summary
public final Control getControl(Control.Type controlType)

Implements javax.sound.sampled.Line.getControl.

Doc from javax.sound.sampled.Line.getControl.

Obtains a control of the specified type, if there is any. Some controls may only be available when the line is open.

Annotations
@Override
getControlsback to summary
public final Control[] getControls()

Implements javax.sound.sampled.Line.getControls.

Obtains the set of controls supported by the line. If no controls are supported, returns an array of length 0.

Returns:Control[]

control set

Annotations
@Override
getEventDispatcherback to summary
pack-priv final EventDispatcher getEventDispatcher()
getFramePositionback to summary
public final int getFramePosition()

This is an error in the API: getFramePosition should return a long value. At CD quality, the int value wraps around after 13 hours.

getLineInfoback to summary
public final Line.Info getLineInfo()

Implements javax.sound.sampled.Line.getLineInfo.

Doc from javax.sound.sampled.Line.getLineInfo.

Obtains the Line.Info object describing this line.

Annotations
@Override
getLongFramePositionback to summary
public long getLongFramePosition()

Return the frame position in a long value This implementation returns AudioSystem.NOT_SPECIFIED.

getMixerback to summary
pack-priv final AbstractMixer getMixer()
isControlSupportedback to summary
public final boolean isControlSupported(Control.Type controlType)

Implements javax.sound.sampled.Line.isControlSupported.

Doc from javax.sound.sampled.Line.isControlSupported.

Indicates whether the line supports a control of the specified type. Some controls may only be available when the line is open.

Annotations
@Override
isOpenback to summary
public final boolean isOpen()

Implements javax.sound.sampled.Line.isOpen.

Doc from javax.sound.sampled.Line.isOpen.

Indicates whether the line is open, meaning that it has reserved system resources and is operational, although it might not currently be playing or capturing sound.

Annotations
@Override
openback to summary
public abstract void open() throws LineUnavailableException

Redeclares javax.sound.sampled.Line.open.

Doc from javax.sound.sampled.Line.open.

Opens the line, indicating that it should acquire any required system resources and become operational. If this operation succeeds, the line is marked as open, and an OPEN event is dispatched to the line's listeners.

Note that some lines, once closed, cannot be reopened. Attempts to reopen such a line will always result in an LineUnavailableException.

Some types of lines have configurable properties that may affect resource allocation. For example, a DataLine must be opened with a particular format and buffer size. Such lines should provide a mechanism for configuring these properties, such as an additional open method or methods which allow an application to specify the desired settings.

This method takes no arguments, and opens the line with the current settings. For SourceDataLine and TargetDataLine objects, this means that the line is opened with default settings. For a Clip, however, the buffer size is determined when data is loaded. Since this method does not allow the application to specify any data to load, an IllegalArgumentException is thrown. Therefore, you should instead use one of the open methods provided in the Clip interface to load data into the Clip.

For DataLine's, if the DataLine.Info object which was used to retrieve the line, specifies at least one fully qualified audio format, the last one will be used as the default format.

Annotations
@Override
Exceptions
LineUnavailableException:
if the line cannot be opened due to resource restrictions
removeLineListenerback to summary
public final void removeLineListener(LineListener listener)

Implements javax.sound.sampled.Line.removeLineListener.

Removes an audio listener.

Parameters
listener:LineListener

listener to remove

Annotations
@Override
sendEventsback to summary
pack-priv final void sendEvents(LineEvent event)

Send line events.

setOpenback to summary
pack-priv final void setOpen(boolean open)

This method sets the open state and generates events if it changes.