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

public final Class SoftSynthesizer

extends Object
implements AudioSynthesizer, ReferenceCountingDevice
Class Inheritance
All Implemented Interfaces
com.sun.media.sound.ReferenceCountingDevice, com.sun.media.sound.AudioSynthesizer, javax.sound.midi.Synthesizer, javax.sound.midi.MidiDevice, java.lang.AutoCloseable
Imports
sun.awt.OSInfo, java.io.BufferedInputStream, .File, .FileInputStream, .FileNotFoundException, .FileOutputStream, .IOException, .InputStream, .OutputStream, java.lang.ref.WeakReference, java.util.ArrayList, .Arrays, .HashMap, .List, .Map, .Properties, .StringTokenizer, java.util.prefs.BackingStoreException, .Preferences, javax.sound.midi.Instrument, .MidiChannel, .MidiDevice, .MidiSystem, .MidiUnavailableException, .Patch, .Receiver, .Soundbank, .Transmitter, .VoiceStatus, javax.sound.sampled.AudioFormat, .AudioInputStream, .AudioSystem, .LineUnavailableException, .SourceDataLine

The software synthesizer class.
Author
Karl Helgason

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
pack-priv static interface
protected static class

Field Summary

Modifier and TypeField and Description
pack-priv boolean
pack-priv SoftChannel[]
pack-priv boolean
pack-priv final Object
private float
private static Soundbank
private int
pack-priv SoftChannelProxy[]
private AudioFormat
private int
private boolean
pack-priv static final MidiDevice.Info
pack-priv static final String
pack-priv static final String
pack-priv static final String
pack-priv static final String
private final Map<String, SoftInstrument>
private boolean
private boolean
private long
pack-priv boolean
private final Map<String, ModelInstrument>
private SoftMainMixer
private int
private int
private boolean
private SoftAudioPusher
private AudioInputStream
private final ArrayList<Receiver>
private SoftResampler
private String
pack-priv boolean
pack-priv boolean
private SourceDataLine
private static SourceDataLine
private final Map<String, SoftTuning>
pack-priv int
pack-priv int
private SoftVoice[]
pack-priv SoftSynthesizer.WeakAudioStream

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements javax.sound.midi.MidiDevice.close.

Closes the device, indicating that the device should now release any system resources it is using.

pack-priv SoftInstrument
findInstrument(int program, int bank, int channel)

public Instrument[]
getAvailableInstruments()

Implements javax.sound.midi.Synthesizer.getAvailableInstruments.

Obtains a list of instruments that come with the synthesizer.

private void
public MidiChannel[]
getChannels()

Implements javax.sound.midi.Synthesizer.getChannels.

Obtains the set of MIDI channels controlled by this synthesizer.

pack-priv float
public Soundbank
getDefaultSoundbank()

Implements javax.sound.midi.Synthesizer.getDefaultSoundbank.

Obtains the default soundbank for the synthesizer, if one exists.

pack-priv int
public MidiDevice.Info
getDeviceInfo()

Implements javax.sound.midi.MidiDevice.getDeviceInfo.

Obtains information about the device, including its Java class and Strings containing its name, vendor, and description.

public AudioFormat
getFormat()

Implements com.sun.media.sound.AudioSynthesizer.getFormat.

Obtains the current format (encoding, sample rate, number of channels, etc.) of the synthesizer audio data.

pack-priv int
public long
getLatency()

Implements javax.sound.midi.Synthesizer.getLatency.

Obtains the processing latency incurred by this synthesizer, expressed in microseconds.

public Instrument[]
getLoadedInstruments()

Implements javax.sound.midi.Synthesizer.getLoadedInstruments.

Obtains a list of the instruments that are currently loaded onto this Synthesizer.

pack-priv SoftMainMixer
public int
getMaxPolyphony()

Implements javax.sound.midi.Synthesizer.getMaxPolyphony.

Obtains the maximum number of notes that this synthesizer can sound simultaneously.

public int
getMaxReceivers()

Implements javax.sound.midi.MidiDevice.getMaxReceivers.

Obtains the maximum number of MIDI IN connections available on this MIDI device for receiving MIDI data.

public int
getMaxTransmitters()

Implements javax.sound.midi.MidiDevice.getMaxTransmitters.

Obtains the maximum number of MIDI OUT connections available on this MIDI device for transmitting MIDI data.

public long
getMicrosecondPosition()

Implements javax.sound.midi.MidiDevice.getMicrosecondPosition.

