예제 #1
0
파일: Stream16.cs 프로젝트: uwx/Open-GHTCP
 public void method_1()
 {
     if (!_bool0)
     {
         try
         {
             var num = 0u;
             if (_int2 > 0 && LameEncoder.smethod_0(_uint0, _byte0, 0, (uint)_int2, _byte1, ref num) == 0u &&
                 num > 0u)
             {
                 base.Write(_byte1, 0, (int)num);
             }
             num = 0u;
             if (LameEncoder.beDeinitStream(_uint0, _byte1, ref num) == 0u && num > 0u)
             {
                 base.Write(_byte1, 0, (int)num);
             }
         }
         finally
         {
             LameEncoder.beCloseStream(_uint0);
         }
     }
     _bool0 = true;
 }
예제 #2
0
파일: Stream16.cs 프로젝트: uwx/Open-GHTCP
        public override void Write(byte[] buffer, int offset, int count)
        {
            var num = 0u;

            while (count > 0)
            {
                if (_int2 > 0)
                {
                    var num2 = Math.Min(count, _byte0.Length - _int2);
                    Buffer.BlockCopy(buffer, offset, _byte0, _int2, num2);
                    _int2  += num2;
                    offset += num2;
                    count  -= num2;
                    if (_int2 >= _byte0.Length)
                    {
                        _int2 = 0;
                        var num3 = LameEncoder.smethod_1(_uint0, _byte0, _byte1, ref num);
                        if (num3 != 0u)
                        {
                            throw new ApplicationException("Lame_encDll.EncodeChunk failed with the error code " +
                                                           num3);
                        }
                        if (num > 0u)
                        {
                            Stream0.Write(_byte1, 0, (int)num);
                        }
                    }
                }
                else if (count >= _byte0.Length)
                {
                    var num3 = LameEncoder.smethod_0(_uint0, buffer, offset, (uint)_byte0.Length, _byte1, ref num);
                    if (num3 != 0u)
                    {
                        throw new ApplicationException("Lame_encDll.EncodeChunk failed with the error code " + num3);
                    }
                    if (num > 0u)
                    {
                        Stream0.Write(_byte1, 0, (int)num);
                    }
                    count  -= _byte0.Length;
                    offset += _byte0.Length;
                }
                else
                {
                    Buffer.BlockCopy(buffer, offset, _byte0, 0, count);
                    _int2   = count;
                    offset += count;
                    count   = 0;
                }
            }
        }
예제 #3
0
파일: Stream16.cs 프로젝트: uwx/Open-GHTCP
 public Stream16(Stream stream1, WaveFormat waveFormat1, BeConfig beConfig1) : base(stream1, waveFormat1)
 {
     try
     {
         _beConfig0 = beConfig1;
         var num = LameEncoder.beInitStream(_beConfig0, ref _uint1, ref _uint2, ref _uint0);
         if (num != 0u)
         {
             throw new ApplicationException(
                       string.Format("Lame_encDll.beInitStream failed with the error code {0}", num));
         }
         _byte0 = new byte[_uint1 * 2u];
         _byte1 = new byte[_uint2];
     }
     catch
     {
         base.Close();
         throw;
     }
 }