Example #1
0
        public SoundInfo(SwfReader r)
        {
            r.GetBits(2);             // reserved

            IsSyncStop       = r.GetBit();
            IsSyncNoMultiple = r.GetBit();
            HasEnvelope      = r.GetBit();
            HasLoops         = r.GetBit();
            HasOutPoint      = r.GetBit();

            r.Align();
            if (HasInPoint)
            {
                InPoint = r.GetUI32();
            }
            if (HasOutPoint)
            {
                OutPoint = r.GetUI32();
            }
            if (HasLoops)
            {
                LoopCount = r.GetUI16();
            }
            if (HasEnvelope)
            {
                uint count = (uint)r.GetByte();

                uint pos;
                uint left;
                uint right;
                EnvelopeRecords = new SoundEnvelope[count];
                for (int i = 0; i < count; i++)
                {
                    pos   = r.GetUI32();
                    left  = r.GetUI16();
                    right = r.GetUI16();
                    EnvelopeRecords[i] = new SoundEnvelope(pos, left, right);
                }
            }
        }
Example #2
0
        public SoundInfo(SwfReader r)
        {
            r.GetBits(2); // reserved

            IsSyncStop = r.GetBit();
            IsSyncNoMultiple = r.GetBit();
            HasEnvelope = r.GetBit();
            HasLoops = r.GetBit();
            HasOutPoint = r.GetBit();

            r.Align();
            if(HasInPoint)
            {
                InPoint = r.GetUI32();
            }
            if(HasOutPoint)
            {
                OutPoint = r.GetUI32();
            }
            if(HasLoops)
            {
                LoopCount = r.GetUI16();
            }
            if(HasEnvelope)
            {
                uint count = (uint)r.GetByte();

                uint pos;
                uint left;
                uint right;
                EnvelopeRecords = new SoundEnvelope[count];
                for (int i = 0; i < count; i++)
                {
                    pos = r.GetUI32();
                    left = r.GetUI16();
                    right = r.GetUI16();
                    EnvelopeRecords[i] = new SoundEnvelope(pos, left, right);
                }
            }
        }