ReadUInt32() public method

Retrieves the next 32 bits from the packet as a uint and advances the position counter.
public ReadUInt32 ( ) : uint
return uint
Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        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;
        }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
        public void InitLookupTable(DataPacket packet)
        {
            MapType = (int)packet.ReadBits(4);
            if (MapType == 0)
            {
                return;
            }
            float num   = Utils.ConvertFromVorbisFloat32(packet.ReadUInt32());
            float num2  = Utils.ConvertFromVorbisFloat32(packet.ReadUInt32());
            int   count = (int)packet.ReadBits(4) + 1;
            bool  flag  = packet.ReadBit();
            int   num3  = Entries * Dimensions;

            float[] array = new float[num3];
            if (MapType == 1)
            {
                num3 = lookup1_values();
            }
            uint[] array2 = new uint[num3];
            for (int i = 0; i < num3; i++)
            {
                array2[i] = (uint)packet.ReadBits(count);
            }
            if (MapType == 1)
            {
                for (int j = 0; j < Entries; j++)
                {
                    double num4 = 0.0;
                    int    num5 = 1;
                    for (int k = 0; k < Dimensions; k++)
                    {
                        int    num6 = j / num5 % num3;
                        double num7 = (double)((float)(double)array2[num6] * num2 + num) + num4;
                        array[j * Dimensions + k] = (float)num7;
                        if (flag)
                        {
                            num4 = num7;
                        }
                        num5 *= num3;
                    }
                }
            }
            else
            {
                for (int l = 0; l < Entries; l++)
                {
                    double num8 = 0.0;
                    int    num9 = l * Dimensions;
                    for (int m = 0; m < Dimensions; m++)
                    {
                        double num10 = (double)((float)(double)array2[num9] * num2 + num) + num8;
                        array[l * Dimensions + m] = (float)num10;
                        if (flag)
                        {
                            num8 = num10;
                        }
                        num9++;
                    }
                }
            }
            LookupTable = array;
        }
        void InitLookupTable(DataPacket packet)
        {
            MapType = (int)packet.ReadUBits(4);
            if (MapType == 0)
            {
                return;
            }

            float minValue   = Utils.ConvertFromVorbisFloat32(packet.ReadUInt32());
            float deltaValue = Utils.ConvertFromVorbisFloat32(packet.ReadUInt32());
            int   valueBits  = (int)packet.ReadUBits(4) + 1;
            bool  sequence_p = packet.ReadBit();

            int lookupValueCount = Entries * Dimensions;

            LookupTable = new float[lookupValueCount];
            if (MapType == 1)
            {
                lookupValueCount = Lookup1_values();
            }

            Span <uint> multiplicands = stackalloc uint[lookupValueCount];

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

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

                        if (sequence_p)
                        {
                            last = value;
                        }

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

                        if (sequence_p)
                        {
                            last = value;
                        }

                        moff++;
                    }
                }
            }
        }
Exemplo n.º 6
0
 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;
 }