상속: IVorbisStreamStatus
예제 #1
0
        internal static VorbisMode Init(VorbisStreamDecoder vorbis, DataPacket packet)
        {
            var mode = new VorbisMode(vorbis);
            mode.BlockFlag = packet.ReadBit();
            mode.WindowType = (int)packet.ReadBits(16);
            mode.TransformType = (int)packet.ReadBits(16);
            var mapping = (int)packet.ReadBits(8);

            if (mode.WindowType != 0 || mode.TransformType != 0 || mapping >= vorbis.Maps.Length) throw new InvalidDataException();

            mode.Mapping = vorbis.Maps[mapping];
            mode.BlockSize = mode.BlockFlag ? vorbis.Block1Size : vorbis.Block0Size;

            // now pre-calc the window(s)...
            if (mode.BlockFlag)
            {
                // long block
                mode._windows = new float[4][];
                mode._windows[0] = new float[vorbis.Block1Size];
                mode._windows[1] = new float[vorbis.Block1Size];
                mode._windows[2] = new float[vorbis.Block1Size];
                mode._windows[3] = new float[vorbis.Block1Size];
            }
            else
            {
                // short block
                mode._windows = new float[1][];
                mode._windows[0] = new float[vorbis.Block0Size];
            }
            mode.CalcWindows();

            return mode;
        }
        internal static VorbisCodebook Create(VorbisStreamDecoder vorbis, DataPacket packet, int number)
        {
            var tmp = new VorbisCodebook(number);

            tmp.Init(packet);
            return(tmp);
        }
예제 #3
0
파일: VorbisMode.cs 프로젝트: tanis2000/FEZ
 internal static VorbisMode Init(VorbisStreamDecoder vorbis, DataPacket packet)
 {
   VorbisMode vorbisMode = new VorbisMode(vorbis);
   vorbisMode.BlockFlag = packet.ReadBit();
   vorbisMode.WindowType = (int) packet.ReadBits(16);
   vorbisMode.TransformType = (int) packet.ReadBits(16);
   int index = (int) packet.ReadBits(8);
   if (vorbisMode.WindowType != 0 || vorbisMode.TransformType != 0 || index >= vorbis.Maps.Length)
     throw new InvalidDataException();
   vorbisMode.Mapping = vorbis.Maps[index];
   vorbisMode.BlockSize = vorbisMode.BlockFlag ? vorbis.Block1Size : vorbis.Block0Size;
   if (vorbisMode.BlockFlag)
   {
     vorbisMode._windows = new float[4][];
     vorbisMode._windows[0] = new float[vorbis.Block1Size];
     vorbisMode._windows[1] = new float[vorbis.Block1Size];
     vorbisMode._windows[2] = new float[vorbis.Block1Size];
     vorbisMode._windows[3] = new float[vorbis.Block1Size];
   }
   else
   {
     vorbisMode._windows = new float[1][];
     vorbisMode._windows[0] = new float[vorbis.Block0Size];
   }
   vorbisMode.CalcWindows();
   return vorbisMode;
 }
예제 #4
0
        internal static VorbisMode Init(VorbisStreamDecoder vorbis, DataPacket packet)
        {
            VorbisMode vorbisMode = new VorbisMode(vorbis);

            vorbisMode.BlockFlag     = packet.ReadBit();
            vorbisMode.WindowType    = (int)packet.ReadBits(16);
            vorbisMode.TransformType = (int)packet.ReadBits(16);
            int num = (int)packet.ReadBits(8);

            if (vorbisMode.WindowType != 0 || vorbisMode.TransformType != 0 || num >= vorbis.Maps.Length)
            {
                throw new InvalidDataException();
            }
            vorbisMode.Mapping   = vorbis.Maps[num];
            vorbisMode.BlockSize = (vorbisMode.BlockFlag ? vorbis.Block1Size : vorbis.Block0Size);
            if (vorbisMode.BlockFlag)
            {
                vorbisMode._windows    = new float[4][];
                vorbisMode._windows[0] = new float[vorbis.Block1Size];
                vorbisMode._windows[1] = new float[vorbis.Block1Size];
                vorbisMode._windows[2] = new float[vorbis.Block1Size];
                vorbisMode._windows[3] = new float[vorbis.Block1Size];
            }
            else
            {
                vorbisMode._windows    = new float[1][];
                vorbisMode._windows[0] = new float[vorbis.Block0Size];
            }
            vorbisMode.CalcWindows();
            return(vorbisMode);
        }