Obtains the current time-stamp of the device, in microseconds.

public AudioSynthesizerPropertyInfo[]
getPropertyInfo(Map<String, Object> info)

Implements com.sun.media.sound.AudioSynthesizer.getPropertyInfo.

Gets information about the possible properties for the synthesizer.

public Receiver
getReceiver()

Implements javax.sound.midi.MidiDevice.getReceiver.

Obtains a MIDI IN receiver through which the MIDI device may receive MIDI data.

public Receiver
getReceiverReferenceCounting()

Implements com.sun.media.sound.ReferenceCountingDevice.getReceiverReferenceCounting.

Retrieve a Receiver that opens the device implicitly.

public List<Receiver>
getReceivers()

Implements javax.sound.midi.MidiDevice.getReceivers.

Returns all currently active, non-closed receivers connected with this MidiDevice.

private Properties
public Transmitter
getTransmitter()

Implements javax.sound.midi.MidiDevice.getTransmitter.

Obtains a MIDI OUT connection from which the MIDI device will transmit MIDI data.

public Transmitter
getTransmitterReferenceCounting()

Implements com.sun.media.sound.ReferenceCountingDevice.getTransmitterReferenceCounting.

Retrieve a Transmitter that opens the device implicitly.

public List<Transmitter>
getTransmitters()

Implements javax.sound.midi.MidiDevice.getTransmitters.

Returns all currently active, non-closed transmitters connected with this MidiDevice.

pack-priv SoftTuning
pack-priv int
pack-priv SoftVoice[]
public VoiceStatus[]
getVoiceStatus()

Implements javax.sound.midi.Synthesizer.getVoiceStatus.

Obtains the current status of the voices produced by this synthesizer.

public boolean
isOpen()

Implements javax.sound.midi.MidiDevice.isOpen.

Reports whether the device is open.

public boolean
isSoundbankSupported(Soundbank soundbank)

Implements javax.sound.midi.Synthesizer.isSoundbankSupported.

Informs the caller whether this synthesizer is capable of loading instruments from the specified soundbank.

public boolean
loadAllInstruments(Soundbank soundbank)

Implements javax.sound.midi.Synthesizer.loadAllInstruments.

Loads onto the Synthesizer all instruments contained in the specified Soundbank.

public boolean
loadInstrument(Instrument instrument)

Implements javax.sound.midi.Synthesizer.loadInstrument.

Makes a particular instrument available for synthesis.

private boolean
public boolean
loadInstruments(Soundbank soundbank, Patch[] patchList)

Implements javax.sound.midi.Synthesizer.loadInstruments.

Loads the instruments referenced by the specified patches, from the specified Soundbank.

private boolean
public void
open()

Implements javax.sound.midi.MidiDevice.open.

Opens the device, indicating that it should now acquire any system resources it requires and become operational.

public void
open(SourceDataLine line, Map<String, Object> info)

Implements com.sun.media.sound.AudioSynthesizer.open.

Opens the synthesizer and starts rendering audio into SourceDataLine.

public AudioInputStream
openStream(AudioFormat targetFormat, Map<String, Object> info)

Implements com.sun.media.sound.AudioSynthesizer.openStream.

Opens the synthesizer and renders audio into returned AudioInputStream.

private String
private void
public boolean
pack-priv void
private void
pack-priv void
setGeneralMidiMode(int gmmode)

public void
unloadAllInstruments(Soundbank soundbank)

Implements javax.sound.midi.Synthesizer.unloadAllInstruments.

Unloads all instruments contained in the specified Soundbank.

public void
unloadInstrument(Instrument instrument)

Implements javax.sound.midi.Synthesizer.unloadInstrument.

Unloads a particular instrument.

public void
unloadInstruments(Soundbank soundbank, Patch[] patchList)

Implements javax.sound.midi.Synthesizer.unloadInstruments.

Unloads the instruments referenced by the specified patches, from the MIDI sound bank specified.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

