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

pack-priv abstract Class AbstractMixer

extends AbstractLine
implements Mixer
Class Inheritance
All Implemented Interfaces
javax.sound.sampled.Mixer, javax.sound.sampled.Line, java.lang.AutoCloseable
Known Direct Subclasses
com.sun.media.sound.DirectAudioDevice, com.sun.media.sound.PortMixer
Imports
java.util.ArrayList, .Vector, javax.sound.sampled.Control, .Line, .LineUnavailableException, .Mixer

Abstract Mixer. Implements Mixer (with abstract methods) and specifies some other common methods for use by our implementation.
Author
Kara Kytle

Field Summary

Modifier and TypeField and Description
protected static final int
private boolean
manuallyOpened

if this mixer had been opened manually with open() If it was, then it won't be closed automatically, only when close() is called manually.

private final Mixer.Info
mixerInfo

Info object describing this mixer.

protected static final int
protected Line.Info[]
sourceLineInfo

source lines provided by this mixer

private final Vector<Line>
sourceLines

Source lines (ports) currently open.

private boolean
started

if any line of this mixer is started

protected Line.Info[]
targetLineInfo

target lines provided by this mixer

private final Vector<Line>
targetLines

Target lines currently open.

protected static final int
Inherited from com.sun.media.sound.AbstractLine:
controlsinfomixer

Constructor Summary

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

Constructs a new AbstractMixer.

Method Summary

Modifier and TypeMethod and Description
pack-priv final synchronized void
close(Line line)

Removes this line from the list of open source lines and open target lines, if it exists in either.

public final synchronized void
close()

Implements abstract com.sun.media.sound.AbstractLine.close.

Implements javax.sound.sampled.Line.close.

Close all lines and then close this mixer.

public abstract Line
getLine(Line.Info info)

Redeclares javax.sound.sampled.Mixer.getLine.

Obtains a line that is available for use and that matches the description in the specified Line.Info object.

pack-priv final Line.Info
getLineInfo(Line.Info info)

Returns the first complete Line.Info object it finds that matches the one specified, or null if no matching Line.Info object is found.

public abstract int
getMaxLines(Line.Info info)

Redeclares javax.sound.sampled.Mixer.getMaxLines.

Obtains the approximate maximum number of lines of the requested type that can be open simultaneously on the mixer.

public final Mixer.Info
getMixerInfo()

Implements javax.sound.sampled.Mixer.getMixerInfo.

Obtains information about this mixer, including the product's name, version, vendor, etc.

public final Line.Info[]
getSourceLineInfo()

Implements javax.sound.sampled.Mixer.getSourceLineInfo.

Obtains information about the set of source lines supported by this mixer.

public final Line.Info[]
getSourceLineInfo(Line.Info info)

Implements javax.sound.sampled.Mixer.getSourceLineInfo.

Obtains information about source lines of a particular type supported by the mixer.

public final Line[]
getSourceLines()

Implements javax.sound.sampled.Mixer.getSourceLines.

Obtains the set of all source lines currently open to this mixer.

public final Line.Info[]
getTargetLineInfo()

Implements javax.sound.sampled.Mixer.getTargetLineInfo.

Obtains information about the set of target lines supported by this mixer.

public final Line.Info[]
getTargetLineInfo(Line.Info info)

Implements javax.sound.sampled.Mixer.getTargetLineInfo.

Obtains information about target lines of a particular type supported by the mixer.

public final Line[]
getTargetLines()

Implements javax.sound.sampled.Mixer.getTargetLines.

Obtains the set of all target lines currently open from this mixer.

protected abstract void
protected abstract void
protected abstract void
protected abstract void
public final boolean
isLineSupported(Line.Info info)

Implements javax.sound.sampled.Mixer.isLineSupported.

Indicates whether the mixer supports a line (or lines) that match the specified Line.Info object.

pack-priv final boolean
isSourceLine(Line.Info info)

Determines whether this is a source line for this mixer.

public final boolean
isSynchronizationSupported(Line[] lines, boolean maintainSync)

Implements javax.sound.sampled.Mixer.isSynchronizationSupported.

Default implementation always returns false.

pack-priv final boolean
isTargetLine(Line.Info info)

Determines whether this is a target line for this mixer.

public final synchronized void
open()

Implements abstract com.sun.media.sound.AbstractLine.open.

Implements javax.sound.sampled.Line.open.

This implementation tries to open the mixer with its current format and buffer size settings.

pack-priv final synchronized void
open(boolean manual)

This implementation tries to open the mixer with its current format and buffer size settings.