예제 #5
0
 internal static VorbisCodebook Init(VorbisStreamDecoder vorbis, DataPacket packet, int number)
 {
   VorbisCodebook vorbisCodebook = new VorbisCodebook();
   vorbisCodebook.BookNum = number;
   vorbisCodebook.Init(packet);
   return vorbisCodebook;
 }
예제 #6
0
        public bool SwitchStreams(int index)
        {
            if (index < 0 || index >= StreamCount)
            {
                throw new ArgumentOutOfRangeException("index");
            }
            if (_decoders == null)
            {
                throw new ObjectDisposedException("VorbisReader");
            }
            if (_streamIdx == index)
            {
                return(false);
            }
            VorbisStreamDecoder vorbisStreamDecoder = _decoders[_streamIdx];

            _streamIdx = index;
            VorbisStreamDecoder vorbisStreamDecoder2 = _decoders[_streamIdx];

            if (vorbisStreamDecoder._channels == vorbisStreamDecoder2._channels)
            {
                return(vorbisStreamDecoder._sampleRate != vorbisStreamDecoder2._sampleRate);
            }
            return(true);
        }
예제 #7
0
 internal static VorbisCodebook Init(VorbisStreamDecoder vorbis, DataPacket packet, int number)
 {
     var temp = new VorbisCodebook();
     temp.BookNum = number;
     temp.Init(packet);
     return temp;
 }
예제 #8
0
        internal static VorbisResidue Init(VorbisStreamDecoder vorbis, DataPacket packet)
        {
            int           num           = (int)packet.ReadBits(16);
            VorbisResidue vorbisResidue = null;

            switch (num)
            {
            case 0:
                vorbisResidue = new Residue0(vorbis);
                break;

            case 1:
                vorbisResidue = new Residue1(vorbis);
                break;

            case 2:
                vorbisResidue = new Residue2(vorbis);
                break;
            }
            if (vorbisResidue == null)
            {
                throw new InvalidDataException();
            }
            vorbisResidue.Init(packet);
            return(vorbisResidue);
        }
예제 #9
0
        internal static VorbisCodebook Init(VorbisStreamDecoder vorbis, DataPacket packet, int number)
        {
            var temp = new VorbisCodebook();

            temp.BookNum = number;
            temp.Init(packet);
            return(temp);
        }
예제 #10
0
        internal static VorbisCodebook Init(VorbisStreamDecoder vorbis, DataPacket packet, int number)
        {
            VorbisCodebook vorbisCodebook = new VorbisCodebook();

            vorbisCodebook.BookNum = number;
            vorbisCodebook.Init(packet);
            return(vorbisCodebook);
        }
예제 #11
0
 public VorbisResidue(VorbisStreamDecoder vorbis)
 {
     _vorbis  = vorbis;
     _residue = new float[_vorbis._channels][];
     for (int i = 0; i < _vorbis._channels; i++)
     {
         _residue[i] = new float[_vorbis.Block1Size];
     }
 }
예제 #12
0
        protected VorbisResidue(VorbisStreamDecoder vorbis)
        {
            _vorbis = vorbis;

            _residue = new float[_vorbis._channels][];
            for (int i = 0; i < _vorbis._channels; i++)
            {
                _residue[i] = new float[_vorbis.Block1Size];
            }
        }
