com.sun.media.sound
Interface AudioSynthesizer

All Superinterfaces:
javax.sound.midi.MidiDevice, javax.sound.midi.Synthesizer
All Known Implementing Classes:
SoftSynthesizer

public interface AudioSynthesizer
extends javax.sound.midi.Synthesizer

AudioSynthesizer is a Synthesizer which renders it's output audio into SourceDataLine or AudioInputStream.

Author:
Karl Helgason
See Also:
MidiSystem#getSynthesizer, Synthesizer

Nested Class Summary
 
Nested classes/interfaces inherited from interface javax.sound.midi.MidiDevice
javax.sound.midi.MidiDevice.Info
 
Method Summary
 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.
 
Methods inherited from interface javax.sound.midi.Synthesizer
getAvailableInstruments, getChannels, getDefaultSoundbank, getLatency, getLoadedInstruments, getMaxPolyphony, getVoiceStatus, isSoundbankSupported, loadAllInstruments, loadInstrument, loadInstruments, remapInstrument, unloadAllInstruments, unloadInstrument, unloadInstruments
 
Methods inherited from interface javax.sound.midi.MidiDevice
close, getDeviceInfo, getMaxReceivers, getMaxTransmitters, getMicrosecondPosition, getReceiver, getReceivers, getTransmitter, getTransmitters, isOpen, open
 

Method Detail

getFormat

javax.sound.sampled.AudioFormat 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.

Returns:
current audio data format
See Also:
AudioFormat

getPropertyInfo

AudioSynthesizerPropertyInfo[] getPropertyInfo(java.util.Map<java.lang.String,java.lang.Object> info)
Gets information about the possible properties for the synthesizer.

Parameters:
info - a proposed list of tag/value pairs that will be sent on open.
Returns:
an array of AudioSynthesizerPropertyInfo objects describing possible properties. This array may be an empty array if no properties are required.

open

void open(javax.sound.sampled.SourceDataLine line,
          java.util.Map<java.lang.String,java.lang.Object> info)
          throws javax.sound.midi.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 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.

Parameters:
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.
Throws:
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.
See Also:
MidiDevice.close(), MidiDevice.isOpen()

openStream

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

Parameters:
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.
Throws:
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.
See Also:
MidiDevice.close(), MidiDevice.isOpen()