pack-priv final synchronized void
open(Line line)

The default implementation of this method just determines whether this line is a source or target line, calls open(no-arg) on the mixer, and adds the line to the appropriate vector.

pack-priv final synchronized void
start(Line line)

Starts the mixer.

pack-priv final synchronized void
stop(Line line)

Stops the mixer if this was the last running line.

public final void
synchronize(Line[] lines, boolean maintainSync)

Implements javax.sound.sampled.Mixer.synchronize.

Default implementation always throws an exception.

public final void
unsynchronize(Line[] lines)

Implements javax.sound.sampled.Mixer.unsynchronize.

Default implementation always throws an exception.

Inherited from com.sun.media.sound.AbstractLine:
addLineListenergetControlgetControlsgetEventDispatchergetFramePositiongetLineInfogetLongFramePositiongetMixerisControlSupportedisOpenremoveLineListenersendEventssetOpen

Field Detail

ALAWback to summary
protected static final int ALAW
manuallyOpenedback to summary
private boolean manuallyOpened

if this mixer had been opened manually with open() If it was, then it won't be closed automatically, only when close() is called manually.

mixerInfoback to summary
private final Mixer.Info mixerInfo

Info object describing this mixer.

PCMback to summary
protected static final int PCM
sourceLineInfoback to summary
protected Line.Info[] sourceLineInfo

source lines provided by this mixer

sourceLinesback to summary
private final Vector<Line> sourceLines

Source lines (ports) currently open.

startedback to summary
private boolean started

if any line of this mixer is started

targetLineInfoback to summary
protected Line.Info[] targetLineInfo

target lines provided by this mixer

targetLinesback to summary
private final Vector<Line> targetLines

Target lines currently open.

ULAWback to summary
protected static final int ULAW

Constructor Detail

AbstractMixerback to summary
protected AbstractMixer(Mixer.Info mixerInfo, Control[] controls, Line.Info[] sourceLineInfo, Line.Info[] targetLineInfo)

Constructs a new AbstractMixer.

Parameters
mixerInfo:Mixer.Info

the mixer with which this line is associated

controls:Control[]

set of supported controls

Method Detail

closeback to summary
pack-priv final synchronized void close(Line line)

Removes this line from the list of open source lines and open target lines, if it exists in either. If the list is now empty, closes the mixer.

closeback to summary
public final synchronized void close()

Implements abstract com.sun.media.sound.AbstractLine.close.

Implements javax.sound.sampled.Line.close.

Close all lines and then close this mixer.

Annotations
@Override
getLineback to summary
public abstract Line getLine(Line.Info info) throws LineUnavailableException

Redeclares javax.sound.sampled.Mixer.getLine.

Doc from javax.sound.sampled.Mixer.getLine.

Obtains a line that is available for use and that matches the description in the specified Line.Info object.

If a DataLine is requested, and info is an instance of DataLine.Info specifying at least one fully qualified audio format, the last one will be used as the default format of the returned DataLine.

Annotations
@Override
Exceptions
LineUnavailableException:
if a matching line is not available due to resource restrictions
getLineInfoback to summary
pack-priv final Line.Info getLineInfo(Line.Info info)

Returns the first complete Line.Info object it finds that matches the one specified, or null if no matching Line.Info object is found.

getMaxLinesback to summary
public abstract int getMaxLines(Line.Info info)

Redeclares javax.sound.sampled.Mixer.getMaxLines.

Doc from javax.sound.sampled.Mixer.getMaxLines.

Obtains the approximate maximum number of lines of the requested type that can be open simultaneously on the mixer.

Certain types of mixers do not have a hard bound and may allow opening more lines. Since certain lines are a shared resource, a mixer may not be able to open the maximum number of lines if another process has opened lines of this mixer.

The requested type is any line that matches the description in the provided Line.Info object. For example, if the info object represents a speaker port, and the mixer supports exactly one speaker port, this method should return 1. If the info object represents a source data line and the mixer supports the use of 32 source data lines simultaneously, the return value should be 32. If there is no limit, this function returns AudioSystem#NOT_SPECIFIED.

Annotations
@Override
getMixerInfoback to summary
public final Mixer.Info getMixerInfo()

Implements javax.sound.sampled.Mixer.getMixerInfo.

Doc from javax.sound.sampled.Mixer.getMixerInfo.

Obtains information about this mixer, including the product's name, version, vendor, etc.

Annotations
@Override
getSourceLineInfoback to summary
public final Line.Info[] getSourceLineInfo()