agc_onback to summary
pack-priv boolean agc_on
channelsback to summary
pack-priv SoftChannel[] channels
chorus_onback to summary
pack-priv boolean chorus_on
control_mutexback to summary
pack-priv final Object control_mutex
controlrateback to summary
private float controlrate
defaultSoundBankback to summary
private static Soundbank defaultSoundBank
deviceidback to summary
private int deviceid
external_channelsback to summary
pack-priv SoftChannelProxy[] external_channels
formatback to summary
private AudioFormat format
gmmodeback to summary
private int gmmode
implicitOpenback to summary
private boolean implicitOpen
infoback to summary
pack-priv static final MidiDevice.Info info
INFO_DESCRIPTIONback to summary
pack-priv static final String INFO_DESCRIPTION
INFO_NAMEback to summary
pack-priv static final String INFO_NAME
INFO_VENDORback to summary
pack-priv static final String INFO_VENDOR
INFO_VERSIONback to summary
pack-priv static final String INFO_VERSION
inslistback to summary
private final Map<String, SoftInstrument> inslist
jitter_correctionback to summary
private boolean jitter_correction
largemodeback to summary
private boolean largemode
latencyback to summary
private long latency
load_default_soundbankback to summary
pack-priv boolean load_default_soundbank
loadedlistback to summary
private final Map<String, ModelInstrument> loadedlist
mainmixerback to summary
private SoftMainMixer mainmixer
maxpolyback to summary
private int maxpoly
number_of_midi_channelsback to summary
private int number_of_midi_channels
openback to summary
private boolean open
pusherback to summary
private SoftAudioPusher pusher
pusher_streamback to summary
private AudioInputStream pusher_stream
recvslistback to summary
private final ArrayList<Receiver> recvslist
resamplerback to summary
private SoftResampler resampler
resamplerTypeback to summary
private String resamplerType
reverb_lightback to summary
pack-priv boolean reverb_light
reverb_onback to summary
pack-priv boolean reverb_on
sourceDataLineback to summary
private SourceDataLine sourceDataLine
testlineback to summary
private static SourceDataLine testline
tuningsback to summary
private final Map<String, SoftTuning> tunings
voice_allocation_modeback to summary
pack-priv int voice_allocation_mode
voiceIDCounterback to summary
pack-priv int voiceIDCounter
voicesback to summary
private SoftVoice[] voices
weakstreamback to summary
pack-priv SoftSynthesizer.WeakAudioStream weakstream

Constructor Detail

SoftSynthesizerback to summary
public SoftSynthesizer()

Method Detail

closeback to summary
public void close()

Implements javax.sound.midi.MidiDevice.close.

Doc from javax.sound.midi.MidiDevice.close.

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.

Annotations
@Override
findInstrumentback to summary
pack-priv SoftInstrument findInstrument(int program, int bank, int channel)
getAvailableInstrumentsback to summary
public Instrument[] getAvailableInstruments()

Implements javax.sound.midi.Synthesizer.getAvailableInstruments.

Doc from javax.sound.midi.Synthesizer.getAvailableInstruments.

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.

Annotations
@Override
getBuffersback to summary
private void getBuffers(ModelInstrument instrument, List<ModelByteBuffer> buffers)
getChannelsback to summary
public MidiChannel[] getChannels()

Implements javax.sound.midi.Synthesizer.getChannels.

Doc from javax.sound.midi.Synthesizer.getChannels.

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.

Annotations
@Override
getControlRateback to summary
pack-priv float getControlRate()
getDefaultSoundbankback to summary
public Soundbank getDefaultSoundbank()

Implements javax.sound.midi.Synthesizer.getDefaultSoundbank.

Doc from javax.sound.midi.Synthesizer.getDefaultSoundbank.

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.

Annotations
@Override
getDeviceIDback to summary
pack-priv int getDeviceID()
getDeviceInfoback to summary
public MidiDevice.Info getDeviceInfo()

Implements javax.sound.midi.MidiDevice.getDeviceInfo.

Doc from javax.sound.midi.MidiDevice.getDeviceInfo.

Obtains information about the device, including its Java class and Strings containing its name, vendor, and description.

Annotations
@Override
getFormatback to summary
public AudioFormat getFormat()

Implements com.sun.media.sound.AudioSynthesizer.getFormat.

Doc from com.sun.media.sound.AudioSynthesizer.getFormat.

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.

Annotations
@Override
getGeneralMidiModeback to summary
pack-priv int getGeneralMidiMode()
getLatencyback to summary
public long getLatency()

Implements javax.sound.midi.Synthesizer.getLatency.

Doc from javax.sound.midi.Synthesizer.getLatency.

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.

Annotations
@Override
getLoadedInstrumentsback to summary
public Instrument[] getLoadedInstruments()

Implements javax.sound.midi.Synthesizer.getLoadedInstruments.

Doc from javax.sound.midi.Synthesizer.getLoadedInstruments.

Obtains a list of the instruments that are currently loaded onto this Synthesizer.

