internal static VorbisCodebook Init(VorbisStreamDecoder vorbis, DataPacket packet, int number) { var temp = new VorbisCodebook(); temp.BookNum = number; temp.Init(packet); return(temp); }
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]; } }
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; } }
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); }
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); }
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); }
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); }
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); }
private VorbisMode(VorbisStreamDecoder vorbis) { _vorbis = vorbis; }
internal Floor0(VorbisStreamDecoder vorbis) : base(vorbis) { }
protected VorbisFloor(VorbisStreamDecoder vorbis) { _vorbis = vorbis; }
internal Time0(VorbisStreamDecoder vorbis) : base(vorbis) { }
protected VorbisTime(VorbisStreamDecoder vorbis) { _vorbis = vorbis; }
internal Mapping0(VorbisStreamDecoder vorbis) : base(vorbis) { }
protected VorbisMapping(VorbisStreamDecoder vorbis) { _vorbis = vorbis; }
internal Residue2(VorbisStreamDecoder vorbis) : base(vorbis) { }