/// <summary>
        /// 自定义音频数据接口, 采样位深只支持16或32, kNIMDeviceSampleRate支持8000,16000,32000,44100
        /// </summary>
        /// <param name="time">时间毫秒级</param>
        /// <param name="data">音频数据pcm格式</param>
        /// <param name="size">data的数据长度 sizeof(char)</param>
        /// <param name="info">拓展json封装类</param>
        /// <returns>bool true 调用成功,false 调用失败</returns>
        public static bool CustomAudioData(ulong time, IntPtr data, uint size, NIMCustomAudioDataInfo info)
        {
#if NIMAPI_UNDER_WIN_DESKTOP_ONLY || UNITY_STANDALONE_WIN
            string jsonExtension = "";
            if (info != null)
            {
                jsonExtension = info.Serialize();
            }
            return(DeviceNativeMethods.nim_vchat_custom_audio_data(time, data, size, jsonExtension));
#else
            return(false);
#endif
        }
Esempio n. 2
0
        /// <summary>
        /// 自定义音频数据接口, 采样位深只支持16或32, kNIMDeviceSampleRate支持8000,16000,32000,44100
        /// </summary>
        /// <param name="time">时间毫秒级</param>
        /// <param name="data">音频数据pcm格式</param>
        /// <param name="size">data的数据长度 sizeof(char)</param>
        /// <param name="info">采样频和采样位深 默认如{"sample_rate":16000, "sample_bit":16}</param>
        /// <returns></returns>
        public static bool CustomAudioData(ulong time, IntPtr data, uint size, NIMCustomAudioDataInfo info)
        {
            string jsonExtension = info.Serialize();

            return(DeviceNativeMethods.nim_vchat_custom_audio_data(time, data, size, jsonExtension));
        }