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

            temp.BookNum = number;
            temp.Init(packet);
            return(temp);
        }
Exemple #2
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];
            }
        }
Exemple #3
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;
            }
        }
Exemple #4
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 InvalidOperationException();
            }

            mapping.Init(packet);
            return(mapping);
        }
Exemple #5
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 InvalidOperationException();
            }

            time.Init(packet);
            return(time);
        }
Exemple #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 InvalidOperationException();
            }

            floor.Init(packet);
            return(floor);
        }
Exemple #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 InvalidOperationException();
            }

            residue.Init(packet);
            return(residue);
        }
Exemple #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 InvalidOperationException();
            }

            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);
        }
Exemple #9
0
 internal Residue2(VorbisStreamDecoder vorbis) : base(vorbis)
 {
 }
Exemple #10
0
 private VorbisMode(VorbisStreamDecoder vorbis)
 {
     _vorbis = vorbis;
 }
Exemple #11
0
 internal Floor0(VorbisStreamDecoder vorbis) : base(vorbis)
 {
 }
Exemple #12
0
 protected VorbisFloor(VorbisStreamDecoder vorbis)
 {
     _vorbis = vorbis;
 }
Exemple #13
0
 internal Mapping0(VorbisStreamDecoder vorbis) : base(vorbis)
 {
 }
Exemple #14
0
 protected VorbisMapping(VorbisStreamDecoder vorbis)
 {
     _vorbis = vorbis;
 }
Exemple #15
0
 internal Time0(VorbisStreamDecoder vorbis) : base(vorbis)
 {
 }
Exemple #16
0
 protected VorbisTime(VorbisStreamDecoder vorbis)
 {
     _vorbis = vorbis;
 }