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); }
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); }