Example #1
0
        public void Read(double[][] aBufferArrayArray)
        {
            int packetType = byteArray.ReadBitsAsByte(1);

            Byte lTypeHeader = 0x00;

            if (packetType != 0x00)
            {
                byteArray.SubBitPosition(1);
                lTypeHeader = byteArray.ReadBitsAsByte(8);
            }

            if (packetType == 0x00)
            {
                Logger.LogDebug("The Packet Type Is 0 (Audio).");

                try
                {
                    int lModeNumber = byteArray.ReadBitsAsByte(ilog(( UInt32 )(vorbisHeader.setup.mode.count - 1)));
                    modeHeader    = vorbisHeader.setup.mode.header[lModeNumber];
                    mappingHeader = vorbisHeader.setup.mapping.header[modeHeader.mapping];
                    window        = new Window(byteArray, modeHeader.blockFlag, vorbisHeader.identification.blockSize0, vorbisHeader.identification.blockSize1);

                    noResidue = new Byte[vorbisHeader.identification.audioChannels];

                    DecodeFloor();

                    Propagate();

                    DecodeResidue();

                    InverseCoupling();

                    ComputeCurve(aBufferArrayArray);
                }
                catch
                {
                    Logger.LogError("â– Error.");
                }
            }
            else
            {
                Logger.LogError("The Packet Type Is Not 0.");

                vorbisHeader.Read(byteArray, lTypeHeader);
            }

            Logger.LogDebug("Sub Packet Position:0x" + byteArray.Position.ToString("X8") + "." + byteArray.GetBitPositionInByte().ToString() + "/" + byteArray.Length.ToString("X8"));
        }
Example #2
0
        public VorbisMode(ByteArray aByteArray)
        {
            count = aByteArray.ReadBitsAsByte(6) + 1;

            Logger.LogError("VorbisMode count:" + count);

            header = new ModeHeader[count];

            for (int i = 0; i < count; i++)
            {
                header[i] = new ModeHeader(aByteArray);
            }

            Byte lFramingFlag = aByteArray.ReadBitsAsByte(1);

            if (lFramingFlag == 0)
            {
                Logger.LogError("Framing error. The Stream Is Undecodable.");
            }
        }