当前位置: 首页>>代码示例>>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;未经允许,请勿转载。