public class SoftSynthesizer extends java.lang.Object implements AudioSynthesizer, ReferenceCountingDevice
Modifier and Type | Class and Description |
---|---|
protected static class |
SoftSynthesizer.WeakAudioStream |
Modifier and Type | Field and Description |
---|---|
protected boolean |
agc_on |
protected SoftChannel[] |
channels |
protected boolean |
chorus_on |
protected java.lang.Object |
control_mutex |
protected SoftChannelProxy[] |
external_channels |
protected static javax.sound.midi.MidiDevice.Info |
info |
protected static java.lang.String |
INFO_DESCRIPTION |
protected static java.lang.String |
INFO_NAME |
protected static java.lang.String |
INFO_VENDOR |
protected static java.lang.String |
INFO_VERSION |
protected boolean |
reverb_light |
protected boolean |
reverb_on |
protected int |
voice_allocation_mode |
protected int |
voiceIDCounter |
protected SoftSynthesizer.WeakAudioStream |
weakstream |
Constructor and Description |
---|
SoftSynthesizer() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected SoftInstrument |
findInstrument(int program,
int bank,
int channel) |
javax.sound.midi.Instrument[] |
getAvailableInstruments() |
javax.sound.midi.MidiChannel[] |
getChannels() |
protected float |
getControlRate() |
javax.sound.midi.Soundbank |
getDefaultSoundbank() |
protected int |
getDeviceID() |
javax.sound.midi.MidiDevice.Info |
getDeviceInfo() |
javax.sound.sampled.AudioFormat |
getFormat()
Obtains the current format (encoding, sample rate, number of channels,
etc.) of the synthesizer audio data.
|
protected int |
getGeneralMidiMode() |
long |
getLatency() |
javax.sound.midi.Instrument[] |
getLoadedInstruments() |
protected SoftMainMixer |
getMainMixer() |
int |
getMaxPolyphony() |
int |
getMaxReceivers() |
int |
getMaxTransmitters() |
long |
getMicrosecondPosition() |
AudioSynthesizerPropertyInfo[] |
getPropertyInfo(java.util.Map<java.lang.String,java.lang.Object> info)
Gets information about the possible properties for the synthesizer.
|
javax.sound.midi.Receiver |
getReceiver() |
javax.sound.midi.Receiver |
getReceiverReferenceCounting()
Retrieve a Receiver that opens the device implicitly.
|
java.util.List<javax.sound.midi.Receiver> |
getReceivers() |
javax.sound.midi.Transmitter |
getTransmitter() |
javax.sound.midi.Transmitter |
getTransmitterReferenceCounting()
Retrieve a Transmitter that opens the device implicitly.
|
java.util.List<javax.sound.midi.Transmitter> |
getTransmitters() |
protected SoftTuning |
getTuning(javax.sound.midi.Patch patch) |
protected int |
getVoiceAllocationMode() |
protected SoftVoice[] |
getVoices() |
javax.sound.midi.VoiceStatus[] |
getVoiceStatus() |
boolean |
isOpen() |
boolean |
isSoundbankSupported(javax.sound.midi.Soundbank soundbank) |
boolean |
loadAllInstruments(javax.sound.midi.Soundbank soundbank) |
boolean |
loadInstrument(javax.sound.midi.Instrument instrument) |
boolean |
loadInstruments(javax.sound.midi.Soundbank soundbank,
javax.sound.midi.Patch[] patchList) |
void |
open() |
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 . |
boolean |
remapInstrument(javax.sound.midi.Instrument from,
javax.sound.midi.Instrument to) |
protected void |
removeReceiver(javax.sound.midi.Receiver recv) |
protected void |
setGeneralMidiMode(int gmmode) |
void |
unloadAllInstruments(javax.sound.midi.Soundbank soundbank) |
void |
unloadInstrument(javax.sound.midi.Instrument instrument) |
void |
unloadInstruments(javax.sound.midi.Soundbank soundbank,
javax.sound.midi.Patch[] patchList) |
protected static final java.lang.String INFO_NAME
protected static final java.lang.String INFO_VENDOR
protected static final java.lang.String INFO_DESCRIPTION
protected static final java.lang.String INFO_VERSION
protected static final javax.sound.midi.MidiDevice.Info info
protected SoftSynthesizer.WeakAudioStream weakstream
protected java.lang.Object control_mutex
protected int voiceIDCounter
protected int voice_allocation_mode
protected boolean reverb_light
protected boolean reverb_on
protected boolean chorus_on
protected boolean agc_on
protected SoftChannel[] channels
protected SoftChannelProxy[] external_channels
protected void removeReceiver(javax.sound.midi.Receiver recv)
protected SoftMainMixer getMainMixer()
protected SoftInstrument findInstrument(int program, int bank, int channel)
protected int getVoiceAllocationMode()
protected int getGeneralMidiMode()
protected void setGeneralMidiMode(int gmmode)
protected int getDeviceID()
protected float getControlRate()
protected SoftVoice[] getVoices()
protected SoftTuning getTuning(javax.sound.midi.Patch patch)
public long getLatency()
getLatency
in interface javax.sound.midi.Synthesizer
public javax.sound.sampled.AudioFormat getFormat()
AudioSynthesizer
If the synthesizer is not open and has never been opened, it returns the default format.
getFormat
in interface AudioSynthesizer
AudioFormat
public int getMaxPolyphony()
getMaxPolyphony
in interface javax.sound.midi.Synthesizer
public javax.sound.midi.MidiChannel[] getChannels()
getChannels
in interface javax.sound.midi.Synthesizer
public javax.sound.midi.VoiceStatus[] getVoiceStatus()
getVoiceStatus
in interface javax.sound.midi.Synthesizer
public boolean isSoundbankSupported(javax.sound.midi.Soundbank soundbank)
isSoundbankSupported
in interface javax.sound.midi.Synthesizer
public boolean loadInstrument(javax.sound.midi.Instrument instrument)
loadInstrument
in interface javax.sound.midi.Synthesizer
public void unloadInstrument(javax.sound.midi.Instrument instrument)
unloadInstrument
in interface javax.sound.midi.Synthesizer
public boolean remapInstrument(javax.sound.midi.Instrument from, javax.sound.midi.Instrument to)
remapInstrument
in interface javax.sound.midi.Synthesizer
public javax.sound.midi.Soundbank getDefaultSoundbank()
getDefaultSoundbank
in interface javax.sound.midi.Synthesizer
public javax.sound.midi.Instrument[] getAvailableInstruments()
getAvailableInstruments
in interface javax.sound.midi.Synthesizer
public javax.sound.midi.Instrument[] getLoadedInstruments()
getLoadedInstruments
in interface javax.sound.midi.Synthesizer
public boolean loadAllInstruments(javax.sound.midi.Soundbank soundbank)
loadAllInstruments
in interface javax.sound.midi.Synthesizer
public void unloadAllInstruments(javax.sound.midi.Soundbank soundbank)
unloadAllInstruments
in interface javax.sound.midi.Synthesizer
public boolean loadInstruments(javax.sound.midi.Soundbank soundbank, javax.sound.midi.Patch[] patchList)
loadInstruments
in interface javax.sound.midi.Synthesizer
public void unloadInstruments(javax.sound.midi.Soundbank soundbank, javax.sound.midi.Patch[] patchList)
unloadInstruments
in interface javax.sound.midi.Synthesizer
public javax.sound.midi.MidiDevice.Info getDeviceInfo()
getDeviceInfo
in interface javax.sound.midi.MidiDevice
public AudioSynthesizerPropertyInfo[] getPropertyInfo(java.util.Map<java.lang.String,java.lang.Object> info)
AudioSynthesizer
getPropertyInfo
in interface AudioSynthesizer
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.public void open() throws javax.sound.midi.MidiUnavailableException
open
in interface javax.sound.midi.MidiDevice
javax.sound.midi.MidiUnavailableException
public void open(javax.sound.sampled.SourceDataLine line, java.util.Map<java.lang.String,java.lang.Object> info) throws javax.sound.midi.MidiUnavailableException
AudioSynthesizer
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
.
open
in interface AudioSynthesizer
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.MidiDevice.close()
,
MidiDevice.isOpen()
public 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
AudioSynthesizer
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
.
openStream
in interface AudioSynthesizer
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.MidiDevice.close()
,
MidiDevice.isOpen()
public void close()
close
in interface java.lang.AutoCloseable
close
in interface javax.sound.midi.MidiDevice
public boolean isOpen()
isOpen
in interface javax.sound.midi.MidiDevice
public long getMicrosecondPosition()
getMicrosecondPosition
in interface javax.sound.midi.MidiDevice
public int getMaxReceivers()
getMaxReceivers
in interface javax.sound.midi.MidiDevice
public int getMaxTransmitters()
getMaxTransmitters
in interface javax.sound.midi.MidiDevice
public javax.sound.midi.Receiver getReceiver() throws javax.sound.midi.MidiUnavailableException
getReceiver
in interface javax.sound.midi.MidiDevice
javax.sound.midi.MidiUnavailableException
public java.util.List<javax.sound.midi.Receiver> getReceivers()
getReceivers
in interface javax.sound.midi.MidiDevice
public javax.sound.midi.Transmitter getTransmitter() throws javax.sound.midi.MidiUnavailableException
getTransmitter
in interface javax.sound.midi.MidiDevice
javax.sound.midi.MidiUnavailableException
public java.util.List<javax.sound.midi.Transmitter> getTransmitters()
getTransmitters
in interface javax.sound.midi.MidiDevice
public javax.sound.midi.Receiver getReceiverReferenceCounting() throws javax.sound.midi.MidiUnavailableException
ReferenceCountingDevice
getReceiverReferenceCounting
in interface ReferenceCountingDevice
javax.sound.midi.MidiUnavailableException
public javax.sound.midi.Transmitter getTransmitterReferenceCounting() throws javax.sound.midi.MidiUnavailableException
ReferenceCountingDevice
getTransmitterReferenceCounting
in interface ReferenceCountingDevice
javax.sound.midi.MidiUnavailableException