Implements javax.sound.sampled.Mixer.getSourceLineInfo.

Doc from javax.sound.sampled.Mixer.getSourceLineInfo.

Obtains information about the set of source lines supported by this mixer. Some source lines may only be available when this mixer is open.

Annotations
@Override
getSourceLineInfoback to summary
public final Line.Info[] getSourceLineInfo(Line.Info info)

Implements javax.sound.sampled.Mixer.getSourceLineInfo.

Doc from javax.sound.sampled.Mixer.getSourceLineInfo.

Obtains information about source lines of a particular type supported by the mixer. Some source lines may only be available when this mixer is open.

Annotations
@Override
getSourceLinesback to summary
public final Line[] getSourceLines()

Implements javax.sound.sampled.Mixer.getSourceLines.

Doc from javax.sound.sampled.Mixer.getSourceLines.

Obtains the set of all source lines currently open to this mixer.

Annotations
@Override
getTargetLineInfoback to summary
public final Line.Info[] getTargetLineInfo()

Implements javax.sound.sampled.Mixer.getTargetLineInfo.

Doc from javax.sound.sampled.Mixer.getTargetLineInfo.

Obtains information about the set of target lines supported by this mixer. Some target lines may only be available when this mixer is open.

Annotations
@Override
getTargetLineInfoback to summary
public final Line.Info[] getTargetLineInfo(Line.Info info)

Implements javax.sound.sampled.Mixer.getTargetLineInfo.

Doc from javax.sound.sampled.Mixer.getTargetLineInfo.

Obtains information about target lines of a particular type supported by the mixer. Some target lines may only be available when this mixer is open.

Annotations
@Override
getTargetLinesback to summary
public final Line[] getTargetLines()

Implements javax.sound.sampled.Mixer.getTargetLines.

Doc from javax.sound.sampled.Mixer.getTargetLines.

Obtains the set of all target lines currently open from this mixer.

Annotations
@Override
implCloseback to summary
protected abstract void implClose()
implOpenback to summary
protected abstract void implOpen() throws LineUnavailableException
implStartback to summary
protected abstract void implStart()
implStopback to summary
protected abstract void implStop()
isLineSupportedback to summary
public final boolean isLineSupported(Line.Info info)

Implements javax.sound.sampled.Mixer.isLineSupported.

Doc from javax.sound.sampled.Mixer.isLineSupported.

Indicates whether the mixer supports a line (or lines) that match the specified Line.Info object. Some lines may only be supported when this mixer is open.

Annotations
@Override
isSourceLineback to summary
pack-priv final boolean isSourceLine(Line.Info info)

Determines whether this is a source line for this mixer. Right now this just checks whether it's supported, but should check whether it actually belongs to this mixer....

isSynchronizationSupportedback to summary
public final boolean isSynchronizationSupported(Line[] lines, boolean maintainSync)

Implements javax.sound.sampled.Mixer.isSynchronizationSupported.

Default implementation always returns false.

Annotations
@Override
isTargetLineback to summary
pack-priv final boolean isTargetLine(Line.Info info)

Determines whether this is a target line for this mixer. Right now this just checks whether it's supported, but should check whether it actually belongs to this mixer....

openback to summary
public final synchronized void open() throws LineUnavailableException

Implements abstract com.sun.media.sound.AbstractLine.open.

Implements javax.sound.sampled.Line.open.

This implementation tries to open the mixer with its current format and buffer size settings.

Annotations
@Override
Exceptions
LineUnavailableException:

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

if the line cannot be opened due to resource restrictions

openback to summary
pack-priv final synchronized void open(boolean manual) throws LineUnavailableException

This implementation tries to open the mixer with its current format and buffer size settings.

openback to summary
pack-priv final synchronized void open(Line line) throws LineUnavailableException

The default implementation of this method just determines whether this line is a source or target line, calls open(no-arg) on the mixer, and adds the line to the appropriate vector. The mixer may be opened at a format different than the line's format if it is a DataLine.

startback to summary
pack-priv final synchronized void start(Line line)

Starts the mixer.

stopback to summary
pack-priv final synchronized void stop(Line line)

Stops the mixer if this was the last running line.

synchronizeback to summary
public final void synchronize(Line[] lines, boolean maintainSync)

Implements javax.sound.sampled.Mixer.synchronize.

Default implementation always throws an exception.

Annotations
@Override
unsynchronizeback to summary
public final void unsynchronize(Line[] lines)

Implements javax.sound.sampled.Mixer.unsynchronize.

Default implementation always throws an exception.

Annotations
@Override