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

public Interface Mixer

extends Line
Known Direct Implementers
com.sun.media.sound.AbstractMixer, com.sun.media.sound.SoftMixingMixer

A mixer is an audio device with one or more lines. It need not be designed for mixing audio signals. A mixer that actually mixes audio has multiple input (source) lines and at least one output (target) line. The former are often instances of classes that implement SourceDataLine, and the latter, TargetDataLine. Port objects, too, are either source lines or target lines. A mixer can accept prerecorded, loopable sound as input, by having some of its source lines be instances of objects that implement the Clip interface.

Through methods of the Line interface, which Mixer extends, a mixer might provide a set of controls that are global to the mixer. For example, the mixer can have a master gain control. These global controls are distinct from the controls belonging to each of the mixer's individual lines.

Some mixers, especially those with internal digital mixing capabilities, may provide additional capabilities by implementing the DataLine interface.

A mixer can support synchronization of its lines. When one line in a synchronized group is started or stopped, the other lines in the group automatically start or stop simultaneously with the explicitly affected one.

Author
Kara Kytle
Since
1.3

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
Mixer.Info

The Mixer.Info class represents information about an audio mixer, including the product's name, version, and vendor, along with a textual description.

Method Summary

Modifier and TypeMethod and Description
public Line

Returns:

a line that is available for use and that matches the description in the specified Line.Info object
getLine
(Line.Info
describes the desired line
info
)

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

public int

Returns:

the maximum number of matching lines supported, or AudioSystem.NOT_SPECIFIED
getMaxLines
(Line.Info
a Line.Info that describes the line for which the number of supported instances is queried
info
)

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

public Mixer.Info

Returns:

a mixer info object that describes this mixer
getMixerInfo
()

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

public Line.Info[]

Returns:

array of Line.Info objects representing source lines for this mixer. If no source lines are supported, an array of length 0 is returned.
getSourceLineInfo
()

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

public Line.Info[]

Returns:

an array of Line.Info objects describing source lines matching the type requested. If no matching source lines are supported, an array of length 0 is returned.
getSourceLineInfo
(Line.Info
a Line.Info object describing lines about which information is queried
info
)

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

public Line[]

Returns:

the source lines currently open to the mixer. If no source lines are currently open to this mixer, an array of length 0 is returned.
getSourceLines
()

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

public Line.Info[]

Returns:

array of Line.Info objects representing target lines for this mixer. If no target lines are supported, an array of length 0 is returned.
getTargetLineInfo
()

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

public Line.Info[]

Returns:

an array of Line.Info objects describing target lines matching the type requested. If no matching target lines are supported, an array of length 0 is returned.
getTargetLineInfo
(Line.Info
a Line.Info object describing lines about which information is queried
info
)

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

public Line[]

Returns:

target lines currently open from the mixer. If no target lines are currently open from this mixer, an array of length 0 is returned.
getTargetLines
()

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

public boolean

Returns:

true if at least one matching line is supported, false otherwise
isLineSupported
(Line.Info
describes the line for which support is queried
info
)

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

public boolean

Returns:

true if the lines can be synchronized, false otherwise
isSynchronizationSupported
(Line[]
the set of lines for which synchronization support is queried
lines
,
boolean
true if the synchronization must be precisely maintained (i.e., the synchronization must be sample-accurate) at all times during operation of the lines, or false if precise synchronization is required only during start and stop operations
maintainSync
)

Reports whether this mixer supports synchronization of the specified set of lines.

public void
synchronize(Line[]
the lines that should be synchronized
lines
,
boolean
true if the synchronization must be precisely maintained (i.e., the synchronization must be sample-accurate) at all times during operation of the lines, or false if precise synchronization is required only during start and stop operations
maintainSync
)

Synchronizes two or more lines.

public void
unsynchronize(Line[]
the synchronized lines for which synchronization should be released, or null for all this mixer's synchronized lines
lines
)