Annotations
@Override
getMainMixerback to summary
pack-priv SoftMainMixer getMainMixer()
getMaxPolyphonyback to summary
public int getMaxPolyphony()

Implements javax.sound.midi.Synthesizer.getMaxPolyphony.

Doc from javax.sound.midi.Synthesizer.getMaxPolyphony.

Obtains the maximum number of notes that this synthesizer can sound simultaneously.

Annotations
@Override
getMaxReceiversback to summary
public int getMaxReceivers()

Implements javax.sound.midi.MidiDevice.getMaxReceivers.

Doc from javax.sound.midi.MidiDevice.getMaxReceivers.

Obtains the maximum number of MIDI IN connections available on this MIDI device for receiving MIDI data.

Annotations
@Override
getMaxTransmittersback to summary
public int getMaxTransmitters()

Implements javax.sound.midi.MidiDevice.getMaxTransmitters.

Doc from javax.sound.midi.MidiDevice.getMaxTransmitters.

Obtains the maximum number of MIDI OUT connections available on this MIDI device for transmitting MIDI data.

Annotations
@Override
getMicrosecondPositionback to summary
public long getMicrosecondPosition()

Implements javax.sound.midi.MidiDevice.getMicrosecondPosition.

Doc from javax.sound.midi.MidiDevice.getMicrosecondPosition.

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.

Annotations
@Override
getPropertyInfoback to summary
public AudioSynthesizerPropertyInfo[] getPropertyInfo(Map<String, Object> info)

Implements com.sun.media.sound.AudioSynthesizer.getPropertyInfo.

Doc from com.sun.media.sound.AudioSynthesizer.getPropertyInfo.

Gets information about the possible properties for the synthesizer.

Annotations
@Override
getReceiverback to summary
public Receiver getReceiver() throws MidiUnavailableException

Implements javax.sound.midi.MidiDevice.getReceiver.

Doc from javax.sound.midi.MidiDevice.getReceiver.

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.

Usually the returned receiver implements the MidiDeviceReceiver interface.

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.

Annotations
@Override
Exceptions
MidiUnavailableException:
thrown if a receiver is not available due to resource restrictions
getReceiverReferenceCountingback to summary
public Receiver getReceiverReferenceCounting() throws MidiUnavailableException

Implements com.sun.media.sound.ReferenceCountingDevice.getReceiverReferenceCounting.

Doc from com.sun.media.sound.ReferenceCountingDevice.getReceiverReferenceCounting.

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().

Annotations
@Override
getReceiversback to summary
public List<Receiver> getReceivers()

Implements javax.sound.midi.MidiDevice.getReceivers.

Doc from javax.sound.midi.MidiDevice.getReceivers.

Returns all currently active, non-closed receivers connected with this MidiDevice. A receiver can be removed from the device by closing it.

Usually the returned receivers implement the MidiDeviceReceiver interface.

Annotations
@Override
getStoredPropertiesback to summary
private Properties getStoredProperties()
getTransmitterback to summary
public Transmitter getTransmitter() throws MidiUnavailableException

Implements javax.sound.midi.MidiDevice.getTransmitter.

Doc from javax.sound.midi.MidiDevice.getTransmitter.

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.

Usually the returned transmitter implements the MidiDeviceTransmitter interface.

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.

Annotations
@Override
Exceptions
MidiUnavailableException:
thrown if a transmitter is not available due to resource restrictions
getTransmitterReferenceCountingback to summary
public Transmitter getTransmitterReferenceCounting() throws MidiUnavailableException

Implements com.sun.media.sound.ReferenceCountingDevice.getTransmitterReferenceCounting.

Doc from com.sun.media.sound.ReferenceCountingDevice.getTransmitterReferenceCounting.

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().

Annotations
@Override
getTransmittersback to summary
public List<Transmitter> getTransmitters()

Implements javax.sound.midi.MidiDevice.getTransmitters.

Doc from javax.sound.midi.MidiDevice.getTransmitters.

Returns all currently active, non-closed transmitters connected with this MidiDevice. A transmitter can be removed from the device by closing it.

Usually the returned transmitters implement the MidiDeviceTransmitter interface.

Annotations
@Override
getTuningback to summary
pack-priv SoftTuning getTuning(Patch patch)
getVoiceAllocationModeback to summary
pack-priv int getVoiceAllocationMode()
getVoicesback to summary
pack-priv SoftVoice[] getVoices()
getVoiceStatusback to summary
public VoiceStatus[] getVoiceStatus()

Implements javax.sound.midi.Synthesizer.getVoiceStatus.

