private void btn_accompany_Click(object sender, EventArgs e)
        {
#if WIN32
            StartDeviceResultHandler cb = (type, ret) =>
            {
                if (ret)
                {
                    accompany_ = !accompany_;
                    Action action = () =>
                    {
                        if (accompany_)
                        {
                            btn_accompany.Text = "伴奏(关)";
                        }
                    };
                    this.Invoke(action);
                }
            };
            if (!accompany_)
            {
                NIM.DeviceAPI.StartDevice(NIMDeviceType.kNIMDeviceTypeAudioHook, tb_player_path_.Text, 0, null, cb);
            }
            else
            {
                NIM.DeviceAPI.EndDevice(NIMDeviceType.kNIMDeviceTypeAudioHook);
                btn_accompany.Text = "伴奏(开)";
            }
#elif WIN64
            MessageBox.Show("目前64位没有伴奏功能");
#endif
        }
        /// <summary>
        /// 启动辅助的摄像头,摄像头数据通过SetVideoCaptureDataCb设置采集回调返回,不直接通过视频通话发送给对方,并且不参与设备监听检测
        /// </summary>
        /// <param name="id">摄像头标识,用于开关及数据回调时的对应,不能为空。(同一id下设备将不重复启动,如果设备device_path不同会先关闭前一个设备开启新设备)</param>
        /// <param name="device_path">设备路径</param>
        /// <param name="fps">摄像头为采样频率</param>
        /// <param name="json_extension">打开摄像头是允许设置 kNIMDeviceWidth 和 kNIMDeviceHeight,并取最接近设置值的画面模式</param>
        /// <param name="handler">回调</param>
        ///<returns>无返回值</returns>
        public static void StartExtendCamera(string id, string device_path, uint fps, string json_extension, StartDeviceResultHandler handler)
        {
            var ptr = NimUtility.DelegateConverter.ConvertToIntPtr(handler);

            DeviceNativeMethods.nim_vchat_start_extend_camera(id, device_path, fps, json_extension, StartExtendCameraCb, ptr);
        }
        /// <summary>
        /// 启动设备,同一NIMDeviceType下设备将不重复启动,不同的设备会先关闭前一个设备开启新设备
        /// </summary>
        /// <param name="type">设备类型</param>
        /// <param name="devicePath">设备路径对应</param>
        /// <param name="fps">摄像头为采样频率(一般传电源频率取50),其他NIMDeviceType无效(麦克风采样频率由底层控制,播放器采样频率也由底层控制)</param>
        /// <param name="StartDeviceInfo">启动设备json封装类</param>
        /// <param name="handler">回调</param>
        /// <returns>无返回值</returns>
        public static void StartDevice(NIMDeviceType type, string devicePath, uint fps, NIMStartDeviceJsonEX StartDeviceInfo, StartDeviceResultHandler handler)
        {
#if NIMAPI_UNDER_WIN_DESKTOP_ONLY || UNITY_STANDALONE_WIN
            if (StartDeviceInfo == null)
            {
                StartDeviceInfo = new NIMStartDeviceJsonEX();
            }
            string json_info = StartDeviceInfo.Serialize();
            var    ptr       = NimUtility.DelegateConverter.ConvertToIntPtr(handler);
            DeviceNativeMethods.nim_vchat_start_device(type, devicePath, fps, json_info, StartDeviceCb, ptr);
#else
#endif
        }
示例#4
0
        /// <summary>
        /// 启动设备,同一NIMDeviceType下设备将不重复启动,不同的设备会先关闭前一个设备开启新设备
        /// </summary>
        /// <param name="type">设备类型</param>
        /// <param name="devicePath">设备路径对应</param>
        /// <param name="fps">摄像头为采样频率(一般传电源频率取50),其他NIMDeviceType无效(麦克风采样频率由底层控制,播放器采样频率也由底层控制)</param>
        /// <param name="handler">回调</param>
        public static void StartDevice(NIMDeviceType type, string devicePath, uint fps, StartDeviceResultHandler handler)
        {
            var ptr = NimUtility.DelegateConverter.ConvertToIntPtr(handler);

            DeviceNativeMethods.nim_vchat_start_device(type, devicePath, fps, "", StartDeviceCb, ptr);
        }
示例#5
0
        /// <summary>
        /// 启动设备,同一NIMDeviceType下设备将不重复启动,不同的设备会先关闭前一个设备开启新设备
        /// </summary>
        /// <param name="type">设备类型</param>
        /// <param name="devicePath">设备路径对应</param>
        /// <param name="fps">摄像头为采样频率(一般传电源频率取50),其他NIMDeviceType无效(麦克风采样频率由底层控制,播放器采样频率也由底层控制)</param>
        /// <param name="StartDeviceInfo">启动设备json封装类</param>
        /// <param name="handler">回调</param>
        /// <returns>无返回值</returns>
        public static void StartDevice(NIMDeviceType type, string devicePath, uint fps, NIMStartDeviceJsonEX StartDeviceInfo, StartDeviceResultHandler handler)
        {
            if (StartDeviceInfo == null)
            {
                StartDeviceInfo = new NIMStartDeviceJsonEX();
            }
            string json_info = StartDeviceInfo.Serialize();
            var    ptr       = NimUtility.DelegateConverter.ConvertToIntPtr(handler);

            DeviceNativeMethods.nim_vchat_start_device(type, devicePath, fps, json_info, StartDeviceCb, ptr);
        }