public final class MidiSystem extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
MidiSystem.MidiSystemUtils
Utilities for
MidiSystem |
| Modifier and Type | Method and Description |
|---|---|
static void |
addMidiDevice(MidiDevice midiDevice)
Add a
MidiDevice to the MidiSystem |
static void |
addSynthesizer(Synthesizer synthesizer)
Add a
Synthesizer to the MidiSystem |
static MidiDevice |
getMidiDevice(MidiDevice.Info info)
Get
MidiDevice by device information |
static MidiDevice.Info[] |
getMidiDeviceInfo()
Get all connected
MidiDevice.Info as array |
static MidiFileFormat |
getMidiFileFormat(File file)
Get the
MidiFileFormat information of the specified File. |
static MidiFileFormat |
getMidiFileFormat(InputStream stream)
Get the
MidiFileFormat information in the specified input stream. |
static MidiFileFormat |
getMidiFileFormat(URL url)
Get the
MidiFileFormat information in the specified URL. |
static int[] |
getMidiFileTypes()
Get the set of SMF types that the library can write
|
static int[] |
getMidiFileTypes(Sequence sequence)
Get the set of SMF types that the library can write from the
Sequence |
static Receiver |
getReceiver()
Get the first detected Receiver
|
static Sequence |
getSequence(File file)
Get a
Sequence from the specified File. |
static Sequence |
getSequence(InputStream stream)
Get a
Sequence from the specified input stream. |
static Sequence |
getSequence(URL url)
Get a
Sequence from the specified URL. |
static Sequencer |
getSequencer()
Get the default
Sequencer, connected to a default device. |
static Sequencer |
getSequencer(boolean connected)
Get the default
Sequencer, optionally connected to a default device. |
static Soundbank |
getSoundbank(File file)
Obtain
Soundbank from Filenot implemented. |
static Soundbank |
getSoundbank(InputStream stream)
Obtain
Soundbank from InputStreamnot implemented. |
static Soundbank |
getSoundbank(URL url)
Obtain
Soundbank from URLnot implemented. |
static Synthesizer |
getSynthesizer()
Obtain
Synthesizer registered by registerSynthesizer(Synthesizer) |
static Transmitter |
getTransmitter()
Get the first detected Transmitter
|
static boolean |
isFileTypeSupported(int fileType)
Check if the specified SMF fileType is available
|
static boolean |
isFileTypeSupported(int fileType,
Sequence sequence)
Check if the specified SMF fileType is available from the
Sequence |
static void |
registerSynthesizer(Synthesizer synthesizer)
Register the
Synthesizer instance to the MidiSystem. |
static void |
removeMidiDevice(MidiDevice midiDevice)
Remove a
MidiDevice from the MidiSystem |
static void |
removeSynthesizer(Synthesizer synthesizer)
Remove a
Synthesizer from the MidiSystem |
static int |
write(Sequence sequence,
int fileType,
File file)
Write sequence to the specified
File as SMF |
static int |
write(Sequence sequence,
int fileType,
OutputStream outputStream)
Write sequence to the specified
OutputStream as SMF |
public static void addMidiDevice(@NonNull MidiDevice midiDevice)
MidiDevice to the MidiSystemmidiDevice - the device to addpublic static void removeMidiDevice(@NonNull MidiDevice midiDevice)
MidiDevice from the MidiSystemmidiDevice - the device to removepublic static void addSynthesizer(@NonNull Synthesizer synthesizer)
Synthesizer to the MidiSystemsynthesizer - the device to addpublic static void removeSynthesizer(@NonNull Synthesizer synthesizer)
Synthesizer from the MidiSystemsynthesizer - the device to remove@NonNull public static MidiDevice.Info[] getMidiDeviceInfo()
MidiDevice.Info as array@NonNull public static MidiDevice getMidiDevice(@NonNull MidiDevice.Info info) throws MidiUnavailableException, IllegalArgumentException
MidiDevice by device informationinfo - the device informationMidiDeviceMidiUnavailableExceptionIllegalArgumentException - if the device not found.@Nullable public static Receiver getReceiver() throws MidiUnavailableException
ReceiverMidiUnavailableException@Nullable public static Transmitter getTransmitter() throws MidiUnavailableException
TransmitterMidiUnavailableException@NonNull public static Sequence getSequence(@NonNull File file) throws InvalidMidiDataException, IOException
Sequence from the specified File.file - the SMFSequenceInvalidMidiDataExceptionIOException@NonNull public static Sequence getSequence(@NonNull InputStream stream) throws InvalidMidiDataException, IOException
Sequence from the specified input stream.stream - the input stream of SMFSequenceInvalidMidiDataExceptionIOException@NonNull public static Sequence getSequence(@NonNull URL url) throws InvalidMidiDataException, IOException
Sequence from the specified URL.url - the URL of SMFSequenceInvalidMidiDataExceptionIOException@NonNull public static Sequencer getSequencer() throws MidiUnavailableException
Sequencer, connected to a default device.Sequencer must call the MidiDevice.open() method.MidiUnavailableException@NonNull public static Sequencer getSequencer(boolean connected) throws MidiUnavailableException
Sequencer, optionally connected to a default device.connected - ignoredSequencer must call the MidiDevice.open() method.MidiUnavailableException@NonNull public static Soundbank getSoundbank(@NonNull File file) throws InvalidMidiDataException, IOException
Soundbank from Filefile - the Soundbank fileSoundbankInvalidMidiDataExceptionIOException@NonNull public static Soundbank getSoundbank(@NonNull InputStream stream) throws InvalidMidiDataException, IOException
Soundbank from InputStreamstream - the input stream of SoundbankSoundbankInvalidMidiDataExceptionIOException@NonNull public static Soundbank getSoundbank(@NonNull URL url) throws InvalidMidiDataException, IOException
Soundbank from URLurl - the URL of SoundbankSoundbankInvalidMidiDataExceptionIOException@Nullable public static Synthesizer getSynthesizer() throws MidiUnavailableException
Synthesizer registered by registerSynthesizer(Synthesizer)MidiUnavailableExceptionpublic static void registerSynthesizer(@NonNull Synthesizer synthesizer)
Synthesizer instance to the MidiSystem.synthesizer - the Synthesizer instance@NonNull public static MidiFileFormat getMidiFileFormat(@NonNull File file) throws InvalidMidiDataException, IOException
MidiFileFormat information of the specified File.file - the SMFMidiFileFormat informationInvalidMidiDataExceptionIOException@NonNull public static MidiFileFormat getMidiFileFormat(@NonNull InputStream stream) throws InvalidMidiDataException, IOException
MidiFileFormat information in the specified input stream.stream - the the input stream of SMFMidiFileFormat informationInvalidMidiDataExceptionIOException@NonNull public static MidiFileFormat getMidiFileFormat(@NonNull URL url) throws InvalidMidiDataException, IOException
MidiFileFormat information in the specified URL.url - the URL of SMFMidiFileFormat informationInvalidMidiDataExceptionIOException@NonNull public static int[] getMidiFileTypes()
@NonNull public static int[] getMidiFileTypes(@NonNull Sequence sequence)
Sequencesequence - the Sequencepublic static boolean isFileTypeSupported(int fileType)
fileType - the fileType of SMFpublic static boolean isFileTypeSupported(int fileType,
@NonNull
Sequence sequence)
Sequencepublic static int write(@NonNull Sequence sequence, int fileType, @NonNull File file) throws IOException
File as SMFsequence - the SequencefileType - the fileType of Sequencefile - the File to writeIOExceptionpublic static int write(@NonNull Sequence sequence, int fileType, @NonNull OutputStream outputStream) throws IOException
OutputStream as SMFsequence - the SequencefileType - the fileType of SequenceoutputStream - the OutputStream to writeIOException