public interface AudioSynthesizer
extends javax.sound.midi.Synthesizer
AudioSynthesizer
is a Synthesizer
which renders it's output audio into SourceDataLine
or AudioInputStream
.MidiSystem#getSynthesizer
,
Synthesizer
Modifier and Type | Method and Description |
---|---|
javax.sound.sampled.AudioFormat |
getFormat()
Obtains the current format (encoding, sample rate, number of channels,
etc.) of the synthesizer audio data.
|
AudioSynthesizerPropertyInfo[] |
getPropertyInfo(java.util.Map<java.lang.String,java.lang.Object> info)
Gets information about the possible properties for the synthesizer.
|
void |
open(javax.sound.sampled.SourceDataLine line,
java.util.Map<java.lang.String,java.lang.Object> info)
Opens the synthesizer and starts rendering audio into
SourceDataLine . |
javax.sound.sampled.AudioInputStream |
openStream(javax.sound.sampled.AudioFormat targetFormat,
java.util.Map<java.lang.String,java.lang.Object> info)
Opens the synthesizer and renders audio into returned
AudioInputStream . |
getAvailableInstruments, getChannels, getDefaultSoundbank, getLatency, getLoadedInstruments, getMaxPolyphony, getVoiceStatus, isSoundbankSupported, loadAllInstruments, loadInstrument, loadInstruments, remapInstrument, unloadAllInstruments, unloadInstrument, unloadInstruments
javax.sound.sampled.AudioFormat getFormat()
If the synthesizer is not open and has never been opened, it returns the default format.
AudioFormat
AudioSynthesizerPropertyInfo[] getPropertyInfo(java.util.Map<java.lang.String,java.lang.Object> info)
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.void open(javax.sound.sampled.SourceDataLine line, java.util.Map<java.lang.String,java.lang.Object> info) throws javax.sound.midi.MidiUnavailableException
SourceDataLine
.
An application opening a synthesizer explicitly with this call
has to close the synthesizer by calling MidiDevice.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.javax.sound.midi.MidiUnavailableException
- thrown if the synthesizer cannot be
opened due to resource restrictions.java.lang.SecurityException
- thrown if the synthesizer cannot be
opened due to security restrictions.MidiDevice.close()
,
MidiDevice.isOpen()
javax.sound.sampled.AudioInputStream openStream(javax.sound.sampled.AudioFormat targetFormat, java.util.Map<java.lang.String,java.lang.Object> info) throws javax.sound.midi.MidiUnavailableException
AudioInputStream
.
An application opening a synthesizer explicitly with this call
has to close the synthesizer by calling MidiDevice.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.javax.sound.midi.MidiUnavailableException
- thrown if the synthesizer cannot be
opened due to resource restrictions.java.lang.SecurityException
- thrown if the synthesizer cannot be
opened due to security restrictions.MidiDevice.close()
,
MidiDevice.isOpen()