public class MidiPlugin extends JPlugin
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_PLUGIN_NAME
The default name of this plugin.
|
| Constructor and Description |
|---|
MidiPlugin()
Creates a new MIDI plugin.
|
MidiPlugin(String name)
Creates a new MIDI plugin.
|
| Modifier and Type | Method and Description |
|---|---|
void |
connectDefaultInputDevice()
Sets and updates the default input MIDI device in the plugin.
|
void |
connectInputDevice(String deviceName)
Sets and updates the input MIDI device in the plugin.
|
ShortMessage |
createShortMessage(int command,
int channel,
int data1,
int data2)
Creates a new MIDI short message.
|
MidiShortMessageEvent |
createShortMessageEvent(ShortMessage message)
Create a new Sponge MIDI ShortMessage event.
|
MidiShortMessageEvent |
createShortMessageEvent(ShortMessage message,
long timeStamp)
Create a new Sponge MIDI ShortMessage event.
|
List<MidiChannel> |
getChannels()
Returns the synthesizer channels.
|
MidiDevice |
getDefaultInputDevice()
Returns the default input MIDI device.
|
MidiDevice |
getDeviceByName(String name)
Returns the MIDI device by name.
|
List<MidiDevice> |
getDevices()
Returns all available MIDI devices.
|
MidiDevice |
getInputDevice()
Returns the input device.
|
Transmitter |
getInputTransmitter()
Returns the input device transmitter.
|
Instrument |
getInstrument(int channel)
Returns the selected instrument for the specified channel.
|
List<Instrument> |
getInstruments()
Returns the loaded synthesizer instruments.
|
String |
getMidiMetaMessageEventName()
Returns a name of a MIDI MetaMessage Sponge event sent by this plugin to the engine.
|
String |
getMidiShortMessageEventName()
Returns a name of a MIDI ShortMessage Sponge event sent by this plugin to the engine.
|
String |
getMidiSysexMessageEventName()
Returns a name of a MIDI SysexMessage Sponge event sent by this plugin to the engine.
|
Sequencer |
getSequencer()
Returns the sequencer.
|
Transmitter |
getSequencerTransmitter()
Returns the sequencer transmitter.
|
Synthesizer |
getSynthesizer()
Returns the synthesizer.
|
Receiver |
getSynthesizerReceiver()
Returns the synthesizer receiver.
|
boolean |
isLoadAllInstruments()
Returns the load all instruments behavior.
|
boolean |
isSequencerConnectedToSynthesizer()
Returns the default sequencer connected to the default synthesizer behavior.
|
boolean |
loadAllInstruments()
Loads all instruments in the default soundbank to the synthesizer.
|
void |
logInstruments()
Logs available synthesizer instruments.
|
void |
logMidiSystemInfo()
Logs MIDI system info (e.g.
|
void |
noteOff(int channel,
int data1,
int data2)
Sends a
note off MIDI message to the synthesizer receiver. |
void |
noteOn(int channel,
int data1,
int data2)
Sends a
note on MIDI message to the synthesizer receiver. |
void |
onConfigure(org.openksavi.sponge.config.Configuration configuration)
Applies the XML configuration to this plugin.
|
void |
onShutdown()
Shuts down the plugin.
|
void |
onStartup()
Starts up this plugin.
|
void |
setInputDevice(MidiDevice inputDevice)
Sets the input device.
|
Instrument |
setInstrument(int channel,
int instrument)
Sets the synthesizer instrument.
|
Instrument |
setInstrument(int channel,
String instrumentName)
Sets the synthesizer instrument.
|
void |
setLoadAllInstruments(boolean loadAllInstruments)
Sets the load all instruments behavior.
|
void |
setMidiMetaMessageEventName(String midiMetaMessageEventName)
Sets a name of a MIDI MetaMessage Sponge event sent by this plugin to the engine.
|
void |
setMidiShortMessageEventName(String midiShortMessageEventName)
Sets a name of a MIDI ShortMessage Sponge event sent by this plugin to the engine.
|
void |
setMidiSysexMessageEventName(String midiSysexMessageEventName)
Sets a name of a MIDI SysexMessage Sponge event sent by this plugin to the engine.
|
void |
setSequencer(Sequencer sequencer)
Sets the sequencer.
|
void |
setSequencerConnectedToSynthesizer(boolean sequencerConnectedToSynthesizer)
Sets the default sequencer connected to the default synthesizer behavior.
|
void |
setSynthesizer(Synthesizer synthesizer)
Sets the synthesizer.
|
void |
sound(int command,
int channel,
int data1,
int data2)
Generates a sound by sending the short MIDI message to the synthesizer receiver.
|
void |
sound(MidiMessage message)
Generates a sound by sending the MIDI message to the synthesizer receiver.
|
void |
sound(MidiMessage message,
long timeStamp)
Generates a sound by sending the MIDI message to the synthesizer receiver.
|
void |
startPlay(File midiFile)
Starts playing the MIDI file using the sequencer.
|
void |
startPlay(InputStream stream)
Starts playing the MIDI file using the sequencer.
|
void |
startPlay(Sequence sequence)
Starts playing the MIDI file using the sequencer.
|
void |
startPlay(String midiFileName)
Starts playing the MIDI file using the sequencer.
|
void |
startPlay(URL url)
Starts playing the MIDI file using the sequencer.
|
void |
stopPlay()
Stops playing.
|
void |
update()
Updates the plugin state, e.g.
|
void |
updateInputDevice()
Updates the input device state.
|
void |
updateSequencer()
Updates the sequencer state.
|
void |
updateSynthesizer()
Updates the synthesizer state.
|
doShutdown, doStartup, getConfiguration, getEngineOperations, getKnowledgeBase, getLogger, getSponge, onAfterReload, onBeforeReload, onInit, setConfiguration, setKnowledgeBase, shutdown, startup, toStringgetDescription, getDisplayName, getEngine, getInternalService, getName, getState, isFailed, isNew, isNewOrStartingOrRunning, isRunning, isStarting, isStopping, isTerminated, setDescription, setDisplayName, setEngine, setNameclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitisFailed, isNew, isRunning, isStarting, isStopping, isTerminatedpublic static final String DEFAULT_PLUGIN_NAME
public MidiPlugin()
public MidiPlugin(String name)
name - the plugin name.public void onConfigure(org.openksavi.sponge.config.Configuration configuration)
onConfigure in interface org.openksavi.sponge.plugin.PluginonConfigure in class BasePluginpublic void onStartup()
onStartup in interface org.openksavi.sponge.plugin.PluginonStartup in class BasePluginpublic void update()
public void updateSequencer()
public void updateSynthesizer()
public void updateInputDevice()
public void onShutdown()
onShutdown in interface org.openksavi.sponge.plugin.PluginonShutdown in class BasePluginpublic void connectInputDevice(String deviceName)
deviceName - the input MIDI device name.public void connectDefaultInputDevice()
public Sequencer getSequencer()
public void setSequencer(Sequencer sequencer)
sequencer - the sequencer.public Synthesizer getSynthesizer()
public void setSynthesizer(Synthesizer synthesizer)
synthesizer - the synthesizer.public MidiDevice getInputDevice()
public void setInputDevice(MidiDevice inputDevice)
inputDevice - the input device.public Receiver getSynthesizerReceiver()
public Transmitter getInputTransmitter()
public Transmitter getSequencerTransmitter()
public boolean isSequencerConnectedToSynthesizer()
true if the default sequencer will be connected to the default synthesizer (e.g. to generate sound while playing MIDI
files)public void setSequencerConnectedToSynthesizer(boolean sequencerConnectedToSynthesizer)
sequencerConnectedToSynthesizer - if true then the default sequencer will be connected to the default synthesizer (e.g.
to generate sound while playing MIDI files)public boolean isLoadAllInstruments()
true if all instruments in the default soundbank will be loaded at startup.public void setLoadAllInstruments(boolean loadAllInstruments)
loadAllInstruments - if true then all instruments in the default soundbank will be loaded at startup.public String getMidiShortMessageEventName()
public void setMidiShortMessageEventName(String midiShortMessageEventName)
midiShortMessageEventName - a name of a MIDI ShortMessage Sponge event sent by this plugin to the engine.public String getMidiSysexMessageEventName()
public void setMidiSysexMessageEventName(String midiSysexMessageEventName)
midiSysexMessageEventName - a name of a MIDI SysexMessage Sponge event sent by this plugin to the engine.public String getMidiMetaMessageEventName()
public void setMidiMetaMessageEventName(String midiMetaMessageEventName)
midiMetaMessageEventName - a name of a MIDI MetaMessage Sponge event sent by this plugin to the engine.public void sound(MidiMessage message)
message - the MIDI message.public void sound(MidiMessage message, long timeStamp)
message - the MIDI message.timeStamp - the message timestamp.public void sound(int command,
int channel,
int data1,
int data2)
command - the MIDI message command.channel - the MIDI message channel.data1 - the MIDI message data1.data2 - the MIDI message data2.public void noteOn(int channel,
int data1,
int data2)
note on MIDI message to the synthesizer receiver.channel - the MIDI message channel.data1 - the MIDI message data1.data2 - the MIDI message data2.public void noteOff(int channel,
int data1,
int data2)
note off MIDI message to the synthesizer receiver.channel - the MIDI message channel.data1 - the MIDI message data1.data2 - the MIDI message data2.public void startPlay(String midiFileName)
midiFileName - the MIDI file name.public void startPlay(File midiFile)
midiFile - the MIDI file.public void startPlay(InputStream stream)
stream - the MIDI file stream.public void startPlay(URL url)
url - the MIDI file url.public void startPlay(Sequence sequence)
sequence - the MIDI sequence.public void stopPlay()
public ShortMessage createShortMessage(int command, int channel, int data1, int data2)
command - the MIDI short message command.channel - the MIDI short message channel.data1 - the MIDI short message data1.data2 - the MIDI short message data2.public MidiShortMessageEvent createShortMessageEvent(ShortMessage message, long timeStamp)
message - the MIDI short message.timeStamp - the MIDI timestamp.public MidiShortMessageEvent createShortMessageEvent(ShortMessage message)
message - the MIDI short message.public boolean loadAllInstruments()
true on success.public Instrument setInstrument(int channel, int instrument)
channel - the channel.instrument - the instrument number.public Instrument setInstrument(int channel, String instrumentName)
channel - the channel.instrumentName - the instrument name.public List<Instrument> getInstruments()
public Instrument getInstrument(int channel)
channel - the channel number.public List<MidiChannel> getChannels()
public List<MidiDevice> getDevices()
public MidiDevice getDefaultInputDevice()
public MidiDevice getDeviceByName(String name)
name - the MIDI device name.public void logMidiSystemInfo()
public void logInstruments()
Copyright © 2016–2018 Softelnet. All rights reserved.