/** Creates new StaffSystem 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 StaffSystem newInstance(Riff parentInput) { Riff riffInput = new Riff(parentInput, "LIST"); riffInput.requireFOURCC(RIFF_ID); StaffSystem staffSystem = new StaffSystem (RiffStaffSystemHeader.newInstance(riffInput)); // debug: check for NIFFStaffGrouping while (riffInput.getBytesRemaining() > 0) { Staff staff; if ((staff = RiffStaff.maybeNew(riffInput)) != null) { // Call addChild() which will set the child's parent to this. staffSystem.addStaff(staff); } // debug: must check for NIFFFontSymbol, etc. else { // Did not recognize the chunk type, so skip riffInput.skipChunk(); } } return(staffSystem); }
/** Creates new Page 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 Page newInstance(Riff parentInput) { Riff riffInput = new Riff(parentInput, "LIST"); riffInput.requireFOURCC(RIFF_ID); Page page = new Page(RiffPageHeader.newInstance(riffInput)); while (riffInput.getBytesRemaining() > 0) { StaffSystem staffSystem; if ((staffSystem = RiffStaffSystem.maybeNew(riffInput)) != null) { page.addSystem(staffSystem); } // debug: must check for NIFFFontSymbol, etc. else { // Did not recognize the chunk type, so skip riffInput.skipChunk(); } } return(page); }
/** Creates new ScoreSetup 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 ScoreSetup newInstance(Riff parentInput) { Riff riffInput = new Riff(parentInput, "LIST"); riffInput.requireFOURCC(RIFF_ID); NiffInfo niffInfo = null; ChunkLengthTable chunkLengthTable = null; PartsList partsList = null; while (riffInput.getBytesRemaining() > 0) { Object obj; if ((obj = RiffChunkLengthTable.maybeNew(riffInput)) != null) { chunkLengthTable = (ChunkLengthTable)obj; } else if ((obj = RiffNiffInfo.maybeNew(riffInput)) != null) { niffInfo = (NiffInfo)obj; } else if ((obj = RiffPartsList.maybeNew(riffInput)) != null) { partsList = (PartsList)obj; } else if (RiffStringTable.maybeDecode(riffInput)) { // Do nothing. The String Table was stored for later use. } // debug: check for other optional chunks else { // Did not recognize the chunk type, so skip riffInput.skipChunk(); } } // Make sure required chunks are present. if (niffInfo == null) { throw new RiffFormatException("Can't find NIFF info chunk in Setup section."); } if (chunkLengthTable == null) { throw new RiffFormatException("Can't find chunk length table in Setup section."); } if (partsList == null) { throw new RiffFormatException("Can't find parts list chunk in Setup section."); } return(new ScoreSetup(niffInfo, chunkLengthTable, partsList)); }
/** This reads chunks from parentInput's input stream until the next * NIFF time slice or no more bytesRemaining in the input, * adding the chunks to the timeSlice's music symbol list. If a music * symbol is not recognized, this skips it. * This stops at either a measure start or an event time slice. * * @param parentInput the parent RIFF object being used to read the input stream * @param timeSlice the TimeSlice to which MusicSymbol objects are added. * @see MusicSymbol */ public static void addMusicSymbols(Riff parentInput, TimeSlice timeSlice) { while (parentInput.getBytesRemaining() > 0) { if (parentInput.peekFOURCC().Equals(RIFF_ID)) // encoutered the next time slice, so quit // Note that this stops at either a measure start or an event time slice. return; MusicSymbol musicSymbol = maybeNewAnyMusicSymbol(parentInput); if (musicSymbol != null) timeSlice.addMusicSymbol(musicSymbol); else // Did not recognize the music symbol, so skip parentInput.skipChunk(); } }
/** Creates new Page 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 Page newInstance(Riff parentInput) { Riff riffInput = new Riff(parentInput, "LIST"); riffInput.requireFOURCC(RIFF_ID); Page page = new Page(RiffPageHeader.newInstance(riffInput)); while (riffInput.getBytesRemaining() > 0) { StaffSystem staffSystem; if ((staffSystem = RiffStaffSystem.maybeNew(riffInput)) != null) page.addSystem(staffSystem); // debug: must check for NIFFFontSymbol, etc. else // Did not recognize the chunk type, so skip riffInput.skipChunk(); } return page; }
/** Creates new StaffSystem 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 StaffSystem newInstance(Riff parentInput) { Riff riffInput = new Riff(parentInput, "LIST"); riffInput.requireFOURCC(RIFF_ID); StaffSystem staffSystem = new StaffSystem (RiffStaffSystemHeader.newInstance(riffInput)); // debug: check for NIFFStaffGrouping while (riffInput.getBytesRemaining() > 0) { Staff staff; if ((staff = RiffStaff.maybeNew(riffInput)) != null) // Call addChild() which will set the child's parent to this. staffSystem.addStaff(staff); // debug: must check for NIFFFontSymbol, etc. else // Did not recognize the chunk type, so skip riffInput.skipChunk(); } return staffSystem; }
/** This reads chunks from parentInput's input stream until the next * NIFF time slice or no more bytesRemaining in the input, * adding the chunks to the timeSlice's music symbol list. If a music * symbol is not recognized, this skips it. * This stops at either a measure start or an event time slice. * * @param parentInput the parent RIFF object being used to read the input stream * @param timeSlice the TimeSlice to which MusicSymbol objects are added. * @see MusicSymbol */ static public void addMusicSymbols(Riff parentInput, TimeSlice timeSlice) { while (parentInput.getBytesRemaining() > 0) { if (parentInput.peekFOURCC().Equals(RIFF_ID)) { // encoutered the next time slice, so quit // Note that this stops at either a measure start or an event time slice. return; } MusicSymbol musicSymbol = maybeNewAnyMusicSymbol(parentInput); if (musicSymbol != null) { timeSlice.addMusicSymbol(musicSymbol); } else { // Did not recognize the music symbol, so skip parentInput.skipChunk(); } } }
/** Creates new ScoreSetup 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 ScoreSetup newInstance(Riff parentInput) { Riff riffInput = new Riff(parentInput, "LIST"); riffInput.requireFOURCC(RIFF_ID); NiffInfo niffInfo = null; ChunkLengthTable chunkLengthTable = null; PartsList partsList = null; while (riffInput.getBytesRemaining() > 0) { Object obj; if ((obj = RiffChunkLengthTable.maybeNew(riffInput)) != null) chunkLengthTable = (ChunkLengthTable)obj; else if ((obj = RiffNiffInfo.maybeNew(riffInput)) != null) niffInfo = (NiffInfo)obj; else if ((obj = RiffPartsList.maybeNew(riffInput)) != null) partsList = (PartsList)obj; else if (RiffStringTable.maybeDecode(riffInput)) { // Do nothing. The String Table was stored for later use. } // debug: check for other optional chunks else // Did not recognize the chunk type, so skip riffInput.skipChunk(); } // Make sure required chunks are present. if (niffInfo == null) throw new RiffFormatException("Can't find NIFF info chunk in Setup section."); if (chunkLengthTable == null) throw new RiffFormatException("Can't find chunk length table in Setup section."); if (partsList == null) throw new RiffFormatException("Can't find parts list chunk in Setup section."); return new ScoreSetup(niffInfo, chunkLengthTable, partsList); }