Java Code Examples for javax.sound.midi.spi.SoundbankReader#getSoundbank()
The following examples show how to use
javax.sound.midi.spi.SoundbankReader#getSoundbank() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MidiSystem.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * Constructs a MIDI sound bank by reading it from the specified stream. The * stream must point to a valid MIDI soundbank file. In general, MIDI * soundbank providers may need to read some data from the stream before * determining whether they support it. These parsers must be able to mark * the stream, read enough data to determine whether they support the * stream, and, if not, reset the stream's read pointer to its original * position. If the input stream does not support this, this method may fail * with an {@code IOException}. * * @param stream the source of the sound bank data * @return the sound bank * @throws InvalidMidiDataException if the stream does not point to valid * MIDI soundbank data recognized by the system * @throws IOException if an I/O error occurred when loading the soundbank * @throws NullPointerException if {@code stream} is {@code null} * @see InputStream#markSupported * @see InputStream#mark */ public static Soundbank getSoundbank(final InputStream stream) throws InvalidMidiDataException, IOException { Objects.requireNonNull(stream); SoundbankReader sp = null; Soundbank s = null; List<SoundbankReader> providers = getSoundbankReaders(); for(int i = 0; i < providers.size(); i++) { sp = providers.get(i); s = sp.getSoundbank(stream); if( s!= null) { return s; } } throw new InvalidMidiDataException("cannot get soundbank from stream"); }
Example 2
Source File: MidiSystem.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * Constructs a {@code Soundbank} by reading it from the specified URL. The * URL must point to a valid MIDI soundbank file. * * @param url the source of the sound bank data * @return the sound bank * @throws InvalidMidiDataException if the URL does not point to valid MIDI * soundbank data recognized by the system * @throws IOException if an I/O error occurred when loading the soundbank * @throws NullPointerException if {@code url} is {@code null} */ public static Soundbank getSoundbank(final URL url) throws InvalidMidiDataException, IOException { Objects.requireNonNull(url); SoundbankReader sp = null; Soundbank s = null; List<SoundbankReader> providers = getSoundbankReaders(); for(int i = 0; i < providers.size(); i++) { sp = providers.get(i); s = sp.getSoundbank(url); if( s!= null) { return s; } } throw new InvalidMidiDataException("cannot get soundbank from stream"); }
Example 3
Source File: MidiSystem.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * Constructs a {@code Soundbank} by reading it from the specified * {@code File}. The {@code File} must point to a valid MIDI soundbank file. * * @param file the source of the sound bank data * @return the sound bank * @throws InvalidMidiDataException if the {@code File} does not point to * valid MIDI soundbank data recognized by the system * @throws IOException if an I/O error occurred when loading the soundbank * @throws NullPointerException if {@code file} is {@code null} */ public static Soundbank getSoundbank(final File file) throws InvalidMidiDataException, IOException { Objects.requireNonNull(file); SoundbankReader sp = null; Soundbank s = null; List<SoundbankReader> providers = getSoundbankReaders(); for(int i = 0; i < providers.size(); i++) { sp = providers.get(i); s = sp.getSoundbank(file); if( s!= null) { return s; } } throw new InvalidMidiDataException("cannot get soundbank from stream"); }
Example 4
Source File: MidiSystem.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Constructs a MIDI sound bank by reading it from the specified stream. The * stream must point to a valid MIDI soundbank file. In general, MIDI * soundbank providers may need to read some data from the stream before * determining whether they support it. These parsers must be able to mark * the stream, read enough data to determine whether they support the * stream, and, if not, reset the stream's read pointer to its original * position. If the input stream does not support this, this method may fail * with an {@code IOException}. * * @param stream the source of the sound bank data * @return the sound bank * @throws InvalidMidiDataException if the stream does not point to valid * MIDI soundbank data recognized by the system * @throws IOException if an I/O error occurred when loading the soundbank * @throws NullPointerException if {@code stream} is {@code null} * @see InputStream#markSupported * @see InputStream#mark */ public static Soundbank getSoundbank(final InputStream stream) throws InvalidMidiDataException, IOException { Objects.requireNonNull(stream); SoundbankReader sp = null; Soundbank s = null; List<SoundbankReader> providers = getSoundbankReaders(); for(int i = 0; i < providers.size(); i++) { sp = providers.get(i); s = sp.getSoundbank(stream); if( s!= null) { return s; } } throw new InvalidMidiDataException("cannot get soundbank from stream"); }
Example 5
Source File: MidiSystem.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Constructs a {@code Soundbank} by reading it from the specified URL. The * URL must point to a valid MIDI soundbank file. * * @param url the source of the sound bank data * @return the sound bank * @throws InvalidMidiDataException if the URL does not point to valid MIDI * soundbank data recognized by the system * @throws IOException if an I/O error occurred when loading the soundbank * @throws NullPointerException if {@code url} is {@code null} */ public static Soundbank getSoundbank(final URL url) throws InvalidMidiDataException, IOException { Objects.requireNonNull(url); SoundbankReader sp = null; Soundbank s = null; List<SoundbankReader> providers = getSoundbankReaders(); for(int i = 0; i < providers.size(); i++) { sp = providers.get(i); s = sp.getSoundbank(url); if( s!= null) { return s; } } throw new InvalidMidiDataException("cannot get soundbank from stream"); }
Example 6
Source File: MidiSystem.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Constructs a {@code Soundbank} by reading it from the specified * {@code File}. The {@code File} must point to a valid MIDI soundbank file. * * @param file the source of the sound bank data * @return the sound bank * @throws InvalidMidiDataException if the {@code File} does not point to * valid MIDI soundbank data recognized by the system * @throws IOException if an I/O error occurred when loading the soundbank * @throws NullPointerException if {@code file} is {@code null} */ public static Soundbank getSoundbank(final File file) throws InvalidMidiDataException, IOException { Objects.requireNonNull(file); SoundbankReader sp = null; Soundbank s = null; List<SoundbankReader> providers = getSoundbankReaders(); for(int i = 0; i < providers.size(); i++) { sp = providers.get(i); s = sp.getSoundbank(file); if( s!= null) { return s; } } throw new InvalidMidiDataException("cannot get soundbank from stream"); }