Пример #1
0
        private void DecodePage()
        {
            this.need_more_data = false;
            Xiph.ogg_stream_pagein(this.os, this.og);
            while (true)
            {
                int num = Xiph.ogg_stream_packetout(this.os, this.op);
                if (num == 0)
                {
                    break;
                }
                if (num < 0)
                {
                    goto Block_2;
                }
                if (Xiph.vorbis_synthesis(this.vb, this.op) == 0)
                {
                    Xiph.vorbis_synthesis_blockin(this.vd, this.vb);
                }
                float[][] array;
                int[]     array2;
                int       num2;
                while ((num2 = Xiph.vorbis_synthesis_pcmout(this.vd, out array, out array2)) > 0)
                {
                    int num3 = num2;
                    for (int i = 0; i < this.vi.channels; i++)
                    {
                        int     num4   = i;
                        float[] array3 = array[i];
                        int     num5   = array2[i];
                        for (int j = 0; j < num3; j++)
                        {
                            float num6 = array3[num5 + j];
                            if (num6 > 1f)
                            {
                                num6 = 1f;
                            }
                            if (num6 < -1f)
                            {
                                num6 = -1f;
                            }
                            int num7 = this.curPcmOffset + num4;
                            if (num7 < 352800)
                            {
                                this.curPcm[num7] = num6;
                            }
                            int num8 = num7 - 352800 + 176400;
                            if (num8 >= 0 && num8 < 352800)
                            {
                                this.nxtPcm[num8] = num6;
                            }
                            num4 += this.vi.channels;
                        }
                    }
                    this.PcmSampleCount += (long)num3;
                    this.curPcmOffset   += num3 * this.vi.channels;
                    Xiph.vorbis_synthesis_read(this.vd, num3);
                }
                if (!this.need_more_data && this.curPcmOffset >= 352800)
                {
                    this.need_next_pcm = false;
                }
            }
            this.need_more_data = true;
Block_2:
            if (Xiph.ogg_page_eos(this.og) != 0)
            {
                this.need_next_pcm  = false;
                this.need_more_data = false;
                this.last_buf       = true;
                this.eos            = true;
            }
        }