當前位置: 首頁>>代碼示例>>C#>>正文


C# DataPacket.Done方法代碼示例

本文整理匯總了C#中NVorbis.DataPacket.Done方法的典型用法代碼示例。如果您正苦於以下問題:C# DataPacket.Done方法的具體用法?C# DataPacket.Done怎麽用?C# DataPacket.Done使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在NVorbis.DataPacket的用法示例。


在下文中一共展示了DataPacket.Done方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: UnpackPacket

 private VorbisStreamDecoder.PacketDecodeInfo UnpackPacket(DataPacket packet)
 {
   if (packet.ReadBit())
     return (VorbisStreamDecoder.PacketDecodeInfo) null;
   VorbisStreamDecoder.PacketDecodeInfo packetDecodeInfo = new VorbisStreamDecoder.PacketDecodeInfo();
   int num1 = this._modeFieldBits;
   try
   {
     packetDecodeInfo.Mode = this.Modes[(int) packet.ReadBits(this._modeFieldBits)];
     if (packetDecodeInfo.Mode.BlockFlag)
     {
       packetDecodeInfo.PrevFlag = packet.ReadBit();
       packetDecodeInfo.NextFlag = packet.ReadBit();
       num1 += 2;
     }
   }
   catch (EndOfStreamException ex)
   {
     return (VorbisStreamDecoder.PacketDecodeInfo) null;
   }
   try
   {
     long bitsRead1 = packet.BitsRead;
     packetDecodeInfo.FloorData = ACache.Get<VorbisFloor.PacketData>(this._channels);
     bool[] buffer1 = ACache.Get<bool>(this._channels);
     for (int index = 0; index < this._channels; ++index)
     {
       packetDecodeInfo.FloorData[index] = packetDecodeInfo.Mode.Mapping.ChannelSubmap[index].Floor.UnpackPacket(packet, packetDecodeInfo.Mode.BlockSize);
       buffer1[index] = !packetDecodeInfo.FloorData[index].ExecuteChannel;
     }
     foreach (VorbisMapping.CouplingStep couplingStep in packetDecodeInfo.Mode.Mapping.CouplingSteps)
     {
       if (packetDecodeInfo.FloorData[couplingStep.Angle].ExecuteChannel || packetDecodeInfo.FloorData[couplingStep.Magnitude].ExecuteChannel)
       {
         packetDecodeInfo.FloorData[couplingStep.Angle].ForceEnergy = true;
         packetDecodeInfo.FloorData[couplingStep.Magnitude].ForceEnergy = true;
       }
     }
     long num2 = packet.BitsRead - bitsRead1;
     long bitsRead2 = packet.BitsRead;
     packetDecodeInfo.Residue = ACache.Get<float>(this._channels, packetDecodeInfo.Mode.BlockSize);
     foreach (VorbisMapping.Submap submap in packetDecodeInfo.Mode.Mapping.Submaps)
     {
       for (int index = 0; index < this._channels; ++index)
       {
         if (packetDecodeInfo.Mode.Mapping.ChannelSubmap[index] != submap)
           packetDecodeInfo.FloorData[index].ForceNoEnergy = true;
       }
       float[][] buffer2 = submap.Residue.Decode(packet, buffer1, this._channels, packetDecodeInfo.Mode.BlockSize);
       for (int index1 = 0; index1 < this._channels; ++index1)
       {
         float[] numArray1 = packetDecodeInfo.Residue[index1];
         float[] numArray2 = buffer2[index1];
         for (int index2 = 0; index2 < packetDecodeInfo.Mode.BlockSize; ++index2)
           numArray1[index2] += numArray2[index2];
       }
       ACache.Return<float>(ref buffer2);
     }
     ACache.Return<bool>(ref buffer1);
     ++this._glueBits;
     this._modeBits += (long) num1;
     this._floorBits += num2;
     this._resBits += packet.BitsRead - bitsRead2;
     this._wasteBits += (long) (8 * packet.Length) - packet.BitsRead;
     ++this._packetCount;
   }
   catch (EndOfStreamException ex)
   {
     this.ResetDecoder();
     packetDecodeInfo = (VorbisStreamDecoder.PacketDecodeInfo) null;
   }
   catch (InvalidDataException ex)
   {
     packetDecodeInfo = (VorbisStreamDecoder.PacketDecodeInfo) null;
   }
   packet.Done();
   return packetDecodeInfo;
 }
開發者ID:tanis2000,項目名稱:FEZ,代碼行數:78,代碼來源:VorbisStreamDecoder.cs

示例2: ProcessParameterChange

        void ProcessParameterChange(DataPacket packet)
        {
            _parameterChangePacket = null;

            // try to do a stream header...
            var wasPeek = false;
            var doFullReset = false;
            if (ProcessStreamHeader(packet))
            {
                packet.Done();
                wasPeek = true;
                doFullReset = true;
                packet = _packetProvider.PeekNextPacket();
                if (packet == null) throw new InvalidDataException("Couldn't get next packet!");
            }

            // try to do a comment header...
            if (LoadComments(packet))
            {
                if (wasPeek)
                {
                    _packetProvider.GetNextPacket().Done();
                }
                else
                {
                    packet.Done();
                }
                wasPeek = true;
                packet = _packetProvider.PeekNextPacket();
                if (packet == null) throw new InvalidDataException("Couldn't get next packet!");
            }

            // try to do a book header...
            if (LoadBooks(packet))
            {
                if (wasPeek)
                {
                    _packetProvider.GetNextPacket().Done();
                }
                else
                {
                    packet.Done();
                }
            }

            ResetDecoder(doFullReset);
        }
開發者ID:SirusDoma,項目名稱:nvorbis,代碼行數:47,代碼來源:VorbisStreamDecoder.cs


注:本文中的NVorbis.DataPacket.Done方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。