Exemplo n.º 1
0
        private int ConcatBytes(List <byte> bytes)
        {
            long concat = 0;

            foreach (byte b in bytes)
            {
                concat = BitByBit.Concat(concat, b);
            }
            return((int)concat);
        }
Exemplo n.º 2
0
        /*
         * Dynamically finds the variable-sized time chunk and aggregates their
         * values.
         * Note: the back 7-bits of each byte correspond to the value, while the
         *       first bit notifies if there is another byte to follow.
         */
        private static VariableChunkSize <int> FindDeltaTime(List <byte> trackChunk)
        {
            VariableChunkSize <int> timeChunk;

            timeChunk.chunkSize = 1;
            timeChunk.data      = 0;

            while (true)
            {
                byte next = trackChunk[timeChunk.chunkSize - 1];
                timeChunk.data = (int)BitByBit.ConcatIgnoreFront(timeChunk.data, next, 1);

                if (!BitByBit.IsFrontBitsOn(next, 1))
                {
                    break;
                }
                timeChunk.chunkSize++;
            }

            return(timeChunk);
        }