/** Creates new Beam from the parentInput's input stream. * The next object in the input stream must be of this type. * * @param parentInput the parent RIFF object being used to read the input stream */ public static Beam newInstance(Riff parentInput) { Riff riffInput = new Riff(parentInput, RIFF_ID); return new Beam (riffInput.readBYTE(), riffInput.readBYTE(), RiffTags.newInstance(riffInput)); }
/** Creates new Beam from the parentInput's input stream. * The next object in the input stream must be of this type. * * @param parentInput the parent RIFF object being used to read the input stream */ static public Beam newInstance(Riff parentInput) { Riff riffInput = new Riff(parentInput, RIFF_ID); return(new Beam (riffInput.readBYTE(), riffInput.readBYTE(), RiffTags.newInstance(riffInput))); }
/** Creates a new Barline from the parentInput's input stream. * The next object in the input stream must be of this type. * * @param parentInput the parent RIFF object being used to read the input stream */ static public Barline newInstance(Riff parentInput) { Riff riffInput = new Riff(parentInput, RIFF_ID); return(new Barline (convertType(riffInput.readBYTE()), convertExtendsTo(riffInput.readBYTE()), riffInput.readSHORT(), RiffTags.newInstance(riffInput))); }
/** Creates a new Barline from the parentInput's input stream. * The next object in the input stream must be of this type. * * @param parentInput the parent RIFF object being used to read the input stream */ public static Barline newInstance(Riff parentInput) { Riff riffInput = new Riff(parentInput, RIFF_ID); return new Barline (convertType(riffInput.readBYTE()), convertExtendsTo(riffInput.readBYTE()), riffInput.readSHORT(), RiffTags.newInstance(riffInput)); }
/** Creates new Clef from the parentInput's input stream. * The next object in the input stream must be of this type. * * @param parentInput the parent RIFF object being used to read the input stream */ static public Clef newInstance(Riff parentInput) { Riff riffInput = new Riff(parentInput, RIFF_ID); return(new Clef (convertShape(riffInput.readBYTE()), riffInput.readSIGNEDBYTE(), convertOctaveNumber(riffInput.readBYTE()), RiffTags.newInstance(riffInput))); }
/** Creates new Clef from the parentInput's input stream. * The next object in the input stream must be of this type. * * @param parentInput the parent RIFF object being used to read the input stream */ public static Clef newInstance(Riff parentInput) { Riff riffInput = new Riff(parentInput, RIFF_ID); return new Clef (convertShape(riffInput.readBYTE()), riffInput.readSIGNEDBYTE(), convertOctaveNumber(riffInput.readBYTE()), RiffTags.newInstance(riffInput)); }
/** Peek into the parentInput's input stream and if the next item * is a NIFF String Table, then decode it and store it in the * root RIFFForNIFF object. * If the next item is not a NIFF String Table, do nothing * and leave the input stream unchanged. * * @param parentInput the parent RIFF object being used to read the input stream. * If parentInput.getParent() is not of type RIFFForNIFF, then this * moves the input past the String Table but does not store it. * @return true if the String Table was processed, false if this is * not a String Table. */ static public bool maybeDecode(Riff parentInput) { if (!parentInput.peekFOURCC().Equals(RIFF_ID)) { return(false); } Riff riffInput = new Riff(parentInput, RIFF_ID); if (!(parentInput.getParent() is RiffForNiff)) { // There is no place to store the data riffInput.skipRemaining(); return(true); } RiffForNiff riffForNiff = (RiffForNiff)parentInput.getParent(); // Read the entire string table into a byte array byte[] stringTable = new byte[riffInput.getBytesRemaining()]; for (int i = 0; i < stringTable.Length; ++i) { stringTable[i] = (byte)riffInput.readBYTE(); } riffForNiff.setStringTable(stringTable); // This skips possible pad byte riffInput.skipRemaining(); return(true); }
/** Creates new Accidental from the parentInput's input stream. * The next object in the input stream must be of this type. * * @param parentInput the parent RIFF object being used to read the input stream */ public static Accidental newInstance(Riff parentInput) { Riff riffInput = new Riff(parentInput, RIFF_ID); return new Accidental (convertShape(riffInput.readBYTE()), RiffTags.newInstance(riffInput)); }
/** Creates new Accidental from the parentInput's input stream. * The next object in the input stream must be of this type. * * @param parentInput the parent RIFF object being used to read the input stream */ static public Accidental newInstance(Riff parentInput) { Riff riffInput = new Riff(parentInput, RIFF_ID); return(new Accidental (convertShape(riffInput.readBYTE()), RiffTags.newInstance(riffInput))); }
/** Creates a new Lyric from the parentInput's input stream. * The next object in the input stream must be of this type. * * @param parentInput the parent RIFF object being used to read the input stream */ public static Lyric newInstance(Riff parentInput) { Riff riffInput = new Riff(parentInput, RIFF_ID); String text = RiffStringTable.decodeString (RiffForNiff.getStringTable(parentInput), riffInput.readLONG()); return new Lyric (text, riffInput.readBYTE(), RiffTags.newInstance(riffInput)); }
/** Creates new Notehead from the parentInput's input stream. * The next object in the input stream must be of this type. * * @param parentInput the parent RIFF object being used to read the input stream */ public static Notehead newInstance(Riff parentInput) { Riff riffInput = new Riff(parentInput, RIFF_ID); return new Notehead (convertShape(riffInput.readBYTE()), riffInput.readSIGNEDBYTE(), new Rational(riffInput.readSHORT(), riffInput.readSHORT()), RiffTags.newInstance(riffInput)); }
/** Creates a new Lyric from the parentInput's input stream. * The next object in the input stream must be of this type. * * @param parentInput the parent RIFF object being used to read the input stream */ static public Lyric newInstance(Riff parentInput) { Riff riffInput = new Riff(parentInput, RIFF_ID); String text = RiffStringTable.decodeString (RiffForNiff.getStringTable(parentInput), riffInput.readLONG()); return(new Lyric (text, riffInput.readBYTE(), RiffTags.newInstance(riffInput))); }
/** Creates new Rest from the parentInput's input stream. * The next object in the input stream must be of this type. * * @param parentInput the parent RIFF object being used to read the input stream */ static public Rest newInstance(Riff parentInput) { Riff riffInput = new Riff(parentInput, RIFF_ID); return(new Rest (convertShape(riffInput.readBYTE()), riffInput.readSIGNEDBYTE(), new Rational(riffInput.readSHORT(), riffInput.readSHORT()), RiffTags.newInstance(riffInput))); }
/** Creates new MeasureStartTimeSlice from the parentInput's input stream. * The next object in the input stream must be a time slice with type MEASURE_START. * After creating the MeasureStartTimeSlice, you can call addTimeSlices() * to store the event time slices for this measure start time slice. * * @param parentInput the parent RIFF object being used to read the input stream * @see #addTimeSlices */ static public MeasureStartTimeSlice newInstance(Riff parentInput) { Riff riffInput = new Riff(parentInput, RIFF_ID); int type = riffInput.readBYTE(); if (type != MEASURE_START) { throw new RiffFormatException ("Expected MEASURE_START for time slice type. Got " + type + "."); } return(new MeasureStartTimeSlice (new Rational(riffInput.readSHORT(), riffInput.readSHORT()), RiffTags.newInstance(riffInput))); }
/** Creates new NIFFInfo from the parentInput's input stream. * The next object in the input stream must be of this type. * * @param parentInput the parent RIFF object being used to read the input stream */ static public NiffInfo newInstance(Riff parentInput) { Riff riffInput = new Riff(parentInput, RIFF_ID); // Read 8 bytes and convert to string byte[] buffer = new byte[8]; buffer[0] = (byte)riffInput.readBYTE(); buffer[1] = (byte)riffInput.readBYTE(); buffer[2] = (byte)riffInput.readBYTE(); buffer[3] = (byte)riffInput.readBYTE(); buffer[4] = (byte)riffInput.readBYTE(); buffer[5] = (byte)riffInput.readBYTE(); buffer[6] = (byte)riffInput.readBYTE(); buffer[7] = (byte)riffInput.readBYTE(); return(new NiffInfo (Encoding.UTF8.GetString(buffer, 0, buffer.Length), riffInput.readSIGNEDBYTE(), riffInput.readSIGNEDBYTE(), riffInput.readSHORT(), riffInput.readSHORT())); }
/** Creates new NIFFInfo from the parentInput's input stream. * The next object in the input stream must be of this type. * * @param parentInput the parent RIFF object being used to read the input stream */ public static NiffInfo newInstance(Riff parentInput) { Riff riffInput = new Riff (parentInput, RIFF_ID); // Read 8 bytes and convert to string byte[] buffer = new byte[8]; buffer[0] = (byte)riffInput.readBYTE(); buffer[1] = (byte)riffInput.readBYTE(); buffer[2] = (byte)riffInput.readBYTE(); buffer[3] = (byte)riffInput.readBYTE(); buffer[4] = (byte)riffInput.readBYTE(); buffer[5] = (byte)riffInput.readBYTE(); buffer[6] = (byte)riffInput.readBYTE(); buffer[7] = (byte)riffInput.readBYTE(); return new NiffInfo (Encoding.UTF8.GetString(buffer, 0, buffer.Length), riffInput.readSIGNEDBYTE(), riffInput.readSIGNEDBYTE(), riffInput.readSHORT(), riffInput.readSHORT()); }
/** Creates new TimeSlice from the parentInput's input stream. * The next object in the input stream must be a time slice with * a type any other than MEASURE_START (which means the type should * be EVENT). * After creating the TimeSlice, you can call addMusicSymbols() * to store the music symbols for this time slice. * * @param parentInput the parent RIFF object being used to read the input stream * @see #addMusicSymbols */ static public TimeSlice newInstance(Riff parentInput) { Riff riffInput = new Riff(parentInput, RIFF_ID); int type = riffInput.readBYTE(); if (type == MEASURE_START) { throw new RiffFormatException ("Did not expect a time slice with type MEASURE_START."); } else if (type != EVENT) { throw new RiffFormatException ("Expected EVENT for time slice type. Got " + type + "."); } return(new TimeSlice (new Rational(riffInput.readSHORT(), riffInput.readSHORT()), RiffTags.newInstance(riffInput))); }
/** Creates new TimeSlice from the parentInput's input stream. * The next object in the input stream must be a time slice with * a type any other than MEASURE_START (which means the type should * be EVENT). * After creating the TimeSlice, you can call addMusicSymbols() * to store the music symbols for this time slice. * * @param parentInput the parent RIFF object being used to read the input stream * @see #addMusicSymbols */ public static TimeSlice newInstance(Riff parentInput) { Riff riffInput = new Riff(parentInput, RIFF_ID); int type = riffInput.readBYTE(); if (type == MEASURE_START) throw new RiffFormatException ("Did not expect a time slice with type MEASURE_START."); else if (type != EVENT) throw new RiffFormatException ("Expected EVENT for time slice type. Got " + type + "."); return new TimeSlice (new Rational(riffInput.readSHORT(), riffInput.readSHORT()), RiffTags.newInstance(riffInput)); }
/** Creates new MeasureStartTimeSlice from the parentInput's input stream. * The next object in the input stream must be a time slice with type MEASURE_START. * After creating the MeasureStartTimeSlice, you can call addTimeSlices() * to store the event time slices for this measure start time slice. * * @param parentInput the parent RIFF object being used to read the input stream * @see #addTimeSlices */ public static MeasureStartTimeSlice newInstance(Riff parentInput) { Riff riffInput = new Riff(parentInput, RIFF_ID); int type = riffInput.readBYTE(); if (type != MEASURE_START) throw new RiffFormatException ("Expected MEASURE_START for time slice type. Got " + type + "."); return new MeasureStartTimeSlice (new Rational(riffInput.readSHORT(), riffInput.readSHORT()), RiffTags.newInstance(riffInput)); }
/** Peek into the parentInput's input stream and if the next item * is a NIFF String Table, then decode it and store it in the * root RIFFForNIFF object. * If the next item is not a NIFF String Table, do nothing * and leave the input stream unchanged. * * @param parentInput the parent RIFF object being used to read the input stream. * If parentInput.getParent() is not of type RIFFForNIFF, then this * moves the input past the String Table but does not store it. * @return true if the String Table was processed, false if this is * not a String Table. */ public static bool maybeDecode(Riff parentInput) { if (!parentInput.peekFOURCC().Equals(RIFF_ID)) return false; Riff riffInput = new Riff(parentInput, RIFF_ID); if (!(parentInput.getParent() is RiffForNiff)) { // There is no place to store the data riffInput.skipRemaining(); return true; } RiffForNiff riffForNiff = (RiffForNiff)parentInput.getParent(); // Read the entire string table into a byte array byte[] stringTable = new byte[riffInput.getBytesRemaining()]; for (int i = 0; i < stringTable.Length; ++i) stringTable[i] = (byte)riffInput.readBYTE(); riffForNiff.setStringTable(stringTable); // This skips possible pad byte riffInput.skipRemaining(); return true; }