예제 #13
0
파일: VorbisTime.cs 프로젝트: tanis2000/FEZ
 internal static VorbisTime Init(VorbisStreamDecoder vorbis, DataPacket packet)
 {
   int num = (int) packet.ReadBits(16);
   VorbisTime vorbisTime = (VorbisTime) null;
   if (num == 0)
     vorbisTime = (VorbisTime) new VorbisTime.Time0(vorbis);
   if (vorbisTime == null)
     throw new InvalidDataException();
   vorbisTime.Init(packet);
   return vorbisTime;
 }
예제 #14
0
 internal static VorbisMapping Init(VorbisStreamDecoder vorbis, DataPacket packet)
 {
   int num = (int) packet.ReadBits(16);
   VorbisMapping vorbisMapping = (VorbisMapping) null;
   if (num == 0)
     vorbisMapping = (VorbisMapping) new VorbisMapping.Mapping0(vorbis);
   if (vorbisMapping == null)
     throw new InvalidDataException();
   vorbisMapping.Init(packet);
   return vorbisMapping;
 }
예제 #15
0
        internal static VorbisTime Init(VorbisStreamDecoder vorbis, DataPacket packet)
        {
            var type = (int)packet.ReadBits(16);

            VorbisTime time = null;
            switch (type)
            {
                case 0: time = new Time0(vorbis); break;
            }
            if (time == null) throw new InvalidDataException();

            time.Init(packet);
            return time;
        }
예제 #16
0
        internal static VorbisMapping Init(VorbisStreamDecoder vorbis, DataPacket packet)
        {
            var type = (int)packet.ReadBits(16);

            VorbisMapping mapping = null;
            switch (type)
            {
                case 0: mapping = new Mapping0(vorbis); break;
            }
            if (mapping == null) throw new Exception();

            mapping.Init(packet);
            return mapping;
        }
예제 #17
0
        public void NewStream(object sender, NewStreamEventArgs ea)
        {
            IPacketProvider     packetProvider      = ea.PacketProvider;
            VorbisStreamDecoder vorbisStreamDecoder = new VorbisStreamDecoder(packetProvider);

            if (vorbisStreamDecoder.TryInit())
            {
                _decoders.Add(vorbisStreamDecoder);
                _serials.Add(packetProvider.StreamSerial);
            }
            else
            {
                ea.IgnoreStream = true;
            }
        }
예제 #18
0
        internal static VorbisFloor Init(VorbisStreamDecoder vorbis, DataPacket packet)
        {
            var type = (int)packet.ReadBits(16);

            VorbisFloor floor = null;
            switch (type)
            {
                case 0: floor = new Floor0(vorbis); break;
                case 1: floor = new Floor1(vorbis); break;
            }
            if (floor == null) throw new InvalidDataException();

            floor.Init(packet);
            return floor;
        }
        /// <summary>
        /// Reads decoded samples from the current logical stream
        /// </summary>
        /// <param name="buffer">The buffer to write the samples to.</param>
        /// <returns>The number of samples written</returns>
        public int ReadSamples(Span <float> buffer)
        {
            int samples = ActiveDecoder.ReadSamples(buffer);

            if (ClipSamples)
            {
                VorbisStreamDecoder decoder = _decoders[StreamIndex];
                for (int i = 0; i < samples; i++)
                {
                    buffer[i] = Utils.ClipValue(buffer[i], ref decoder._clipped);
                }
            }

            return(samples);
        }
예제 #20
0
        internal static VorbisTime Init(VorbisStreamDecoder vorbis, DataPacket packet)
        {
            int        num        = (int)packet.ReadBits(16);
            VorbisTime vorbisTime = (VorbisTime)null;

            if (num == 0)
            {
                vorbisTime = (VorbisTime) new VorbisTime.Time0(vorbis);
            }
            if (vorbisTime == null)
            {
                throw new InvalidDataException();
            }
            vorbisTime.Init(packet);
            return(vorbisTime);
        }