Releases synchronization for the specified lines.

Inherited from javax.sound.sampled.Line:
addLineListenerclosegetControlgetControlsgetLineInfoisControlSupportedisOpenopenremoveLineListener

Method Detail

getLineback to summary
public Line getLine(Line.Info info) throws LineUnavailableException

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.

Parameters
info:Line.Info

describes the desired line

Returns:Line

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

Exceptions
LineUnavailableException:
if a matching line is not available due to resource restrictions
IllegalArgumentException:
if this mixer does not support any lines matching the description
getMaxLinesback to summary
public int getMaxLines(Line.Info info)

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.

Parameters
info:Line.Info

a Line.Info that describes the line for which the number of supported instances is queried

Returns:int

the maximum number of matching lines supported, or AudioSystem.NOT_SPECIFIED

getMixerInfoback to summary
public Mixer.Info getMixerInfo()

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

Returns:Mixer.Info

a mixer info object that describes this mixer

See Also
Info
getSourceLineInfoback to summary
public Line.Info[] 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.

Returns:Line.Info[]

array of Line.Info objects representing source lines for this mixer. If no source lines are supported, an array of length 0 is returned.

getSourceLineInfoback to summary
public Line.Info[] getSourceLineInfo(Line.Info info)

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.

Parameters
info:Line.Info

a Line.Info object describing lines about which information is queried

Returns:Line.Info[]

an array of Line.Info objects describing source lines matching the type requested. If no matching source lines are supported, an array of length 0 is returned.

getSourceLinesback to summary
public Line[] getSourceLines()

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

Returns:Line[]

the source lines currently open to the mixer. If no source lines are currently open to this mixer, an array of length 0 is returned.

getTargetLineInfoback to summary
public Line.Info[] 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.

Returns:Line.Info[]

array of Line.Info objects representing target lines for this mixer. If no target lines are supported, an array of length 0 is returned.

getTargetLineInfoback to summary
public Line.Info[] getTargetLineInfo(Line.Info info)

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.

Parameters
info:Line.Info

a Line.Info object describing lines about which information is queried

Returns:Line.Info[]

an array of Line.Info objects describing target lines matching the type requested. If no matching target lines are supported, an array of length 0 is returned.

getTargetLinesback to summary
public Line[] getTargetLines()

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

Returns:Line[]

target lines currently open from the mixer. If no target lines are currently open from this mixer, an array of length 0 is returned.

isLineSupportedback to summary
public boolean isLineSupported(Line.Info info)

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.

Parameters
info:Line.Info

describes the line for which support is queried

Returns:boolean

true if at least one matching line is supported, false otherwise

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

Reports whether this mixer supports synchronization of the specified set of lines.

Parameters
lines:Line[]

the set of lines for which synchronization support is queried

maintainSync:boolean

true if the synchronization must be precisely maintained (i.e., the synchronization must be sample-accurate) at all times during operation of the lines, or false if precise synchronization is required only during start and stop operations

Returns:boolean

true if the lines can be synchronized, false otherwise

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

Synchronizes two or more lines. Any subsequent command that starts or stops audio playback or capture for one of these lines will exert the same effect on the other lines in the group, so that they start or stop playing or capturing data simultaneously.

Parameters
lines:Line[]

the lines that should be synchronized

maintainSync:boolean

true if the synchronization must be precisely maintained (i.e., the synchronization must be sample-accurate) at all times during operation of the lines, or false if precise synchronization is required only during start and stop operations

Exceptions
IllegalArgumentException:
if the lines cannot be synchronized. This may occur if the lines are of different types or have different formats for which this mixer does not support synchronization, or if all lines specified do not belong to this mixer.
unsynchronizeback to summary
public void unsynchronize(Line[] lines)

Releases synchronization for the specified lines. The array must be identical to one for which synchronization has already been established; otherwise an exception may be thrown. However, null may be specified, in which case all currently synchronized lines that belong to this mixer are unsynchronized.

