Ejemplo n.º 1
0
        public RIFFFactChunk ReadFactChunk()
        {
            fFact = new RIFFFactChunk();

            fFact.chunkID = FOURCC.fact;
            fFact.dwChunkSize = fReader.ReadUInt32();
            fFact.dwNumSamples = fReader.ReadUInt32();

            return fFact;
        }
Ejemplo n.º 2
0
        public WaveFile(string filename)
        {
            fFileName = filename;
            RIFFStreamReader fReader = new RIFFStreamReader(filename);
            fBinaryReader = fReader.BinaryReader;
            fHeader = fReader.ReadHeader();

            // Read the chunks from the file
            uint chunkName = 0;
            while (fReader.Position < (long) fHeader.dwFileLength)
            {
                chunkName = fReader.ReadFourCC();

                switch (chunkName)
                {
                    case FOURCC.fmt:
                        fFormat = fReader.ReadFormatChunk();
                        if (fReader.Position + fFormat.dwChunkSize == fHeader.dwFileLength)
                            return;
                    break;

                    case FOURCC.fact:

                        fFact = fReader.ReadFactChunk();
                        if (fReader.Position + fFact.dwChunkSize == fHeader.dwFileLength)
                            return;
                    break;

                    case FOURCC.data:
                        fData = fReader.ReadDataChunk();
                        if (fReader.Position + fData.dwChunkSize == fHeader.dwFileLength)
                            return;
                        break;

                    default:
                        // Skip over unsupported chunks.
                        fReader.AdvanceToNext();
                        break;
                }
            }
        }
Ejemplo n.º 3
0
 public RIFFStreamReader(Stream inStream)
 {
     fFact = null;
     fFormat = null;
     fReader = new BinaryReader(inStream);
 }