예제 #21
0
        internal static VorbisResidue Init(VorbisStreamDecoder vorbis, DataPacket packet)
        {
            var type = (int)packet.ReadBits(16);

            VorbisResidue residue = null;
            switch (type)
            {
                case 0: residue = new Residue0(vorbis); break;
                case 1: residue = new Residue1(vorbis); break;
                case 2: residue = new Residue2(vorbis); break;
            }
            if (residue == null) throw new InvalidDataException();

            residue.Init(packet);
            return residue;
        }
예제 #22
0
        internal static VorbisMapping Init(VorbisStreamDecoder vorbis, DataPacket packet)
        {
            int           num           = (int)packet.ReadBits(16);
            VorbisMapping vorbisMapping = null;

            if (num == 0)
            {
                vorbisMapping = new Mapping0(vorbis);
            }
            if (vorbisMapping == null)
            {
                throw new InvalidDataException();
            }
            vorbisMapping.Init(packet);
            return(vorbisMapping);
        }
예제 #23
0
        void NewStream(object sender, NewStreamEventArgs ea)
        {
            var packetProvider = ea.PacketProvider;
            var decoder        = new VorbisStreamDecoder(packetProvider);

            if (decoder.TryInit())
            {
                _decoders.Add(decoder);
                _serials.Add(packetProvider.StreamSerial);
            }
            else
            {
                // This is almost certainly not a Vorbis stream
                ea.IgnoreStream = true;
            }
        }
예제 #24
0
        private void NewStream(int streamSerial)
        {
            DataPacket nextPacket = this._packetProvider.GetNextPacket(streamSerial);

            if ((int)nextPacket.PeekByte() != (int)VorbisStreamDecoder.InitialPacketMarker)
            {
                return;
            }
            VorbisStreamDecoder vorbisStreamDecoder = new VorbisStreamDecoder((Func <DataPacket>)(() =>
            {
                IPacketProvider local_0 = this._packetProvider;
                if (local_0 != null)
                {
                    return(local_0.GetNextPacket(streamSerial));
                }
                else
                {
                    return((DataPacket)null);
                }
            }), (Func <int>)(() =>
            {
                IPacketProvider local_0 = this._packetProvider;
                if (local_0 != null)
                {
                    return(local_0.GetTotalPageCount(streamSerial));
                }
                else
                {
                    return(0);
                }
            }));

            try
            {
                if (!vorbisStreamDecoder.TryInit(nextPacket))
                {
                    return;
                }
                this._decoders.Add(vorbisStreamDecoder);
                this._serials.Add(streamSerial);
            }
            catch (InvalidDataException ex)
            {
            }
        }
예제 #25
0
        internal static VorbisTime Init(VorbisStreamDecoder vorbis, DataPacket packet)
        {
            var type = (int)packet.ReadBits(16);

            VorbisTime time = null;

            switch (type)
            {
            case 0: time = new Time0(vorbis); break;
            }
            if (time == null)
            {
                throw new InvalidDataException();
            }

            time.Init(packet);
            return(time);
        }
예제 #26
0
        void NewStream(object sender, NewStreamEventArgs ea)
        {
            var packetProvider = ea.PacketProvider;
            var decoder        = new VorbisStreamDecoder(packetProvider);

            if (decoder.TryInit())
            {
                _decoders.Add(decoder);
                _serials.Add(packetProvider.StreamSerial);
            }
            else
            {
                // NB: This could be an Ogg Skeleton stream...  We should check that, just in case
                // NB: This could be a RTP stream...  We should check that, just in case

                ea.IgnoreStream = true;
            }
        }
