예제 #1
0
        internal static VorbisCodebook Init(VorbisStreamDecoder vorbis, DataPacket packet, int number)
        {
            var temp = new VorbisCodebook();

            temp.BookNum = number;
            temp.Init(packet);
            return(temp);
        }
예제 #2
0
        protected VorbisResidue(VorbisStreamDecoder vorbis)
        {
            _vorbis = vorbis;

            _residue = new float[_vorbis._channels][];
            for (var i = 0; i < _vorbis._channels; i++)
            {
                _residue[i] = new float[_vorbis.Block1Size];
            }
        }
예제 #3
0
        private 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;
            }
        }
예제 #4
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);
        }
예제 #5
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);
        }
예제 #6
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);
        }
예제 #7
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);
        }
예제 #8
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);
        }
예제 #9
0
 private VorbisMode(VorbisStreamDecoder vorbis)
 {
     _vorbis = vorbis;
 }
예제 #10
0
 internal Floor0(VorbisStreamDecoder vorbis) : base(vorbis)
 {
 }
예제 #11
0
 protected VorbisFloor(VorbisStreamDecoder vorbis)
 {
     _vorbis = vorbis;
 }
예제 #12
0
 internal Time0(VorbisStreamDecoder vorbis) : base(vorbis)
 {
 }
예제 #13
0
 protected VorbisTime(VorbisStreamDecoder vorbis)
 {
     _vorbis = vorbis;
 }
예제 #14
0
 internal Mapping0(VorbisStreamDecoder vorbis) : base(vorbis)
 {
 }
예제 #15
0
 protected VorbisMapping(VorbisStreamDecoder vorbis)
 {
     _vorbis = vorbis;
 }
예제 #16
0
 internal Residue2(VorbisStreamDecoder vorbis) : base(vorbis)
 {
 }