| |
e717. Playing Streaming Midi Audio
Supported audio file formats: mid, rmf
try {
Sequencer sequencer = MidiSystem.getSequencer();
sequencer.open();
// From file
InputStream is = new BufferedInputStream(
new FileInputStream(new File("midifile")));
// From URL
is = new BufferedInputStream(
new URL("http://hostname/rmffile").openStream());
sequencer.setSequence(is);
// Start playing
sequencer.start();
} catch (MalformedURLException e) {
} catch (IOException e) {
} catch (MidiUnavailableException e) {
} catch (InvalidMidiDataException e) {
}
e716.
Loading and Playing Midi Audio
© 2002 Addison-Wesley.
|