Doc from javax.sound.midi.Synthesizer.getVoiceStatus.

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.)

Annotations
@Override
isOpenback to summary
public boolean isOpen()

Implements javax.sound.midi.MidiDevice.isOpen.

Doc from javax.sound.midi.MidiDevice.isOpen.

Reports whether the device is open.

Annotations
@Override
isSoundbankSupportedback to summary
public boolean isSoundbankSupported(Soundbank soundbank)

Implements javax.sound.midi.Synthesizer.isSoundbankSupported.

Doc from javax.sound.midi.Synthesizer.isSoundbankSupported.

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.

Annotations
@Override
loadAllInstrumentsback to summary
public boolean loadAllInstruments(Soundbank soundbank)

Implements javax.sound.midi.Synthesizer.loadAllInstruments.

Doc from javax.sound.midi.Synthesizer.loadAllInstruments.

Loads onto the Synthesizer all instruments contained in the specified Soundbank.

Annotations
@Override
loadInstrumentback to summary
public boolean loadInstrument(Instrument instrument)

Implements javax.sound.midi.Synthesizer.loadInstrument.

Doc from javax.sound.midi.Synthesizer.loadInstrument.

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.)

Annotations
@Override
loadInstrumentsback to summary
private boolean loadInstruments(List<ModelInstrument> instruments)
loadInstrumentsback to summary
public boolean loadInstruments(Soundbank soundbank, Patch[] patchList)

Implements javax.sound.midi.Synthesizer.loadInstruments.

Doc from javax.sound.midi.Synthesizer.loadInstruments.

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.

Annotations
@Override
loadSamplesback to summary
private boolean loadSamples(List<ModelInstrument> instruments)
openback to summary
public void open() throws MidiUnavailableException

Implements javax.sound.midi.MidiDevice.open.

Doc from javax.sound.midi.MidiDevice.open.

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.

Annotations
@Override
Exceptions
MidiUnavailableException:
thrown if the device cannot be opened due to resource restrictions
openback to summary
public void open(SourceDataLine line, Map<String, Object> info) throws MidiUnavailableException

Implements com.sun.media.sound.AudioSynthesizer.open.

Doc from com.sun.media.sound.AudioSynthesizer.open.

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.

Annotations
@Override
Exceptions
MidiUnavailableException:
thrown if the synthesizer cannot be opened due to resource restrictions.
openStreamback to summary
public AudioInputStream openStream(AudioFormat targetFormat, Map<String, Object> info) throws MidiUnavailableException

Implements com.sun.media.sound.AudioSynthesizer.openStream.

Doc from com.sun.media.sound.AudioSynthesizer.openStream.

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.

Annotations
@Override
Exceptions
MidiUnavailableException:
thrown if the synthesizer cannot be opened due to resource restrictions.
patchToStringback to summary
private String patchToString(Patch patch)
processPropertyInfoback to summary
private void processPropertyInfo(Map<String, Object> info)
remapInstrumentback to summary
public boolean remapInstrument(Instrument from, Instrument to)

Implements javax.sound.midi.Synthesizer.remapInstrument.

Doc from javax.sound.midi.Synthesizer.remapInstrument.

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, loadInstruments or loadAllInstruments.

Annotations
@Override
removeReceiverback to summary
pack-priv void removeReceiver(Receiver recv)
setFormatback to summary
private void setFormat(AudioFormat format)
setGeneralMidiModeback to summary
pack-priv void setGeneralMidiMode(int gmmode)
unloadAllInstrumentsback to summary
public void unloadAllInstruments(Soundbank soundbank)

Implements javax.sound.midi.Synthesizer.unloadAllInstruments.

Doc from javax.sound.midi.Synthesizer.unloadAllInstruments.

Unloads all instruments contained in the specified Soundbank.

Annotations
@Override
unloadInstrumentback to summary
public void unloadInstrument(Instrument instrument)

Implements javax.sound.midi.Synthesizer.unloadInstrument.

Doc from javax.sound.midi.Synthesizer.unloadInstrument.

Unloads a particular instrument.

Annotations
@Override
unloadInstrumentsback to summary
public void unloadInstruments(Soundbank soundbank, Patch[] patchList)

Implements javax.sound.midi.Synthesizer.unloadInstruments.

Doc from javax.sound.midi.Synthesizer.unloadInstruments.

Unloads the instruments referenced by the specified patches, from the MIDI sound bank specified.

Annotations
@Override
com.sun.media.sound back to summary

