当前位置: 首页>>代码示例>>C#>>正文


C# org.advance方法代码示例

本文整理汇总了C#中org.advance方法的典型用法代码示例。如果您正苦于以下问题:C# org.advance方法的具体用法?C# org.advance怎么用?C# org.advance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org的用法示例。


在下文中一共展示了org.advance方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: speexInbandRequest

        /// <summary>Speex in-band request (submode=14).</summary>
        /// <remarks>Speex in-band request (submode=14).</remarks>
        /// <param name="bits">- Speex bits buffer.</param>
        /// <exception cref="java.io.StreamCorruptedException">If stream seems corrupted.</exception>
        public virtual void speexInbandRequest(org.xiph.speex.Bits bits)
        {
            int code = bits.unpack(4);
            switch (code)
            {
                case 0:
                {
                    // asks the decoder to set perceptual enhancment off (0) or on (1)
                    bits.advance(1);
                    break;
                }

                case 1:
                {
                    // asks (if 1) the encoder to be less "aggressive" due to high packet loss
                    bits.advance(1);
                    break;
                }

                case 2:
                {
                    // asks the encoder to switch to mode N
                    bits.advance(4);
                    break;
                }

                case 3:
                {
                    // asks the encoder to switch to mode N for low-band
                    bits.advance(4);
                    break;
                }

                case 4:
                {
                    // asks the encoder to switch to mode N for high-band
                    bits.advance(4);
                    break;
                }

                case 5:
                {
                    // asks the encoder to switch to quality N for VBR
                    bits.advance(4);
                    break;
                }

                case 6:
                {
                    // request acknowledgement (0=no, 1=all, 2=only for inband data)
                    bits.advance(4);
                    break;
                }

                case 7:
                {
                    // asks the encoder to set CBR(0), VAD(1), DTX(3), VBR(5), VBR+DTX(7)
                    bits.advance(4);
                    break;
                }

                case 8:
                {
                    // transmit (8-bit) character to the other end
                    bits.advance(8);
                    break;
                }

                case 9:
                {
                    // intensity stereo information
                    // setup the stereo decoder; to skip: tmp = bits.unpack(8); break;
                    stereo.init(bits);
                    // read 8 bits
                    break;
                }

                case 10:
                {
                    // announce maximum bit-rate acceptable (N in byets/second)
                    bits.advance(16);
                    break;
                }

                case 11:
                {
                    // reserved
                    bits.advance(16);
                    break;
                }

                case 12:
                {
                    // Acknowledge receiving packet N
                    bits.advance(32);
                    break;
//.........这里部分代码省略.........
开发者ID:sangnvus,项目名称:technical-docs,代码行数:101,代码来源:Inband.cs

示例2: decode

 /// <summary>Decode the given input bits.</summary>
 /// <remarks>Decode the given input bits.</remarks>
 /// <param name="bits">- Speex bits buffer.</param>
 /// <param name="out">- the decoded mono audio frame.</param>
 /// <returns>1 if a terminator was found, 0 if not.</returns>
 /// <exception cref="java.io.StreamCorruptedException">
 /// If there is an error detected in the
 /// data stream.
 /// </exception>
 public virtual int decode(org.xiph.speex.Bits bits, float[] @out)
 {
     int i;
     int sub;
     int pitch;
     int ol_pitch = 0;
     int m;
     float[] pitch_gain = new float[3];
     float ol_gain = 0.0f;
     float ol_pitch_coef = 0.0f;
     int best_pitch = 40;
     float best_pitch_gain = 0;
     float pitch_average = 0;
     if (bits == null && dtx_enabled != 0)
     {
         submodeID = 0;
     }
     else
     {
         if (bits == null)
         {
             decodeLost(@out);
             return 0;
         }
         do
         {
             if (bits.unpack(1) != 0)
             {
                 //Wideband
                 m = bits.unpack(org.xiph.speex.SbCodec.SB_SUBMODE_BITS);
                 int advance = org.xiph.speex.SbCodec.SB_FRAME_SIZE[m];
                 if (advance < 0)
                 {
                     throw new java.io.StreamCorruptedException("Invalid sideband mode encountered (1st sideband): "
                          + m);
                 }
                 //return -2;
                 advance -= (org.xiph.speex.SbCodec.SB_SUBMODE_BITS + 1);
                 bits.advance(advance);
                 if (bits.unpack(1) != 0)
                 {
                     m = bits.unpack(org.xiph.speex.SbCodec.SB_SUBMODE_BITS);
                     advance = org.xiph.speex.SbCodec.SB_FRAME_SIZE[m];
                     if (advance < 0)
                     {
                         throw new java.io.StreamCorruptedException("Invalid sideband mode encountered. (2nd sideband): "
                              + m);
                     }
                     //return -2;
                     advance -= (org.xiph.speex.SbCodec.SB_SUBMODE_BITS + 1);
                     bits.advance(advance);
                     if (bits.unpack(1) != 0)
                     {
                         throw new java.io.StreamCorruptedException("More than two sideband layers found");
                     }
                 }
             }
             //return -2;
             //*/
             m = bits.unpack(NB_SUBMODE_BITS);
             if (m == 15)
             {
                 return 1;
             }
             else
             {
                 if (m == 14)
                 {
                     inband.speexInbandRequest(bits);
                 }
                 else
                 {
                     if (m == 13)
                     {
                         inband.userInbandRequest(bits);
                     }
                     else
                     {
                         if (m > 8)
                         {
                             throw new java.io.StreamCorruptedException("Invalid mode encountered: " + m);
                         }
                     }
                 }
             }
         }
         while (m > 8);
         //return -2;
         submodeID = m;
     }
     System.Array.Copy(frmBuf, frameSize, frmBuf, 0, bufSize - frameSize);
//.........这里部分代码省略.........
开发者ID:sangnvus,项目名称:technical-docs,代码行数:101,代码来源:NbDecoder.cs

示例3: userInbandRequest

 /// <summary>User in-band request (submode=13).</summary>
 /// <remarks>User in-band request (submode=13).</remarks>
 /// <param name="bits">- Speex bits buffer.</param>
 /// <exception cref="java.io.StreamCorruptedException">If stream seems corrupted.</exception>
 public virtual void userInbandRequest(org.xiph.speex.Bits bits)
 {
     int req_size = bits.unpack(4);
     bits.advance(5 + 8 * req_size);
 }
开发者ID:sangnvus,项目名称:technical-docs,代码行数:9,代码来源:Inband.cs


注:本文中的org.advance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。