6321N/A * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * @author Kara Kytle 0N/A * @author Jan Borgersen 0N/A * @author Florian Bomers 0N/A private static final int bisBufferSize =
1024;
// buffer size in buffered input streams 0N/A // $$fb 2002-04-17: part of fix for 4635286: MidiSystem.getMidiFileFormat() returns format having invalid length 0N/A // read header length 0N/A // decipher the timing code 0N/A // tempo based timing. value is ticks per beat. 0N/A // SMPTE based timing. first decipher the frame code. 0N/A // now determine the timing resolution in ticks per frame. 0N/A // remainder of this chunk 0N/A // if only reading the file format, reset the stream 0N/A // $$fb 2002-04-17: part of fix for 4635286: MidiSystem.getMidiFileFormat() returns format having invalid length 0N/A // must be MIDI Type 0 or Type 1 0N/A // construct the sequence object 0N/A // for each track, go to the beginning and read the track events 0N/A//============================================================================================================= 0N/A * State variables during parsing of a MIDI file 0N/A // set to true to not allow corrupt MIDI files tombe loaded 0N/A private static final boolean DEBUG =
false;
0N/A long value =
0;
// the variable-lengh int value 0N/A // $$fb 2003-08-20: fix for 4910986: MIDI file parser breaks up on http connection 0N/A // now read track in a byte array 0N/A // $$fb 2003-08-20: fix for 4910986: MIDI file parser breaks up on http connection 0N/A // reset current tick to 0 0N/A // reset current status byte to 0 (invalid value). 0N/A // this should cause us to throw an InvalidMidiDataException if we don't 0N/A // get a valid status byte from the beginning of the track. 0N/A int data1 = -
1;
// initialize to invalid value 0N/A // each event has a tick delay and then the event data. 0N/A // first read the delay (a variable-length int) and update our tick value 0N/A // check for new status 0N/A // end of track means it! 0N/A }
// switch sys-ex or meta