예제 #27
0
파일: VorbisFloor.cs 프로젝트: Zeludon/FEZ
 internal static VorbisFloor Init(VorbisStreamDecoder vorbis, DataPacket packet)
 {
   int num = (int) packet.ReadBits(16);
   VorbisFloor vorbisFloor = (VorbisFloor) null;
   switch (num)
   {
     case 0:
       vorbisFloor = (VorbisFloor) new VorbisFloor.Floor0(vorbis);
       break;
     case 1:
       vorbisFloor = (VorbisFloor) new VorbisFloor.Floor1(vorbis);
       break;
   }
   if (vorbisFloor == null)
     throw new InvalidDataException();
   vorbisFloor.Init(packet);
   return vorbisFloor;
 }
예제 #28
0
        internal static VorbisMapping Init(VorbisStreamDecoder vorbis, DataPacket packet)
        {
            var type = (int)packet.ReadBits(16);

            VorbisMapping mapping = null;

            switch (type)
            {
            case 0: mapping = new Mapping0(vorbis); break;
            }
            if (mapping == null)
            {
                throw new InvalidDataException();
            }

            mapping.Init(packet);
            return(mapping);
        }
예제 #29
0
        internal static VorbisFloor Init(VorbisStreamDecoder vorbis, DataPacket packet)
        {
            var type = (int)packet.ReadBits(16);

            VorbisFloor floor = null;

            switch (type)
            {
            case 0: floor = new Floor0(vorbis); break;

            case 1: floor = new Floor1(vorbis); break;
            }
            if (floor == null)
            {
                throw new InvalidDataException();
            }

            floor.Init(packet);
            return(floor);
        }
예제 #30
0
 internal static VorbisResidue Init(VorbisStreamDecoder vorbis, DataPacket packet)
 {
   int num = (int) packet.ReadBits(16);
   VorbisResidue vorbisResidue = (VorbisResidue) null;
   switch (num)
   {
     case 0:
       vorbisResidue = (VorbisResidue) new VorbisResidue.Residue0(vorbis);
       break;
     case 1:
       vorbisResidue = (VorbisResidue) new VorbisResidue.Residue1(vorbis);
       break;
     case 2:
       vorbisResidue = (VorbisResidue) new VorbisResidue.Residue2(vorbis);
       break;
   }
   if (vorbisResidue == null)
     throw new InvalidDataException();
   vorbisResidue.Init(packet);
   return vorbisResidue;
 }
예제 #31
0
        internal static VorbisFloor Init(VorbisStreamDecoder vorbis, DataPacket packet)
        {
            int         num         = (int)packet.ReadBits(16);
            VorbisFloor vorbisFloor = (VorbisFloor)null;

            switch (num)
            {
            case 0:
                vorbisFloor = (VorbisFloor) new VorbisFloor.Floor0(vorbis);
                break;

            case 1:
                vorbisFloor = (VorbisFloor) new VorbisFloor.Floor1(vorbis);
                break;
            }
            if (vorbisFloor == null)
            {
                throw new InvalidDataException();
            }
            vorbisFloor.Init(packet);
            return(vorbisFloor);
        }
예제 #32
0
        internal static VorbisResidue Init(VorbisStreamDecoder vorbis, DataPacket packet)
        {
            var type = (int)packet.ReadBits(16);

            VorbisResidue residue = null;

            switch (type)
            {
            case 0: residue = new Residue0(vorbis); break;

            case 1: residue = new Residue1(vorbis); break;

            case 2: residue = new Residue2(vorbis); break;
            }
            if (residue == null)
            {
                throw new InvalidDataException();
            }

            residue.Init(packet);
            return(residue);
        }
