public class MidiSystem extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static MidiDevice |
getMidiDevice(MidiDevice.Info info)
Get the specified MIDI device.
|
static MidiDevice.Info[] |
getMidiDeviceInfo()
Get an array of all available MIDI devices.
|
static MidiFileFormat |
getMidiFileFormat(java.io.File file)
Read a MidiFileFormat object from the given file.
|
static MidiFileFormat |
getMidiFileFormat(java.io.InputStream stream)
Read a MidiFileFormat object from the given stream.
|
static MidiFileFormat |
getMidiFileFormat(java.net.URL url)
Read a MidiFileFormat object from the given url.
|
static int[] |
getMidiFileTypes()
Return an array of supported MIDI file types on this system.
|
static int[] |
getMidiFileTypes(Sequence sequence)
Return an array of supported MIDI file types on this system
for the given sequnce.
|
static Receiver |
getReceiver()
Get the default Receiver instance.
|
static Sequence |
getSequence(java.io.File file)
Read a Sequence object from the given file.
|
static Sequence |
getSequence(java.io.InputStream stream)
Read a Sequence object from the given stream.
|
static Sequence |
getSequence(java.net.URL url)
Read a Sequence object from the given url.
|
static Sequencer |
getSequencer()
Get the default Sequencer instance.
|
static Soundbank |
getSoundbank(java.io.File file)
Read a Soundbank object from the given file.
|
static Soundbank |
getSoundbank(java.io.InputStream stream)
Read a Soundbank object from the given stream.
|
static Soundbank |
getSoundbank(java.net.URL url)
Read a Soundbank object from the given url.
|
static Synthesizer |
getSynthesizer()
Get the default Synthesizer instance.
|
static Transmitter |
getTransmitter()
Get the default Transmitter instance.
|
static boolean |
isFileTypeSupported(int fileType)
Return true if the system supports writing files of type fileType.
|
static boolean |
isFileTypeSupported(int fileType,
Sequence sequence)
Return true if the system supports writing files of type fileType
for the given sequence.
|
static int |
write(Sequence in,
int fileType,
java.io.File out)
Write a sequence to a file using a specific MIDI file format.
|
static int |
write(Sequence in,
int fileType,
java.io.OutputStream out)
Write a sequence to an output stream using a specific MIDI file format.
|
public static MidiDevice.Info[] getMidiDeviceInfo()
public static MidiDevice getMidiDevice(MidiDevice.Info info) throws MidiUnavailableException
info - a description of the device we're looking forMidiUnavailableException - if no MIDI devices are configured or foundjava.lang.IllegalArgumentException - if the device described by info is not foundpublic static Receiver getReceiver() throws MidiUnavailableException
MidiUnavailableException - if no Receiver is foundpublic static Transmitter getTransmitter() throws MidiUnavailableException
MidiUnavailableException - if no Transmitter is foundpublic static Synthesizer getSynthesizer() throws MidiUnavailableException
MidiUnavailableException - if no Synthesizer is foundpublic static Sequencer getSequencer() throws MidiUnavailableException
MidiUnavailableException - if no Sequencer is foundpublic static Soundbank getSoundbank(java.io.InputStream stream) throws InvalidMidiDataException, java.io.IOException
stream - the stream from which to read the SoundbankInvalidMidiDataException - if we were unable to read the soundbankjava.io.IOException - if an I/O error happened while readingpublic static Soundbank getSoundbank(java.net.URL url) throws InvalidMidiDataException, java.io.IOException
url - the url from which to read the SoundbankInvalidMidiDataException - if we were unable to read the soundbankjava.io.IOException - if an I/O error happened while readingpublic static Soundbank getSoundbank(java.io.File file) throws InvalidMidiDataException, java.io.IOException
file - the file from which to read the SoundbankInvalidMidiDataException - if we were unable to read the soundbankjava.io.IOException - if an I/O error happened while readingpublic static MidiFileFormat getMidiFileFormat(java.io.InputStream stream) throws InvalidMidiDataException, java.io.IOException
stream - the stream from which to read the MidiFileFormatInvalidMidiDataException - if we were unable to read the MidiFileFormatjava.io.IOException - if an I/O error happened while readingpublic static MidiFileFormat getMidiFileFormat(java.net.URL url) throws InvalidMidiDataException, java.io.IOException
url - the url from which to read the MidiFileFormatInvalidMidiDataException - if we were unable to read the MidiFileFormatjava.io.IOException - if an I/O error happened while readingpublic static MidiFileFormat getMidiFileFormat(java.io.File file) throws InvalidMidiDataException, java.io.IOException
file - the file from which to read the MidiFileFormatInvalidMidiDataException - if we were unable to read the MidiFileFormatjava.io.IOException - if an I/O error happened while readingpublic static Sequence getSequence(java.io.InputStream stream) throws InvalidMidiDataException, java.io.IOException
stream - the stream from which to read the SequenceInvalidMidiDataException - if we were unable to read the Sequencejava.io.IOException - if an I/O error happened while readingpublic static Sequence getSequence(java.net.URL url) throws InvalidMidiDataException, java.io.IOException
url - the url from which to read the SequenceInvalidMidiDataException - if we were unable to read the Sequencejava.io.IOException - if an I/O error happened while readingpublic static Sequence getSequence(java.io.File file) throws InvalidMidiDataException, java.io.IOException
file - the file from which to read the SequenceInvalidMidiDataException - if we were unable to read the Sequencejava.io.IOException - if an I/O error happened while readingpublic static int[] getMidiFileTypes()
public static boolean isFileTypeSupported(int fileType)
fileType - the MIDI file type we want to writepublic static int[] getMidiFileTypes(Sequence sequence)
sequence - the sequnce to writepublic static boolean isFileTypeSupported(int fileType, Sequence sequence)
fileType - the MIDI file type we want to writesequence - the Sequence we want to writepublic static int write(Sequence in, int fileType, java.io.OutputStream out) throws java.io.IOException
in - the sequence to writefileType - the MIDI file format to useout - the output stream to write tojava.io.IOException - if an I/O exception happensjava.lang.IllegalArgumentException - if fileType is not supported for inpublic static int write(Sequence in, int fileType, java.io.File out) throws java.io.IOException
in - the sequence to writefileType - the MIDI file format to useout - the file to write tojava.io.IOException - if an I/O exception happensjava.lang.IllegalArgumentException - if fileType is not supported for in