javax.sound.midi.MidiFileFormat Java Examples
The following examples show how to use
javax.sound.midi.MidiFileFormat.
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: StandardMidiFileReader.java From hottub with GNU General Public License v2.0 | 6 votes |
public MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException { FileInputStream fis = new FileInputStream(file); // throws IOException BufferedInputStream bis = new BufferedInputStream(fis, bisBufferSize); // $$fb 2002-04-17: part of fix for 4635286: MidiSystem.getMidiFileFormat() returns format having invalid length long length = file.length(); if (length > Integer.MAX_VALUE) { length = MidiFileFormat.UNKNOWN_LENGTH; } MidiFileFormat fileFormat = null; try { fileFormat = getMidiFileFormatFromStream(bis, (int) length, null); } finally { bis.close(); } return fileFormat; }
Example #2
Source File: StandardMidiFileReader.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public Sequence getSequence(InputStream stream) throws InvalidMidiDataException, IOException { SMFParser smfParser = new SMFParser(); MidiFileFormat format = getMidiFileFormatFromStream(stream, MidiFileFormat.UNKNOWN_LENGTH, smfParser); // must be MIDI Type 0 or Type 1 if ((format.getType() != 0) && (format.getType() != 1)) { throw new InvalidMidiDataException("Invalid or unsupported file type: " + format.getType()); } // construct the sequence object Sequence sequence = new Sequence(format.getDivisionType(), format.getResolution()); // for each track, go to the beginning and read the track events for (int i = 0; i < smfParser.tracks; i++) { if (smfParser.nextTrack()) { smfParser.readTrack(sequence.createTrack()); } else { break; } } return sequence; }
Example #3
Source File: StandardMidiFileReader.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public Sequence getSequence(InputStream stream) throws InvalidMidiDataException, IOException { SMFParser smfParser = new SMFParser(); MidiFileFormat format = getMidiFileFormatFromStream(stream, MidiFileFormat.UNKNOWN_LENGTH, smfParser); // must be MIDI Type 0 or Type 1 if ((format.getType() != 0) && (format.getType() != 1)) { throw new InvalidMidiDataException("Invalid or unsupported file type: " + format.getType()); } // construct the sequence object Sequence sequence = new Sequence(format.getDivisionType(), format.getResolution()); // for each track, go to the beginning and read the track events for (int i = 0; i < smfParser.tracks; i++) { if (smfParser.nextTrack()) { smfParser.readTrack(sequence.createTrack()); } else { break; } } return sequence; }
Example #4
Source File: StandardMidiFileReader.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException { FileInputStream fis = new FileInputStream(file); // throws IOException BufferedInputStream bis = new BufferedInputStream(fis, bisBufferSize); // $$fb 2002-04-17: part of fix for 4635286: MidiSystem.getMidiFileFormat() returns format having invalid length long length = file.length(); if (length > Integer.MAX_VALUE) { length = MidiFileFormat.UNKNOWN_LENGTH; } MidiFileFormat fileFormat = null; try { fileFormat = getMidiFileFormatFromStream(bis, (int) length, null); } finally { bis.close(); } return fileFormat; }
Example #5
Source File: StandardMidiFileReader.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException { FileInputStream fis = new FileInputStream(file); // throws IOException BufferedInputStream bis = new BufferedInputStream(fis, bisBufferSize); // $$fb 2002-04-17: part of fix for 4635286: MidiSystem.getMidiFileFormat() returns format having invalid length long length = file.length(); if (length > Integer.MAX_VALUE) { length = MidiFileFormat.UNKNOWN_LENGTH; } MidiFileFormat fileFormat = null; try { fileFormat = getMidiFileFormatFromStream(bis, (int) length, null); } finally { bis.close(); } return fileFormat; }
Example #6
Source File: StandardMidiFileReader.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public Sequence getSequence(InputStream stream) throws InvalidMidiDataException, IOException { SMFParser smfParser = new SMFParser(); MidiFileFormat format = getMidiFileFormatFromStream(stream, MidiFileFormat.UNKNOWN_LENGTH, smfParser); // must be MIDI Type 0 or Type 1 if ((format.getType() != 0) && (format.getType() != 1)) { throw new InvalidMidiDataException("Invalid or unsupported file type: " + format.getType()); } // construct the sequence object Sequence sequence = new Sequence(format.getDivisionType(), format.getResolution()); // for each track, go to the beginning and read the track events for (int i = 0; i < smfParser.tracks; i++) { if (smfParser.nextTrack()) { smfParser.readTrack(sequence.createTrack()); } else { break; } } return sequence; }
Example #7
Source File: StandardMidiFileReader.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override public Sequence getSequence(InputStream stream) throws InvalidMidiDataException, IOException { SMFParser smfParser = new SMFParser(); MidiFileFormat format = getMidiFileFormatFromStream(stream, MidiFileFormat.UNKNOWN_LENGTH, smfParser); // must be MIDI Type 0 or Type 1 if ((format.getType() != 0) && (format.getType() != 1)) { throw new InvalidMidiDataException("Invalid or unsupported file type: " + format.getType()); } // construct the sequence object Sequence sequence = new Sequence(format.getDivisionType(), format.getResolution()); // for each track, go to the beginning and read the track events for (int i = 0; i < smfParser.tracks; i++) { if (smfParser.nextTrack()) { smfParser.readTrack(sequence.createTrack()); } else { break; } } return sequence; }
Example #8
Source File: StandardMidiFileReader.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override public MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException { FileInputStream fis = new FileInputStream(file); // throws IOException BufferedInputStream bis = new BufferedInputStream(fis, bisBufferSize); // $$fb 2002-04-17: part of fix for 4635286: MidiSystem.getMidiFileFormat() returns format having invalid length long length = file.length(); if (length > Integer.MAX_VALUE) { length = MidiFileFormat.UNKNOWN_LENGTH; } MidiFileFormat fileFormat = null; try { fileFormat = getMidiFileFormatFromStream(bis, (int) length, null); } finally { bis.close(); } return fileFormat; }
Example #9
Source File: StandardMidiFileReader.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException { FileInputStream fis = new FileInputStream(file); // throws IOException BufferedInputStream bis = new BufferedInputStream(fis, bisBufferSize); // $$fb 2002-04-17: part of fix for 4635286: MidiSystem.getMidiFileFormat() returns format having invalid length long length = file.length(); if (length > Integer.MAX_VALUE) { length = MidiFileFormat.UNKNOWN_LENGTH; } MidiFileFormat fileFormat = null; try { fileFormat = getMidiFileFormatFromStream(bis, (int) length, null); } finally { bis.close(); } return fileFormat; }
Example #10
Source File: StandardMidiFileReader.java From hottub with GNU General Public License v2.0 | 6 votes |
public Sequence getSequence(InputStream stream) throws InvalidMidiDataException, IOException { SMFParser smfParser = new SMFParser(); MidiFileFormat format = getMidiFileFormatFromStream(stream, MidiFileFormat.UNKNOWN_LENGTH, smfParser); // must be MIDI Type 0 or Type 1 if ((format.getType() != 0) && (format.getType() != 1)) { throw new InvalidMidiDataException("Invalid or unsupported file type: " + format.getType()); } // construct the sequence object Sequence sequence = new Sequence(format.getDivisionType(), format.getResolution()); // for each track, go to the beginning and read the track events for (int i = 0; i < smfParser.tracks; i++) { if (smfParser.nextTrack()) { smfParser.readTrack(sequence.createTrack()); } else { break; } } return sequence; }
Example #11
Source File: StandardMidiFileReader.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException { FileInputStream fis = new FileInputStream(file); // throws IOException BufferedInputStream bis = new BufferedInputStream(fis, bisBufferSize); // $$fb 2002-04-17: part of fix for 4635286: MidiSystem.getMidiFileFormat() returns format having invalid length long length = file.length(); if (length > Integer.MAX_VALUE) { length = MidiFileFormat.UNKNOWN_LENGTH; } MidiFileFormat fileFormat = null; try { fileFormat = getMidiFileFormatFromStream(bis, (int) length, null); } finally { bis.close(); } return fileFormat; }
Example #12
Source File: StandardMidiFileReader.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public Sequence getSequence(InputStream stream) throws InvalidMidiDataException, IOException { SMFParser smfParser = new SMFParser(); MidiFileFormat format = getMidiFileFormatFromStream(stream, MidiFileFormat.UNKNOWN_LENGTH, smfParser); // must be MIDI Type 0 or Type 1 if ((format.getType() != 0) && (format.getType() != 1)) { throw new InvalidMidiDataException("Invalid or unsupported file type: " + format.getType()); } // construct the sequence object Sequence sequence = new Sequence(format.getDivisionType(), format.getResolution()); // for each track, go to the beginning and read the track events for (int i = 0; i < smfParser.tracks; i++) { if (smfParser.nextTrack()) { smfParser.readTrack(sequence.createTrack()); } else { break; } } return sequence; }
Example #13
Source File: StandardMidiFileReader.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException { FileInputStream fis = new FileInputStream(file); // throws IOException BufferedInputStream bis = new BufferedInputStream(fis, bisBufferSize); // $$fb 2002-04-17: part of fix for 4635286: MidiSystem.getMidiFileFormat() returns format having invalid length long length = file.length(); if (length > Integer.MAX_VALUE) { length = MidiFileFormat.UNKNOWN_LENGTH; } MidiFileFormat fileFormat = null; try { fileFormat = getMidiFileFormatFromStream(bis, (int) length, null); } finally { bis.close(); } return fileFormat; }
Example #14
Source File: StandardMidiFileReader.java From Bytecoder with Apache License 2.0 | 6 votes |
@Override public MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException { FileInputStream fis = new FileInputStream(file); // throws IOException BufferedInputStream bis = new BufferedInputStream(fis, bisBufferSize); // $$fb 2002-04-17: part of fix for 4635286: MidiSystem.getMidiFileFormat() returns format having invalid length long length = file.length(); if (length > Integer.MAX_VALUE) { length = MidiFileFormat.UNKNOWN_LENGTH; } MidiFileFormat fileFormat = null; try { fileFormat = getMidiFileFormatFromStream(bis, (int) length, null); } finally { bis.close(); } return fileFormat; }
Example #15
Source File: StandardMidiFileReader.java From Bytecoder with Apache License 2.0 | 6 votes |
@Override public Sequence getSequence(InputStream stream) throws InvalidMidiDataException, IOException { SMFParser smfParser = new SMFParser(); MidiFileFormat format = getMidiFileFormatFromStream(stream, MidiFileFormat.UNKNOWN_LENGTH, smfParser); // must be MIDI Type 0 or Type 1 if ((format.getType() != 0) && (format.getType() != 1)) { throw new InvalidMidiDataException("Invalid or unsupported file type: " + format.getType()); } // construct the sequence object Sequence sequence = new Sequence(format.getDivisionType(), format.getResolution()); // for each track, go to the beginning and read the track events for (int i = 0; i < smfParser.tracks; i++) { if (smfParser.nextTrack()) { smfParser.readTrack(sequence.createTrack()); } else { break; } } return sequence; }
Example #16
Source File: StandardMidiFileReader.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public MidiFileFormat getMidiFileFormat(URL url) throws InvalidMidiDataException, IOException { InputStream urlStream = url.openStream(); // throws IOException BufferedInputStream bis = new BufferedInputStream( urlStream, bisBufferSize ); MidiFileFormat fileFormat = null; try { fileFormat = getMidiFileFormat( bis ); // throws InvalidMidiDataException } finally { bis.close(); } return fileFormat; }
Example #17
Source File: JavaSoundAudioClip.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public JavaSoundAudioClip(InputStream in) throws IOException { if (DEBUG || Printer.debug)Printer.debug("JavaSoundAudioClip.<init>"); BufferedInputStream bis = new BufferedInputStream(in, STREAM_BUFFER_SIZE); bis.mark(STREAM_BUFFER_SIZE); boolean success = false; try { AudioInputStream as = AudioSystem.getAudioInputStream(bis); // load the stream data into memory success = loadAudioData(as); if (success) { success = false; if (loadedAudioByteLength < CLIP_THRESHOLD) { success = createClip(); } if (!success) { success = createSourceDataLine(); } } } catch (UnsupportedAudioFileException e) { // not an audio file try { MidiFileFormat mff = MidiSystem.getMidiFileFormat(bis); success = createSequencer(bis); } catch (InvalidMidiDataException e1) { success = false; } } if (!success) { throw new IOException("Unable to create AudioClip from input stream"); } }
Example #18
Source File: StandardMidiFileReader.java From hottub with GNU General Public License v2.0 | 5 votes |
public MidiFileFormat getMidiFileFormat(URL url) throws InvalidMidiDataException, IOException { InputStream urlStream = url.openStream(); // throws IOException BufferedInputStream bis = new BufferedInputStream( urlStream, bisBufferSize ); MidiFileFormat fileFormat = null; try { fileFormat = getMidiFileFormat( bis ); // throws InvalidMidiDataException } finally { bis.close(); } return fileFormat; }
Example #19
Source File: JavaSoundAudioClip.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public JavaSoundAudioClip(InputStream in) throws IOException { if (DEBUG || Printer.debug)Printer.debug("JavaSoundAudioClip.<init>"); BufferedInputStream bis = new BufferedInputStream(in, STREAM_BUFFER_SIZE); bis.mark(STREAM_BUFFER_SIZE); boolean success = false; try { AudioInputStream as = AudioSystem.getAudioInputStream(bis); // load the stream data into memory success = loadAudioData(as); if (success) { success = false; if (loadedAudioByteLength < CLIP_THRESHOLD) { success = createClip(); } if (!success) { success = createSourceDataLine(); } } } catch (UnsupportedAudioFileException e) { // not an audio file try { MidiFileFormat mff = MidiSystem.getMidiFileFormat(bis); success = createSequencer(bis); } catch (InvalidMidiDataException e1) { success = false; } } if (!success) { throw new IOException("Unable to create AudioClip from input stream"); } }
Example #20
Source File: JavaSoundAudioClip.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public JavaSoundAudioClip(InputStream in) throws IOException { if (DEBUG || Printer.debug)Printer.debug("JavaSoundAudioClip.<init>"); BufferedInputStream bis = new BufferedInputStream(in, STREAM_BUFFER_SIZE); bis.mark(STREAM_BUFFER_SIZE); boolean success = false; try { AudioInputStream as = AudioSystem.getAudioInputStream(bis); // load the stream data into memory success = loadAudioData(as); if (success) { success = false; if (loadedAudioByteLength < CLIP_THRESHOLD) { success = createClip(); } if (!success) { success = createSourceDataLine(); } } } catch (UnsupportedAudioFileException e) { // not an audio file try { MidiFileFormat mff = MidiSystem.getMidiFileFormat(bis); success = createSequencer(bis); } catch (InvalidMidiDataException e1) { success = false; } } if (!success) { throw new IOException("Unable to create AudioClip from input stream"); } }
Example #21
Source File: StandardMidiFileReader.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public MidiFileFormat getMidiFileFormat(URL url) throws InvalidMidiDataException, IOException { InputStream urlStream = url.openStream(); // throws IOException BufferedInputStream bis = new BufferedInputStream( urlStream, bisBufferSize ); MidiFileFormat fileFormat = null; try { fileFormat = getMidiFileFormat( bis ); // throws InvalidMidiDataException } finally { bis.close(); } return fileFormat; }
Example #22
Source File: StandardMidiFileReader.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public MidiFileFormat getMidiFileFormat(URL url) throws InvalidMidiDataException, IOException { InputStream urlStream = url.openStream(); // throws IOException BufferedInputStream bis = new BufferedInputStream( urlStream, bisBufferSize ); MidiFileFormat fileFormat = null; try { fileFormat = getMidiFileFormat( bis ); // throws InvalidMidiDataException } finally { bis.close(); } return fileFormat; }
Example #23
Source File: JavaSoundAudioClip.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public JavaSoundAudioClip(InputStream in) throws IOException { if (DEBUG || Printer.debug)Printer.debug("JavaSoundAudioClip.<init>"); BufferedInputStream bis = new BufferedInputStream(in, STREAM_BUFFER_SIZE); bis.mark(STREAM_BUFFER_SIZE); boolean success = false; try { AudioInputStream as = AudioSystem.getAudioInputStream(bis); // load the stream data into memory success = loadAudioData(as); if (success) { success = false; if (loadedAudioByteLength < CLIP_THRESHOLD) { success = createClip(); } if (!success) { success = createSourceDataLine(); } } } catch (UnsupportedAudioFileException e) { // not an audio file try { MidiFileFormat mff = MidiSystem.getMidiFileFormat(bis); success = createSequencer(bis); } catch (InvalidMidiDataException e1) { success = false; } } if (!success) { throw new IOException("Unable to create AudioClip from input stream"); } }
Example #24
Source File: StandardMidiFileReader.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public MidiFileFormat getMidiFileFormat(URL url) throws InvalidMidiDataException, IOException { InputStream urlStream = url.openStream(); // throws IOException BufferedInputStream bis = new BufferedInputStream( urlStream, bisBufferSize ); MidiFileFormat fileFormat = null; try { fileFormat = getMidiFileFormat( bis ); // throws InvalidMidiDataException } finally { bis.close(); } return fileFormat; }
Example #25
Source File: JavaSoundAudioClip.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public JavaSoundAudioClip(InputStream in) throws IOException { if (DEBUG || Printer.debug)Printer.debug("JavaSoundAudioClip.<init>"); BufferedInputStream bis = new BufferedInputStream(in, STREAM_BUFFER_SIZE); bis.mark(STREAM_BUFFER_SIZE); boolean success = false; try { AudioInputStream as = AudioSystem.getAudioInputStream(bis); // load the stream data into memory success = loadAudioData(as); if (success) { success = false; if (loadedAudioByteLength < CLIP_THRESHOLD) { success = createClip(); } if (!success) { success = createSourceDataLine(); } } } catch (UnsupportedAudioFileException e) { // not an audio file try { MidiFileFormat mff = MidiSystem.getMidiFileFormat(bis); success = createSequencer(bis); } catch (InvalidMidiDataException e1) { success = false; } } if (!success) { throw new IOException("Unable to create AudioClip from input stream"); } }
Example #26
Source File: JavaSoundAudioClip.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public JavaSoundAudioClip(InputStream in) throws IOException { if (DEBUG || Printer.debug)Printer.debug("JavaSoundAudioClip.<init>"); BufferedInputStream bis = new BufferedInputStream(in, STREAM_BUFFER_SIZE); bis.mark(STREAM_BUFFER_SIZE); boolean success = false; try { AudioInputStream as = AudioSystem.getAudioInputStream(bis); // load the stream data into memory success = loadAudioData(as); if (success) { success = false; if (loadedAudioByteLength < CLIP_THRESHOLD) { success = createClip(); } if (!success) { success = createSourceDataLine(); } } } catch (UnsupportedAudioFileException e) { // not an audio file try { MidiFileFormat mff = MidiSystem.getMidiFileFormat(bis); success = createSequencer(bis); } catch (InvalidMidiDataException e1) { success = false; } } if (!success) { throw new IOException("Unable to create AudioClip from input stream"); } }
Example #27
Source File: JavaSoundAudioClip.java From Bytecoder with Apache License 2.0 | 5 votes |
private void init(InputStream in) throws IOException { BufferedInputStream bis = new BufferedInputStream(in, STREAM_BUFFER_SIZE); bis.mark(STREAM_BUFFER_SIZE); try { AudioInputStream as = AudioSystem.getAudioInputStream(bis); // load the stream data into memory success = loadAudioData(as); if (success) { success = false; if (loadedAudioByteLength < CLIP_THRESHOLD) { success = createClip(); } if (!success) { success = createSourceDataLine(); } } } catch (UnsupportedAudioFileException e) { // not an audio file try { MidiFileFormat mff = MidiSystem.getMidiFileFormat(bis); success = createSequencer(bis); } catch (InvalidMidiDataException e1) { success = false; } } }
Example #28
Source File: JavaSoundAudioClip.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public JavaSoundAudioClip(InputStream in) throws IOException { if (DEBUG || Printer.debug)Printer.debug("JavaSoundAudioClip.<init>"); BufferedInputStream bis = new BufferedInputStream(in, STREAM_BUFFER_SIZE); bis.mark(STREAM_BUFFER_SIZE); boolean success = false; try { AudioInputStream as = AudioSystem.getAudioInputStream(bis); // load the stream data into memory success = loadAudioData(as); if (success) { success = false; if (loadedAudioByteLength < CLIP_THRESHOLD) { success = createClip(); } if (!success) { success = createSourceDataLine(); } } } catch (UnsupportedAudioFileException e) { // not an audio file try { MidiFileFormat mff = MidiSystem.getMidiFileFormat(bis); success = createSequencer(bis); } catch (InvalidMidiDataException e1) { success = false; } } if (!success) { throw new IOException("Unable to create AudioClip from input stream"); } }
Example #29
Source File: StandardMidiFileReader.java From Bytecoder with Apache License 2.0 | 5 votes |
@Override public MidiFileFormat getMidiFileFormat(URL url) throws InvalidMidiDataException, IOException { InputStream urlStream = url.openStream(); // throws IOException BufferedInputStream bis = new BufferedInputStream( urlStream, bisBufferSize ); MidiFileFormat fileFormat = null; try { fileFormat = getMidiFileFormat( bis ); // throws InvalidMidiDataException } finally { bis.close(); } return fileFormat; }
Example #30
Source File: JavaSoundAudioClip.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public JavaSoundAudioClip(InputStream in) throws IOException { if (DEBUG || Printer.debug)Printer.debug("JavaSoundAudioClip.<init>"); BufferedInputStream bis = new BufferedInputStream(in, STREAM_BUFFER_SIZE); bis.mark(STREAM_BUFFER_SIZE); boolean success = false; try { AudioInputStream as = AudioSystem.getAudioInputStream(bis); // load the stream data into memory success = loadAudioData(as); if (success) { success = false; if (loadedAudioByteLength < CLIP_THRESHOLD) { success = createClip(); } if (!success) { success = createSourceDataLine(); } } } catch (UnsupportedAudioFileException e) { // not an audio file try { MidiFileFormat mff = MidiSystem.getMidiFileFormat(bis); success = createSequencer(bis); } catch (InvalidMidiDataException e1) { success = false; } } if (!success) { throw new IOException("Unable to create AudioClip from input stream"); } }