Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
javax.sound.midi.MidiSystem
public class MidiSystem
extends Object
Method Summary | |
static MidiDevice |
|
static MidiDevice.Info[] |
|
static MidiFileFormat |
|
static MidiFileFormat |
|
static MidiFileFormat |
|
static int[] |
|
static int[] |
|
static Receiver |
|
static Sequence |
|
static Sequence |
|
static Sequence |
|
static Sequencer |
|
static Soundbank |
|
static Soundbank |
|
static Soundbank |
|
static Synthesizer |
|
static Transmitter |
|
static boolean |
|
static boolean |
|
static int | |
static int |
|
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
public static MidiDevice getMidiDevice(MidiDevice.Info info) throws MidiUnavailableException
Get the specified MIDI device.
- Parameters:
info
- a description of the device we're looking for
- Returns:
- the requested MIDI device
- Throws:
MidiUnavailableException
- if no MIDI devices are configured or foundIllegalArgumentException
- if the device described by info is not found
public static MidiDevice.Info[] getMidiDeviceInfo()
Get an array of all available MIDI devices.
- Returns:
- a possibly empty array of all available MIDI devices
public static MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException
Read a MidiFileFormat object from the given file.
- Parameters:
file
- the file from which to read the MidiFileFormat
- Returns:
- the MidiFileFormat object
- Throws:
InvalidMidiDataException
- if we were unable to read the MidiFileFormatIOException
- if an I/O error happened while reading
public static MidiFileFormat getMidiFileFormat(InputStream stream) throws InvalidMidiDataException, IOException
Read a MidiFileFormat object from the given stream.
- Parameters:
stream
- the stream from which to read the MidiFileFormat
- Returns:
- the MidiFileFormat object
- Throws:
InvalidMidiDataException
- if we were unable to read the MidiFileFormatIOException
- if an I/O error happened while reading
public static MidiFileFormat getMidiFileFormat(URL url) throws InvalidMidiDataException, IOException
Read a MidiFileFormat object from the given url.
- Parameters:
url
- the url from which to read the MidiFileFormat
- Returns:
- the MidiFileFormat object
- Throws:
InvalidMidiDataException
- if we were unable to read the MidiFileFormatIOException
- if an I/O error happened while reading
public static int[] getMidiFileTypes()
Return an array of supported MIDI file types on this system.
- Returns:
- the array of supported MIDI file types
public static int[] getMidiFileTypes(Sequence sequence)
Return an array of supported MIDI file types on this system for the given sequnce.
- Parameters:
sequence
- the sequnce to write
- Returns:
- the array of supported MIDI file types
public static Receiver getReceiver() throws MidiUnavailableException
Get the default Receiver instance. This just picks the first one it finds for now.
- Returns:
- the default Receiver instance
- Throws:
MidiUnavailableException
- if no Receiver is found
public static Sequence getSequence(File file) throws InvalidMidiDataException, IOException
Read a Sequence object from the given file.
- Parameters:
file
- the file from which to read the Sequence
- Returns:
- the Sequence object
- Throws:
InvalidMidiDataException
- if we were unable to read the SequenceIOException
- if an I/O error happened while reading
public static Sequence getSequence(InputStream stream) throws InvalidMidiDataException, IOException
Read a Sequence object from the given stream.
- Parameters:
stream
- the stream from which to read the Sequence
- Returns:
- the Sequence object
- Throws:
InvalidMidiDataException
- if we were unable to read the SequenceIOException
- if an I/O error happened while reading
public static Sequence getSequence(URL url) throws InvalidMidiDataException, IOException
Read a Sequence object from the given url.
- Parameters:
url
- the url from which to read the Sequence
- Returns:
- the Sequence object
- Throws:
InvalidMidiDataException
- if we were unable to read the SequenceIOException
- if an I/O error happened while reading
public static Sequencer getSequencer() throws MidiUnavailableException
Get the default Sequencer instance. This just picks the first one it finds for now.
- Returns:
- the default Sequencer instance
- Throws:
MidiUnavailableException
- if no Sequencer is found
public static Soundbank getSoundbank(File file) throws InvalidMidiDataException, IOException
Read a Soundbank object from the given file.
- Parameters:
file
- the file from which to read the Soundbank
- Returns:
- the Soundbank object
- Throws:
InvalidMidiDataException
- if we were unable to read the soundbankIOException
- if an I/O error happened while reading
public static Soundbank getSoundbank(InputStream stream) throws InvalidMidiDataException, IOException
Read a Soundbank object from the given stream.
- Parameters:
stream
- the stream from which to read the Soundbank
- Returns:
- the Soundbank object
- Throws:
InvalidMidiDataException
- if we were unable to read the soundbankIOException
- if an I/O error happened while reading
public static Soundbank getSoundbank(URL url) throws InvalidMidiDataException, IOException
Read a Soundbank object from the given url.
- Parameters:
url
- the url from which to read the Soundbank
- Returns:
- the Soundbank object
- Throws:
InvalidMidiDataException
- if we were unable to read the soundbankIOException
- if an I/O error happened while reading
public static Synthesizer getSynthesizer() throws MidiUnavailableException
Get the default Synthesizer instance. This just picks the first one it finds for now.
- Returns:
- the default Synthesizer instance
- Throws:
MidiUnavailableException
- if no Synthesizer is found
public static Transmitter getTransmitter() throws MidiUnavailableException
Get the default Transmitter instance. This just picks the first one it finds for now.
- Returns:
- the default Transmitter instance
- Throws:
MidiUnavailableException
- if no Transmitter is found
public static boolean isFileTypeSupported(int fileType)
Return true if the system supports writing files of type fileType.
- Parameters:
fileType
- the MIDI file type we want to write
- Returns:
- true if we can write fileType files, false otherwise
public static boolean isFileTypeSupported(int fileType, Sequence sequence)
Return true if the system supports writing files of type fileType for the given sequence.
- Parameters:
fileType
- the MIDI file type we want to writesequence
- the Sequence we want to write
- Returns:
- true if we can write fileType files for sequence, false otherwise
public static int write(Sequence in, int fileType, File out) throws IOException
Write a sequence to a file using a specific MIDI file format.
- Parameters:
in
- the sequence to writefileType
- the MIDI file format to useout
- the file to write to
- Returns:
- the number of bytes written
- Throws:
IOException
- if an I/O exception happensIllegalArgumentException
- if fileType is not supported for in
public static int write(Sequence in, int fileType, OutputStream out) throws IOException
Write a sequence to an output stream using a specific MIDI file format.
- Parameters:
in
- the sequence to writefileType
- the MIDI file format to useout
- the output stream to write to
- Returns:
- the number of bytes written
- Throws:
IOException
- if an I/O exception happensIllegalArgumentException
- if fileType is not supported for in