예제 #33
0
        internal static VorbisMode Init(VorbisStreamDecoder vorbis, DataPacket packet)
        {
            var mode = new VorbisMode(vorbis);

            mode.BlockFlag     = packet.ReadBit();
            mode.WindowType    = (int)packet.ReadBits(16);
            mode.TransformType = (int)packet.ReadBits(16);
            var mapping = (int)packet.ReadBits(8);

            if (mode.WindowType != 0 || mode.TransformType != 0 || mapping >= vorbis.Maps.Length)
            {
                throw new Exception();
            }

            mode.Mapping   = vorbis.Maps[mapping];
            mode.BlockSize = mode.BlockFlag ? vorbis.Block1Size : vorbis.Block0Size;

            // now pre-calc the window(s)...
            if (mode.BlockFlag)
            {
                // long block
                mode._windows    = new float[4][];
                mode._windows[0] = new float[vorbis.Block1Size];
                mode._windows[1] = new float[vorbis.Block1Size];
                mode._windows[2] = new float[vorbis.Block1Size];
                mode._windows[3] = new float[vorbis.Block1Size];
            }
            else
            {
                // short block
                mode._windows    = new float[1][];
                mode._windows[0] = new float[vorbis.Block0Size];
            }
            mode.CalcWindows();

            return(mode);
        }
예제 #34
0
 public int ReadSamples(float[] buffer, int offset, int count)
 {
     if (offset < 0)
     {
         throw new ArgumentOutOfRangeException("offset");
     }
     if (count < 0 || offset + count > buffer.Length)
     {
         throw new ArgumentOutOfRangeException("count");
     }
     count = ActiveDecoder.ReadSamples(buffer, offset, count);
     if (ClipSamples)
     {
         VorbisStreamDecoder vorbisStreamDecoder = _decoders[_streamIdx];
         int num = 0;
         while (num < count)
         {
             buffer[offset] = Utils.ClipValue(buffer[offset], ref vorbisStreamDecoder._clipped);
             num++;
             offset++;
         }
     }
     return(count);
 }
예제 #35
0
        public bool SwitchStreams(int index)
        {
            if (index < 0 || index >= this.StreamCount)
            {
                throw new ArgumentOutOfRangeException("index");
            }
            if (this._streamIdx == index)
            {
                return(false);
            }
            VorbisStreamDecoder vorbisStreamDecoder1 = this._decoders[this._streamIdx];

            this._streamIdx = index;
            VorbisStreamDecoder vorbisStreamDecoder2 = this._decoders[this._streamIdx];

            if (vorbisStreamDecoder1._channels == vorbisStreamDecoder2._channels)
            {
                return(vorbisStreamDecoder1._sampleRate != vorbisStreamDecoder2._sampleRate);
            }
            else
            {
                return(true);
            }
        }
예제 #36
0
 internal Time0(VorbisStreamDecoder vorbis)
     : base(vorbis)
 {
 }
예제 #37
0
 protected VorbisTime(VorbisStreamDecoder vorbis)
 {
     _vorbis = vorbis;
 }
예제 #38
0
 internal Residue2(VorbisStreamDecoder vorbis) : base(vorbis)
 {
 }
예제 #39
0
 private int WindowSamples(VorbisStreamDecoder.PacketDecodeInfo pdi)
 {
   float[] window = pdi.Mode.GetWindow(pdi.PrevFlag, pdi.NextFlag);
   int num1 = pdi.Mode.BlockSize;
   int end = num1;
   int switchPoint = end >> 1;
   int start = 0;
   int num2 = -switchPoint;
   int num3 = switchPoint;
   if (pdi.Mode.BlockFlag)
   {
     if (!pdi.PrevFlag)
     {
       start = this.Block1Size / 4 - this.Block0Size / 4;
       switchPoint = start + this.Block0Size / 2;
       num2 = this.Block0Size / -2 - start;
     }
     if (!pdi.NextFlag)
     {
       end -= num1 / 4 - this.Block0Size / 4;
       num3 = num1 / 4 + this.Block0Size / 4;
     }
   }
   int index = this._outputBuffer.Length / this._channels + num2;
   for (int channel = 0; channel < this._channels; ++channel)
     this._outputBuffer.Write(channel, index, start, switchPoint, end, pdi.Residue[channel], window);
   int num4 = this._outputBuffer.Length / this._channels - num3;
   int num5 = num4 - this._preparedLength;
   this._preparedLength = num4;
   return num5;
 }
예제 #40
0
 protected VorbisResidue(VorbisStreamDecoder vorbis)
 {
   this._vorbis = vorbis;
 }
