예제 #1
0
  /** Creates a new ScoreSetup with the given values.
   */
  public ScoreSetup(NiffInfo niffInfo, ChunkLengthTable chunkLengthTable,
 PartsList partsList)
  {
      _niffInfo = niffInfo;
        _chunkLengthTable = chunkLengthTable;
        _partsList = partsList;
  }
예제 #2
0
 /** Creates a new ScoreSetup with the given values.
  */
 public ScoreSetup
     (NiffInfo niffInfo, ChunkLengthTable chunkLengthTable,
     PartsList partsList)
 {
     _niffInfo         = niffInfo;
     _chunkLengthTable = chunkLengthTable;
     _partsList        = partsList;
 }
예제 #3
0
        /** 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));
        }