Exemplo n.º 1
0
        public float[] Processing1(float[] audioSource, ref int vad)
        {
            if (!_isInit)
            {
                return(o_source160);
            }
            if (_delayFreamSize <= 0)
            {
                AudioDefine.To16Array(o_source, audioSource);
                AudioProcessingDll.WebRtc_BufferFarend(o_source);

                IntPtr ptr = IntPtr.Zero;
                vad = AudioProcessingDll.Process(g_source, ref ptr, AudioDefine.MS_IN_SEND_CARDBUF);
                for (int i = 0; i < g_source.Length; i++)
                {
                    g_source [i] = o_source [i];
                }
                Marshal.Copy(ptr, o_source, 0, AudioDefine.G_FRAME_SIZE);
                AudioDefine.ToFArray(o_source160, o_source);
            }
            else
            {
                _delayFreamSize--;
                AudioDefine.To16Array(g_source, audioSource);
            }

            return(o_source160);
        }
Exemplo n.º 2
0
        public static byte[] EnFrame(float[] ibuf)
        {
            AudioDefine.To16Array(outShort, ibuf);
            AudioProcessingDll.amr_enc(outShort, ibuf.Length);
            IntPtr ptr = IntPtr.Zero;
            int    len = AudioProcessingDll.next_enc(ref ptr);

            Marshal.Copy(ptr, outByte, 0, len);
            return(outByte);
        }
Exemplo n.º 3
0
        public float[] Processing4(float[] audioSource, ref int vad)
        {
            if (!_isInit || i_data == null)
            {
                return(audioSource);
            }
            AudioDefine.To16Array(g_source, audioSource);
            IntPtr ptr = IntPtr.Zero;

            AudioProcessingDll.WebRtc_BufferFarend(GetListerBuff());
            vad = AudioProcessingDll.Process(g_source, ref ptr, AudioDefine.MS_IN_SEND_CARDBUF);
            Marshal.Copy(ptr, o_source, 0, AudioDefine.G_FRAME_SIZE);
            AudioDefine.ToFArray(o_source160, o_source);

            return(o_source160);
        }
Exemplo n.º 4
0
 public float[] Processing(float[] audioSource, ref int vad)
 {
     if (!_isInit)
     {
         return(o_source160);
     }
     AudioDefine.To16Array(g_source, audioSource);
     if (_delayFreamSize <= 0)
     {
         IntPtr ptr = IntPtr.Zero;
         vad = AudioProcessingDll.Process(g_source, ref ptr, AudioDefine.MS_IN_SEND_CARDBUF);
         Marshal.Copy(ptr, o_source, 0, AudioDefine.G_FRAME_SIZE);
         AudioDefine.ToFArray(o_source160, o_source);
     }
     else
     {
         _delayFreamSize--;
     }
     AudioProcessingDll.WebRtc_BufferFarend(g_source);
     return(o_source160);
 }