java.lang.Object | |
↳ | com.sun.media.sound.SoftSynthesizer |
The software synthesizer class.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
SoftSynthesizer.WeakAudioStream |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | INFO_DESCRIPTION | ||||||||||
String | INFO_NAME | ||||||||||
String | INFO_VENDOR | ||||||||||
String | INFO_VERSION |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
agc_on | |||||||||||
channels | |||||||||||
chorus_on | |||||||||||
control_mutex | |||||||||||
external_channels | |||||||||||
info | |||||||||||
load_default_soundbank | |||||||||||
reverb_light | |||||||||||
reverb_on | |||||||||||
voiceIDCounter | |||||||||||
voice_allocation_mode | |||||||||||
weakstream |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Closes the device, indicating that the device should now release
any system resources it is using.
| |||||||||||
Obtains a list of instruments that come with the synthesizer.
| |||||||||||
Obtains the set of MIDI channels controlled by this synthesizer.
| |||||||||||
Obtains the default soundbank for the synthesizer, if one exists.
| |||||||||||
Obtains information about the device, including its Java class and
Strings containing its name, vendor, and description. | |||||||||||
Obtains the current format (encoding, sample rate, number of channels,
etc.) of the synthesizer audio data.
| |||||||||||
Obtains the processing latency incurred by this synthesizer, expressed in
microseconds.
| |||||||||||
Obtains a list of the instruments that are currently loaded onto this
Synthesizer . | |||||||||||
Obtains the maximum number of notes that this synthesizer can sound simultaneously.
| |||||||||||
Obtains the maximum number of MIDI IN connections available on this
MIDI device for receiving MIDI data.
| |||||||||||
Obtains the maximum number of MIDI OUT connections available on this
MIDI device for transmitting MIDI data.
| |||||||||||
Obtains the current time-stamp of the device, in microseconds.
| |||||||||||
Gets information about the possible properties for the synthesizer.
| |||||||||||
Obtains a MIDI IN receiver through which the MIDI device may receive
MIDI data.
| |||||||||||
Retrieve a Receiver that opens the device implicitly.
| |||||||||||
Returns all currently active, non-closed receivers
connected with this MidiDevice.
| |||||||||||
Obtains a MIDI OUT connection from which the MIDI device will transmit
MIDI data The returned transmitter must be closed when the application
has finished using it.
| |||||||||||
Retrieve a Transmitter that opens the device implicitly.
| |||||||||||
Returns all currently active, non-closed transmitters
connected with this MidiDevice.
| |||||||||||
Obtains the current status of the voices produced by this synthesizer.
| |||||||||||
Reports whether the device is open.
| |||||||||||
Informs the caller whether this synthesizer is capable of loading
instruments from the specified soundbank.
| |||||||||||
Loads onto the
Synthesizer all instruments contained
in the specified Soundbank . | |||||||||||
Makes a particular instrument available for synthesis.
| |||||||||||
Loads the instruments referenced by the specified patches, from the
specified
Soundbank . | |||||||||||
Opens the device, indicating that it should now acquire any
system resources it requires and become operational.
| |||||||||||
Opens the synthesizer and starts rendering audio into
SourceDataLine . | |||||||||||
Opens the synthesizer and renders audio into returned
AudioInputStream . | |||||||||||
Remaps an instrument.
| |||||||||||
Unloads all instruments contained in the specified
Soundbank . | |||||||||||
Unloads a particular instrument.
| |||||||||||
Unloads the instruments referenced by the specified patches, from the MIDI sound bank specified.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() |
Closes the device, indicating that the device should now release any system resources it is using.
All Receiver
and Transmitter
instances
open from this device are closed. This includes instances retrieved
via MidiSystem
.
Obtains a list of instruments that come with the synthesizer. These instruments might be built into the synthesizer, or they might be part of a default soundbank provided with the synthesizer, etc.
Note that you don't use this method to find out which instruments are
currently loaded onto the synthesizer; for that purpose, you use
getLoadedInstruments()
.
Nor does the method indicate all the instruments that can be loaded onto
the synthesizer; it only indicates the subset that come with the synthesizer.
To learn whether another instrument can be loaded, you can invoke
isSoundbankSupported()
, and if the instrument's
Soundbank
is supported, you can try loading the instrument.
Obtains the set of MIDI channels controlled by this synthesizer. Each
non-null element in the returned array is a MidiChannel
that
receives the MIDI messages sent on that channel number.
The MIDI 1.0 specification provides for 16 channels, so this
method returns an array of at least 16 elements. However, if this synthesizer
doesn't make use of all 16 channels, some of the elements of the array
might be null
, so you should check each element
before using it.
MidiChannel
objects managed by this
Synthesizer
. Some of the array elements may be null
.
Obtains the default soundbank for the synthesizer, if one exists. (Some synthesizers provide a default or built-in soundbank.) If a synthesizer doesn't have a default soundbank, instruments must be loaded explicitly from an external soundbank.
null
if one does not exist.Obtains information about the device, including its Java class and
Strings
containing its name, vendor, and description.
Obtains the current format (encoding, sample rate, number of channels, etc.) of the synthesizer audio data.
If the synthesizer is not open and has never been opened, it returns the default format.
Obtains the processing latency incurred by this synthesizer, expressed in microseconds. This latency measures the worst-case delay between the time a MIDI message is delivered to the synthesizer and the time that the synthesizer actually produces the corresponding result.
Although the latency is expressed in microseconds, a synthesizer's actual measured delay may vary over a wider range than this resolution suggests. For example, a synthesizer might have a worst-case delay of a few milliseconds or more.
Obtains a list of the instruments that are currently loaded onto this
Synthesizer
.
Obtains the maximum number of notes that this synthesizer can sound simultaneously.
Obtains the maximum number of MIDI IN connections available on this MIDI device for receiving MIDI data.
Obtains the maximum number of MIDI OUT connections available on this MIDI device for transmitting MIDI data.
Obtains the current time-stamp of the device, in microseconds. If a device supports time-stamps, it should start counting at 0 when the device is opened and continue incrementing its time-stamp in microseconds until the device is closed. If it does not support time-stamps, it should always return -1.
Gets information about the possible properties for the synthesizer.
info | a proposed list of tag/value pairs that will be sent on open. |
---|
AudioSynthesizerPropertyInfo
objects
describing possible properties. This array may be an empty array if
no properties are required.
Obtains a MIDI IN receiver through which the MIDI device may receive MIDI data. The returned receiver must be closed when the application has finished using it.
Obtaining a Receiver
with this method does not
open the device. To be able to use the device, it has to be
opened explicitly by calling open()
. Also, closing the
Receiver
does not close the device. It has to be
closed explicitly by calling close()
.
MidiUnavailableException |
---|
Retrieve a Receiver that opens the device implicitly. This method is similar to MidiDevice.getReceiver(). However, by calling this one, the device is opened implicitly. This is needed by MidiSystem.getReceiver().
MidiUnavailableException |
---|
Returns all currently active, non-closed receivers connected with this MidiDevice. A receiver can be removed from the device by closing it.
Obtains a MIDI OUT connection from which the MIDI device will transmit MIDI data The returned transmitter must be closed when the application has finished using it.
Obtaining a Transmitter
with this method does not
open the device. To be able to use the device, it has to be
opened explicitly by calling open()
. Also, closing the
Transmitter
does not close the device. It has to be
closed explicitly by calling close()
.
MidiUnavailableException |
---|
Retrieve a Transmitter that opens the device implicitly. This method is similar to MidiDevice.getTransmitter(). However, by calling this one, the device is opened implicitly. This is needed by MidiSystem.getTransmitter().
MidiUnavailableException |
---|
Returns all currently active, non-closed transmitters connected with this MidiDevice. A transmitter can be removed from the device by closing it.
Obtains the current status of the voices produced by this synthesizer.
If this class of Synthesizer
does not provide voice
information, the returned array will always be of length 0. Otherwise,
its length is always equal to the total number of voices, as returned by
getMaxPolyphony()
. (See the VoiceStatus
class
description for an explanation of synthesizer voices.)
VoiceStatus
objects that supply
information about the corresponding synthesizer voicesReports whether the device is open.
true
if the device is open, otherwise
false
Informs the caller whether this synthesizer is capable of loading
instruments from the specified soundbank.
If the soundbank is unsupported, any attempts to load instruments from
it will result in an IllegalArgumentException
.
soundbank | soundbank for which support is queried |
---|
true
if the soundbank is supported, otherwise false
Loads onto the Synthesizer
all instruments contained
in the specified Soundbank
.
soundbank | the Soundbank whose are instruments are
to be loaded |
---|
true
if the instruments are all successfully loaded (or
already had been), false
if any instrument could not be
loaded (for example, if the Synthesizer
had insufficient memory)Makes a particular instrument available for synthesis. This instrument
is loaded into the patch location specified by its Patch
object, so that if a program-change message is
received (or has been received) that causes that patch to be selected,
subsequent notes will be played using the sound of
instrument
. If the specified instrument is already loaded,
this method does nothing and returns true
.
The instrument must be part of a soundbank
that this Synthesizer
supports. (To make sure, you can use
the getSoundbank
method of Instrument
and the
isSoundbankSupported
method of Synthesizer
.)
instrument | instrument to load |
---|
true
if the instrument is successfully loaded (or
already had been), false
if the instrument could not be
loaded (for example, if the synthesizer has insufficient
memory to load it)Loads the instruments referenced by the specified patches, from the
specified Soundbank
. Each of the Patch
objects
indicates a bank and program number; the Instrument
that
has the matching Patch
is loaded into that bank and program
location.
soundbank | the Soundbank containing the instruments to load |
---|---|
patchList | list of patches for which instruments should be loaded |
true
if the instruments are all successfully loaded (or
already had been), false
if any instrument could not be
loaded (for example, if the Synthesizer
had insufficient memory)Opens the device, indicating that it should now acquire any system resources it requires and become operational.
An application opening a device explicitly with this call
has to close the device by calling close()
. This is
necessary to release system resources and allow applications to
exit cleanly.
Note that some devices, once closed, cannot be reopened. Attempts to reopen such a device will always result in a MidiUnavailableException.
MidiUnavailableException |
---|
Opens the synthesizer and starts rendering audio into
SourceDataLine
.
An application opening a synthesizer explicitly with this call
has to close the synthesizer by calling close()
. This is
necessary to release system resources and allow applications to
exit cleanly.
Note that some synthesizers, once closed, cannot be reopened.
Attempts to reopen such a synthesizer will always result in
a MidiUnavailableException
.
line | which AudioSynthesizer writes output audio into.
If line is null, then line from system default mixer is used. |
---|---|
info | a Map object containing
properties for additional configuration supported by synthesizer.
If info is null then default settings are used. |
MidiUnavailableException |
---|
Opens the synthesizer and renders audio into returned
AudioInputStream
.
An application opening a synthesizer explicitly with this call
has to close the synthesizer by calling close()
. This is
necessary to release system resources and allow applications to
exit cleanly.
Note that some synthesizers, once closed, cannot be reopened.
Attempts to reopen such a synthesizer will always result in
a MidiUnavailableException
.
targetFormat | specifies the AudioFormat
used in returned AudioInputStream . |
---|---|
info | a Map object containing
properties for additional configuration supported by synthesizer.
If info is null then default settings are used. |
MidiUnavailableException |
---|
Remaps an instrument. Instrument to
takes the
place of instrument from
.
For example, if from
was located at bank number 2,
program number 11, remapping causes that bank and program location
to be occupied instead by to
.
If the function succeeds, instrument from
is unloaded.
To cancel the remapping reload instrument from
by
invoking one of loadInstrument(Instrument)
, loadInstruments(Soundbank, Patch[])
or loadAllInstruments(Soundbank)
.
from | the Instrument object to be replaced |
---|---|
to | the Instrument object to be used in place
of the old instrument, it should be loaded into the synthesizer |
true
if the instrument succeessfully remapped,
false
if feature is not implemented by synthesizerUnloads all instruments contained in the specified Soundbank
.
soundbank | soundbank containing instruments to unload |
---|
Unloads a particular instrument.
instrument | instrument to unload |
---|
Unloads the instruments referenced by the specified patches, from the MIDI sound bank specified.
soundbank | soundbank containing instruments to unload |
---|---|
patchList | list of patches for which instruments should be unloaded |