예제 #41
0
 protected VorbisFloor(VorbisStreamDecoder vorbis)
 {
     _vorbis = vorbis;
 }
예제 #42
0
 internal Residue0(VorbisStreamDecoder vorbis)
   : base(vorbis)
 {
 }
예제 #43
0
 internal Mapping0(VorbisStreamDecoder vorbis) : base(vorbis)
 {
 }
예제 #44
0
 protected VorbisMapping(VorbisStreamDecoder vorbis)
 {
     _vorbis = vorbis;
 }
예제 #45
0
 private VorbisMode(VorbisStreamDecoder vorbis)
 {
     _vorbis = vorbis;
 }
예제 #46
0
 public VorbisMapping(VorbisStreamDecoder vorbis)
 {
     _vorbis = vorbis;
 }
예제 #47
0
        void NewStream(int streamSerial)
        {
            var initialPacket = _packetProvider.GetNextPacket(streamSerial);
            var checkByte = (byte)initialPacket.PeekByte();

            // TODO: determine what type of stream this is, load the correct decoder (or ignore
            //       it), then keep going.  If it's a skeleton stream, try to load it.  Only
            //       allow one instance.  Then force another page to be read.

            // for now, we only support the Vorbis decoder; Skeleton will happen later
            if (checkByte == VorbisStreamDecoder.InitialPacketMarker)
            {
                var decoder = new VorbisStreamDecoder(
                    () => {
                        var provider = _packetProvider;
                        if (provider != null)
                        {
                            return provider.GetNextPacket(streamSerial);
                        }
                        return null;
                    },
                    () =>
                    {
                        var provider = _packetProvider;
                        if (provider != null)
                        {
                            return provider.GetTotalPageCount(streamSerial);
                        }
                        return 0;
                    }
                );
                try
                {
                    if (decoder.TryInit(initialPacket))
                    {
                        // the init worked, so we have a valid stream...

                        _decoders.Add(decoder);
                        _serials.Add(streamSerial);
                    }
                    // else: the initial packet wasn't for Vorbis...
                }
                catch (InvalidDataException)
                {
                    // there was an error loading the headers... problem is, we're past the first packet, so we can't go back and try again...
                    // TODO: log the error
                }
            }
            // we're not supporting Skeleton yet...
            //else if (checkByte == Ogg.SkeletonDecoder.InitialPacketMarker)
            //{
            //    // load it
            //    if (_skeleton != null) throw new InvalidDataException("Second skeleton stream found!");
            //    _skeleton = new Ogg.SkeletonDecoder(() => _packetProvider.GetNextPacket(streamSerial));

            //    if (_skeleton.Init(initialPacket))
            //    {
            //        // force the next stream to load
            //        _packetProvider.FindNextStream(streamSerial);
            //    }
            //    else
            //    {
            //        _skeleton = null;
            //    }
            //}
        }
예제 #48
0
        void NewStream(object sender, NewStreamEventArgs ea)
        {
            var packetProvider = ea.PacketProvider;
            var decoder = new VorbisStreamDecoder(packetProvider);
            if (decoder.TryInit())
            {
                _decoders.Add(decoder);
                _serials.Add(packetProvider.StreamSerial);
            }
            else
            {
                // NB: This could be an Ogg Skeleton stream...  We should check that, just in case
                // NB: This could be a RTP stream...  We should check that, just in case

                ea.IgnoreStream = true;
            }
        }