private Class SoftSynthesizer.Info

extends Info
Class Inheritance

Constructor Summary

AccessConstructor and Description
pack-priv
Info()

Method Summary

Inherited from javax.sound.midi.MidiDevice.Info:
equalsgetDescriptiongetNamegetVendorgetVersionhashCodetoString

Constructor Detail

Infoback to summary
pack-priv Info()
com.sun.media.sound back to summary

pack-priv Interface SoftSynthesizer.RunnableAction<T>


Method Summary

Modifier and TypeMethod and Description
public T
run()

Method Detail

runback to summary
public T run()
com.sun.media.sound back to summary

protected final Class SoftSynthesizer.WeakAudioStream

extends InputStream
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final AudioFloatConverter
private int
public AudioInputStream
public SoftAudioPusher
private final int
public volatile long
private float[]
public SourceDataLine
private volatile AudioInputStream
private final WeakReference<AudioInputStream>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public int
available()

Overrides java.io.InputStream.available.

Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking, which may be 0, or 0 when end of stream is detected.

public void
close()

Overrides java.io.InputStream.close.

Implements java.io.Closeable.close.

Closes this input stream and releases any system resources associated with the stream.

public AudioInputStream
public int
read()

Implements abstract java.io.InputStream.read.

Reads the next byte of data from the input stream.

public int
read(byte[] b, int off, int len)

Overrides java.io.InputStream.read.

Reads up to len bytes of data from the input stream into an array of bytes.

public void
Inherited from java.io.InputStream:
markmarkSupportednullInputStreamreadreadAllBytesreadNBytesreadNBytesresetskipskipNBytestransferTo

Field Detail

converterback to summary
private final AudioFloatConverter converter
framesizeback to summary
private int framesize
jitter_streamback to summary
public AudioInputStream jitter_stream
pusherback to summary
public SoftAudioPusher pusher
samplesizeback to summary
private final int samplesize
silent_samplesback to summary
public volatile long silent_samples
silentbufferback to summary
private float[] silentbuffer
sourceDataLineback to summary
public SourceDataLine sourceDataLine
streamback to summary
private volatile AudioInputStream stream

Constructor Detail

WeakAudioStreamback to summary
public WeakAudioStream(AudioInputStream stream)

Method Detail

availableback to summary
public int available() throws IOException

Overrides java.io.InputStream.available.

Doc from java.io.InputStream.available.

Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking, which may be 0, or 0 when end of stream is detected. The read might be on the same thread or another thread. A single read or skip of this many bytes will not block, but may read or skip fewer bytes.

Note that while some implementations of InputStream will return the total number of bytes in the stream, many will not. It is never correct to use the return value of this method to allocate a buffer intended to hold all data in this stream.

A subclass's implementation of this method may choose to throw an IOException if this input stream has been closed by invoking the close() method.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
closeback to summary
public void close() throws IOException

Overrides java.io.InputStream.close.

Implements java.io.Closeable.close.

Doc from java.io.InputStream.close.

Closes this input stream and releases any system resources associated with the stream.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
getAudioInputStreamback to summary
public AudioInputStream getAudioInputStream()
readback to summary
public int read() throws IOException

Implements abstract java.io.InputStream.read.

Doc from java.io.InputStream.read.

Reads the next byte of data from the input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
readback to summary
public int read(byte[] b, int off, int len) throws IOException

Overrides java.io.InputStream.read.

Doc from java.io.InputStream.read.

Reads up to len bytes of data from the input stream into an array of bytes. An attempt is made to read as many as len bytes, but a smaller number may be read. The number of bytes actually read is returned as an integer.

This method blocks until input data is available, end of file is detected, or an exception is thrown.

If len is zero, then no bytes are read and 0 is returned; otherwise, there is an attempt to read at least one byte. If no byte is available because the stream is at end of file, the value -1 is returned; otherwise, at least one byte is read and stored into b.

The first byte read is stored into element b[off], the next one into b[off+1], and so on. The number of bytes read is, at most, equal to len. Let k be the number of bytes actually read; these bytes will be stored in elements b[off] through b[off+k-1], leaving elements b[off+k] through b[off+len-1] unaffected.

In every case, elements b[0] through b[off-1] and elements b[off+len] through b[b.length-1] are unaffected.

Annotations
@Override
Exceptions
IOException:
If the first byte cannot be read for any reason other than end of file, or if the input stream has been closed, or if some other I/O error occurs.
setInputStreamback to summary
public void setInputStream(AudioInputStream stream)