Exemplo n.º 1
0
        /// <summary>
        /// 设置编码器属性
        /// </summary>
        /// <param name="setState">目标编码器属性</param>
        /// <param name="value">设置的值</param>
        /// <returns> 0 没有错误,-1为未知请求,-2为无效参数</returns>
        public int SetEncode(SetCoderState setState, int value)
        {
            IntPtr intPtr = GCHandle.Alloc(value, GCHandleType.Pinned).AddrOfPinnedObject();
            int    result = SpeexEncodeApi.Speex_encoder_ctl(_encodeStateIntptr, (int)setState, intPtr);

            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取编码器设置
        /// </summary>
        /// <param name="getState">目标编码器属性</param>
        /// <returns>编码器属性值 -1为未知请求,-2为无效参数</returns>
        public int GetEncode(GetCoderState getState)
        {
            int    value  = 0;
            IntPtr intPtr = GCHandle.Alloc(value, GCHandleType.Pinned).AddrOfPinnedObject();
            int    result = SpeexEncodeApi.Speex_encoder_ctl(_encodeStateIntptr, (int)getState, intPtr);

            if (result == 0)
            {
                result = Marshal.ReadInt32(intPtr);
            }
            return(result);
        }