Parameters
lines:Line[]

the synchronized lines for which synchronization should be released, or null for all this mixer's synchronized lines

Exceptions
IllegalArgumentException:
if the lines cannot be unsynchronized. This may occur if the argument specified does not exactly match a set of lines for which synchronization has already been established.
javax.sound.sampled back to summary

public Class Mixer.Info

extends Object
Class Inheritance
Known Direct Subclasses
com.sun.media.sound.DirectAudioDeviceProvider.DirectAudioDeviceInfo, com.sun.media.sound.PortMixerProvider.PortMixerInfo, com.sun.media.sound.SoftMixingMixer.Info

The Mixer.Info class represents information about an audio mixer, including the product's name, version, and vendor, along with a textual description. This information may be retrieved through the getMixerInfo method of the Mixer interface.
Author
Kara Kytle
Since
1.3

Field Summary

Modifier and TypeField and Description
private final String
description

Mixer description.

private final String
name

Mixer name.

private final String
vendor

Mixer vendor.

private final String
version

Mixer version.

Constructor Summary

AccessConstructor and Description
protected
Info(String
the name of the mixer
name
,
String
the company who manufactures or creates the hardware or software mixer
vendor
,
String
descriptive text about the mixer
description
,
String
version information for the mixer
version
)

Constructs a mixer's info object, passing it the given textual information.

Method Summary

Modifier and TypeMethod and Description
public final boolean

Returns:

true if the specified object is equal to this info object; false otherwise
equals
(Object
the reference object with which to compare
obj
)

Overrides java.lang.Object.equals.

Indicates whether the specified object is equal to this info object, returning true if the objects are the same.

public final String

Returns:

a textual description of the mixer
getDescription
()

Obtains the description of the mixer.

public final String

Returns:

a string that names the mixer
getName
()

Obtains the name of the mixer.

public final String

Returns:

a string that names the mixer's vendor
getVendor
()

Obtains the vendor of the mixer.

public final String

Returns:

textual version information for the mixer
getVersion
()

Obtains the version of the mixer.

public final int

Returns:

a hash code value for this info object
hashCode
()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this info object.

public final String

Returns:

a string representation of the info object
toString
()

Overrides java.lang.Object.toString.

Returns a string representation of the info object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

descriptionback to summary
private final String description

Mixer description.

nameback to summary
private final String name

Mixer name.

vendorback to summary
private final String vendor

Mixer vendor.

versionback to summary
private final String version

Mixer version.

Constructor Detail

Infoback to summary
protected Info(String name, String vendor, String description, String version)

Constructs a mixer's info object, passing it the given textual information.

Parameters
name:String

the name of the mixer

vendor:String

the company who manufactures or creates the hardware or software mixer

description:String

descriptive text about the mixer

version:String

version information for the mixer

Method Detail

equalsback to summary
public final boolean equals(Object obj)

Overrides java.lang.Object.equals.

Indicates whether the specified object is equal to this info object, returning true if the objects are the same.

Parameters
obj:Object

the reference object with which to compare

Returns:boolean

true if the specified object is equal to this info object; false otherwise

Annotations
@Override
getDescriptionback to summary
public final String getDescription()

Obtains the description of the mixer.

Returns:String

a textual description of the mixer

getNameback to summary
public final String getName()

Obtains the name of the mixer.

Returns:String

a string that names the mixer

getVendorback to summary
public final String getVendor()

Obtains the vendor of the mixer.

Returns:String

a string that names the mixer's vendor

getVersionback to summary
public final String getVersion()

Obtains the version of the mixer.

Returns:String

textual version information for the mixer

hashCodeback to summary
public final int hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this info object.

Returns:int

a hash code value for this info object

Annotations
@Override
toStringback to summary
public final String toString()

Overrides java.lang.Object.toString.

Returns a string representation of the info object.

Returns:String

a string representation of the info object

Annotations
@Override