예제 #49
0
파일: VorbisReader.cs 프로젝트: Zeludon/FEZ
 private void NewStream(int streamSerial)
 {
   DataPacket nextPacket = this._packetProvider.GetNextPacket(streamSerial);
   if ((int) nextPacket.PeekByte() != (int) VorbisStreamDecoder.InitialPacketMarker)
     return;
   VorbisStreamDecoder vorbisStreamDecoder = new VorbisStreamDecoder((Func<DataPacket>) (() =>
   {
     IPacketProvider local_0 = this._packetProvider;
     if (local_0 != null)
       return local_0.GetNextPacket(streamSerial);
     else
       return (DataPacket) null;
   }), (Func<int>) (() =>
   {
     IPacketProvider local_0 = this._packetProvider;
     if (local_0 != null)
       return local_0.GetTotalPageCount(streamSerial);
     else
       return 0;
   }));
   try
   {
     if (!vorbisStreamDecoder.TryInit(nextPacket))
       return;
     this._decoders.Add(vorbisStreamDecoder);
     this._serials.Add(streamSerial);
   }
   catch (InvalidDataException ex)
   {
   }
 }
예제 #50
0
 void NewStream(object sender, NewStreamEventArgs ea)
 {
     var packetProvider = ea.PacketProvider;
     var decoder = new VorbisStreamDecoder(packetProvider);
     if (decoder.TryInit())
     {
         _decoders.Add(decoder);
         _serials.Add(packetProvider.StreamSerial);
     }
     else
     {
         // This is almost certainly not a Vorbis stream
         ea.IgnoreStream = true;
     }
 }
예제 #51
0
 internal Floor0(VorbisStreamDecoder vorbis) : base(vorbis)
 {
 }
예제 #52
0
 internal Time0(VorbisStreamDecoder vorbis) : base(vorbis)
 {
 }
예제 #53
0
 protected VorbisFloor(VorbisStreamDecoder vorbis)
 {
     _vorbis = vorbis;
 }
예제 #54
0
 private int DecodePacket(VorbisStreamDecoder.PacketDecodeInfo pdi)
 {
   VorbisMapping.CouplingStep[] couplingStepArray = pdi.Mode.Mapping.CouplingSteps;
   int num1 = pdi.Mode.BlockSize / 2;
   for (int index1 = couplingStepArray.Length - 1; index1 >= 0; --index1)
   {
     float[] numArray1 = pdi.Residue[couplingStepArray[index1].Magnitude];
     float[] numArray2 = pdi.Residue[couplingStepArray[index1].Angle];
     for (int index2 = 0; index2 < num1; ++index2)
     {
       float num2;
       float num3;
       if ((double) numArray1[index2] > 0.0)
       {
         if ((double) numArray2[index2] > 0.0)
         {
           num2 = numArray1[index2];
           num3 = numArray1[index2] - numArray2[index2];
         }
         else
         {
           num3 = numArray1[index2];
           num2 = numArray1[index2] + numArray2[index2];
         }
       }
       else if ((double) numArray2[index2] > 0.0)
       {
         num2 = numArray1[index2];
         num3 = numArray1[index2] + numArray2[index2];
       }
       else
       {
         num3 = numArray1[index2];
         num2 = numArray1[index2] - numArray2[index2];
       }
       numArray1[index2] = num2;
       numArray2[index2] = num3;
     }
   }
   for (int index = 0; index < this._channels; ++index)
   {
     VorbisFloor.PacketData packetData = pdi.FloorData[index];
     float[] numArray = pdi.Residue[index];
     if (packetData.ExecuteChannel)
     {
       pdi.Mode.Mapping.ChannelSubmap[index].Floor.Apply(packetData, numArray);
       Mdct.Reverse(numArray);
     }
   }
   return this.WindowSamples(pdi);
 }
예제 #55
0
 protected VorbisMapping(VorbisStreamDecoder vorbis)
 {
   this._vorbis = vorbis;
 }
예제 #56
0
 internal Floor1(VorbisStreamDecoder vorbis)
     : base(vorbis)
 {
 }
예제 #57
0
 internal Mapping0(VorbisStreamDecoder vorbis)
   : base(vorbis)
 {
 }
예제 #58
0
 protected VorbisTime(VorbisStreamDecoder vorbis)
 {
     _vorbis = vorbis;
     vorbis  = _vorbis;
 }