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


C# DataPacket.ReadUInt32方法代碼示例

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


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

示例1: InitLookupTable

        void InitLookupTable(DataPacket packet)
        {
            MapType = (int)packet.ReadBits(4);
            if (MapType == 0) return;

            var minValue = Utils.ConvertFromVorbisFloat32(packet.ReadUInt32());
            var deltaValue = Utils.ConvertFromVorbisFloat32(packet.ReadUInt32());
            var valueBits = (int)packet.ReadBits(4) + 1;
            var sequence_p = packet.ReadBit();

            var lookupValueCount = Entries * Dimensions;
            var lookupTable = new float[lookupValueCount];
            if (MapType == 1)
            {
                lookupValueCount = lookup1_values();
            }

            var multiplicands = new uint[lookupValueCount];
            for (var i = 0; i < lookupValueCount; i++)
            {
                multiplicands[i] = (uint)packet.ReadBits(valueBits);
            }

            // now that we have the initial data read in, calculate the entry tree
            if (MapType == 1)
            {
                for (var idx = 0; idx < Entries; idx++)
                {
                    var last = 0.0;
                    var idxDiv = 1;
                    for (var i = 0; i < Dimensions; i++)
                    {
                        var moff = (idx / idxDiv) % lookupValueCount;
                        var value = (float)multiplicands[moff] * deltaValue + minValue + last;
                        lookupTable[idx * Dimensions + i] = (float)value;

                        if (sequence_p) last = value;

                        idxDiv *= lookupValueCount;
                    }
                }
            }
            else
            {
                for (var idx = 0; idx < Entries; idx++)
                {
                    var last = 0.0;
                    var moff = idx * Dimensions;
                    for (var i = 0; i < Dimensions; i++)
                    {
                        var value = multiplicands[moff] * deltaValue + minValue + last;
                        lookupTable[idx * Dimensions + i] = (float)value;

                        if (sequence_p) last = value;

                        ++moff;
                    }
                }
            }

            LookupTable = lookupTable;
        }
開發者ID:mokujin,項目名稱:DN,代碼行數:62,代碼來源:VorbisCodebook.cs

示例2: InitLookupTable

 private void InitLookupTable(DataPacket packet)
 {
   this.MapType = (int) packet.ReadBits(4);
   if (this.MapType == 0)
     return;
   float num1 = Utils.ConvertFromVorbisFloat32(packet.ReadUInt32());
   float num2 = Utils.ConvertFromVorbisFloat32(packet.ReadUInt32());
   int count = (int) packet.ReadBits(4) + 1;
   bool flag = packet.ReadBit();
   int length = this.Entries * this.Dimensions;
   float[] numArray1 = new float[length];
   if (this.MapType == 1)
     length = this.lookup1_values();
   uint[] numArray2 = new uint[length];
   for (int index = 0; index < length; ++index)
     numArray2[index] = (uint) packet.ReadBits(count);
   if (this.MapType == 1)
   {
     for (int index1 = 0; index1 < this.Entries; ++index1)
     {
       double num3 = 0.0;
       int num4 = 1;
       for (int index2 = 0; index2 < this.Dimensions; ++index2)
       {
         int index3 = index1 / num4 % length;
         double num5 = (double) numArray2[index3] * (double) num2 + (double) num1 + num3;
         numArray1[index1 * this.Dimensions + index2] = (float) num5;
         if (flag)
           num3 = num5;
         num4 *= length;
       }
     }
   }
   else
   {
     for (int index1 = 0; index1 < this.Entries; ++index1)
     {
       double num3 = 0.0;
       int index2 = index1 * this.Dimensions;
       for (int index3 = 0; index3 < this.Dimensions; ++index3)
       {
         double num4 = (double) numArray2[index2] * (double) num2 + (double) num1 + num3;
         numArray1[index1 * this.Dimensions + index3] = (float) num4;
         if (flag)
           num3 = num4;
         ++index2;
       }
     }
   }
   this.LookupTable = numArray1;
 }
開發者ID:Zeludon,項目名稱:FEZ,代碼行數:51,代碼來源:VorbisCodebook.cs


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