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.Synthesizerpublic javax.sound.sampled.AudioFormat getFormat()
AudioSynthesizerIf the synthesizer is not open and has never been opened, it returns the default format.
getFormat in interface AudioSynthesizerAudioFormatpublic int getMaxPolyphony()
getMaxPolyphony in interface javax.sound.midi.Synthesizerpublic javax.sound.midi.MidiChannel[] getChannels()
getChannels in interface javax.sound.midi.Synthesizerpublic javax.sound.midi.VoiceStatus[] getVoiceStatus()
getVoiceStatus in interface javax.sound.midi.Synthesizerpublic boolean isSoundbankSupported(javax.sound.midi.Soundbank soundbank)
isSoundbankSupported in interface javax.sound.midi.Synthesizerpublic boolean loadInstrument(javax.sound.midi.Instrument instrument)
loadInstrument in interface javax.sound.midi.Synthesizerpublic void unloadInstrument(javax.sound.midi.Instrument instrument)
unloadInstrument in interface javax.sound.midi.Synthesizerpublic boolean remapInstrument(javax.sound.midi.Instrument from,
javax.sound.midi.Instrument to)
remapInstrument in interface javax.sound.midi.Synthesizerpublic javax.sound.midi.Soundbank getDefaultSoundbank()
getDefaultSoundbank in interface javax.sound.midi.Synthesizerpublic javax.sound.midi.Instrument[] getAvailableInstruments()
getAvailableInstruments in interface javax.sound.midi.Synthesizerpublic javax.sound.midi.Instrument[] getLoadedInstruments()
getLoadedInstruments in interface javax.sound.midi.Synthesizerpublic boolean loadAllInstruments(javax.sound.midi.Soundbank soundbank)
loadAllInstruments in interface javax.sound.midi.Synthesizerpublic void unloadAllInstruments(javax.sound.midi.Soundbank soundbank)
unloadAllInstruments in interface javax.sound.midi.Synthesizerpublic boolean loadInstruments(javax.sound.midi.Soundbank soundbank,
javax.sound.midi.Patch[] patchList)
loadInstruments in interface javax.sound.midi.Synthesizerpublic void unloadInstruments(javax.sound.midi.Soundbank soundbank,
javax.sound.midi.Patch[] patchList)
unloadInstruments in interface javax.sound.midi.Synthesizerpublic javax.sound.midi.MidiDevice.Info getDeviceInfo()
getDeviceInfo in interface javax.sound.midi.MidiDevicepublic AudioSynthesizerPropertyInfo[] getPropertyInfo(java.util.Map<java.lang.String,java.lang.Object> info)
AudioSynthesizergetPropertyInfo in interface AudioSynthesizerinfo - 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.MidiDevicejavax.sound.midi.MidiUnavailableExceptionpublic void open(javax.sound.sampled.SourceDataLine line,
java.util.Map<java.lang.String,java.lang.Object> info)
throws javax.sound.midi.MidiUnavailableException
AudioSynthesizerSourceDataLine.
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 AudioSynthesizerline - 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
AudioSynthesizerAudioInputStream.
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 AudioSynthesizertargetFormat - 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.AutoCloseableclose in interface javax.sound.midi.MidiDevicepublic boolean isOpen()
isOpen in interface javax.sound.midi.MidiDevicepublic long getMicrosecondPosition()
getMicrosecondPosition in interface javax.sound.midi.MidiDevicepublic int getMaxReceivers()
getMaxReceivers in interface javax.sound.midi.MidiDevicepublic int getMaxTransmitters()
getMaxTransmitters in interface javax.sound.midi.MidiDevicepublic javax.sound.midi.Receiver getReceiver()
throws javax.sound.midi.MidiUnavailableException
getReceiver in interface javax.sound.midi.MidiDevicejavax.sound.midi.MidiUnavailableExceptionpublic java.util.List<javax.sound.midi.Receiver> getReceivers()
getReceivers in interface javax.sound.midi.MidiDevicepublic javax.sound.midi.Transmitter getTransmitter()
throws javax.sound.midi.MidiUnavailableException
getTransmitter in interface javax.sound.midi.MidiDevicejavax.sound.midi.MidiUnavailableExceptionpublic java.util.List<javax.sound.midi.Transmitter> getTransmitters()
getTransmitters in interface javax.sound.midi.MidiDevicepublic javax.sound.midi.Receiver getReceiverReferenceCounting()
throws javax.sound.midi.MidiUnavailableException
ReferenceCountingDevicegetReceiverReferenceCounting in interface ReferenceCountingDevicejavax.sound.midi.MidiUnavailableExceptionpublic javax.sound.midi.Transmitter getTransmitterReferenceCounting()
throws javax.sound.midi.MidiUnavailableException
ReferenceCountingDevicegetTransmitterReferenceCounting in interface ReferenceCountingDevicejavax.sound.midi.MidiUnavailableException