예제 #1
0
        public override void Write(byte[] buffer, int offset, int count)
        {
            uint num = 0u;

            while (count > 0)
            {
                if (this.int_2 > 0)
                {
                    int num2 = Math.Min(count, this.byte_0.Length - this.int_2);
                    Buffer.BlockCopy(buffer, offset, this.byte_0, this.int_2, num2);
                    this.int_2 += num2;
                    offset     += num2;
                    count      -= num2;
                    if (this.int_2 >= this.byte_0.Length)
                    {
                        this.int_2 = 0;
                        uint num3 = LameEncoder.smethod_1(this.uint_0, this.byte_0, this.byte_1, ref num);
                        if (num3 != 0u)
                        {
                            throw new ApplicationException("Lame_encDll.EncodeChunk failed with the error code " + num3);
                        }
                        if (num > 0u)
                        {
                            this.stream_0.Write(this.byte_1, 0, (int)num);
                        }
                    }
                }
                else if (count >= this.byte_0.Length)
                {
                    uint num3 = LameEncoder.smethod_0(this.uint_0, buffer, offset, (uint)this.byte_0.Length, this.byte_1, ref num);
                    if (num3 != 0u)
                    {
                        throw new ApplicationException("Lame_encDll.EncodeChunk failed with the error code " + num3);
                    }
                    if (num > 0u)
                    {
                        this.stream_0.Write(this.byte_1, 0, (int)num);
                    }
                    count  -= this.byte_0.Length;
                    offset += this.byte_0.Length;
                }
                else
                {
                    Buffer.BlockCopy(buffer, offset, this.byte_0, 0, count);
                    this.int_2 = count;
                    offset    += count;
                    count      = 0;
                }
            }
        }
예제 #2
0
        public static uint smethod_0(uint uint_0, byte[] byte_0, int int_0, uint uint_1, byte[] byte_1, ref uint uint_2)
        {
            GCHandle gCHandle = GCHandle.Alloc(byte_0, GCHandleType.Pinned);
            uint     result;

            try
            {
                IntPtr pSamples = (IntPtr)(gCHandle.AddrOfPinnedObject().ToInt32() + int_0);
                result = LameEncoder.beEncodeChunk(uint_0, uint_1 / 2u, pSamples, byte_1, ref uint_2);
            }
            finally
            {
                gCHandle.Free();
            }
            return(result);
        }
예제 #3
0
 public Stream16(Stream stream_1, WaveFormat waveFormat_1, BE_CONFIG be_CONFIG_1) : base(stream_1, waveFormat_1)
 {
     try
     {
         this.be_CONFIG_0 = be_CONFIG_1;
         uint num = LameEncoder.beInitStream(this.be_CONFIG_0, ref this.uint_1, ref this.uint_2, ref this.uint_0);
         if (num != 0u)
         {
             throw new ApplicationException(string.Format("Lame_encDll.beInitStream failed with the error code {0}", num));
         }
         this.byte_0 = new byte[this.uint_1 * 2u];
         this.byte_1 = new byte[this.uint_2];
     }
     catch
     {
         base.Close();
         throw;
     }
 }
예제 #4
0
 public void method_1()
 {
     if (!this.bool_0)
     {
         try
         {
             uint num = 0u;
             if (this.int_2 > 0 && LameEncoder.smethod_0(this.uint_0, this.byte_0, 0, (uint)this.int_2, this.byte_1, ref num) == 0u && num > 0u)
             {
                 base.Write(this.byte_1, 0, (int)num);
             }
             num = 0u;
             if (LameEncoder.beDeinitStream(this.uint_0, this.byte_1, ref num) == 0u && num > 0u)
             {
                 base.Write(this.byte_1, 0, (int)num);
             }
         }
         finally
         {
             LameEncoder.beCloseStream(this.uint_0);
         }
     }
     this.bool_0 = true;
 }
예제 #5
0
 public static uint smethod_1(uint uint_0, byte[] byte_0, byte[] byte_1, ref uint uint_1)
 {
     return(LameEncoder.smethod_0(uint_0, byte_0, 0, (uint)byte_0.Length, byte_1, ref uint_1));
 }