Пример #1
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;
        }
Пример #2
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);
        }
 void ReadResiduesSetup( int count )
 {
     residueConfigs = new Residue[count];
     for( int i = 0; i < residueConfigs.Length; i++ ) {
         int residueType = bitReader.ReadBits( 16 );
         Residue residue = null;
         Console.Write( " R: " + residueType );
         if( residueType == 0 ) {
             residue = new Residue0();
         } else if( residueType == 1 ) {
             residue = new Residue1();
         } else if( residueType == 2 ) {
             residue = new Residue2();
         } else {
             throw new InvalidDataException( "Invalid residue type: " + residueType );
         }
         residue.ReadSetupData( this, bitReader );
         residueConfigs[i] = residue;
     }
     Console.WriteLine();
 }