Example #1
0
        /** Retrieves the device information of the current audio recording device.
         *
         * @param deviceName The device name of the current audio recording device.
         * @param deviceId The device ID of the current audio recording device.
         *
         * @return
         * - 0: Success.
         * - < 0: Failure.
         */
        public override int GetCurrentRecordingDeviceInfo(ref string deviceName, ref string deviceId)
        {
            if (mEngine == null)
            {
                return((int)ERROR_CODE.ERROR_NOT_INIT_ENGINE);
            }

            if (GetAudioRecordingDeviceCount() > 0)
            {
                System.IntPtr audioRecordingDeviceNamePtr = Marshal.AllocHGlobal(512);
                System.IntPtr audioRecordingDeviceIdPtr   = Marshal.AllocHGlobal(512);
                int           ret = IRtcEngineNative.getCurrentRecordingDeviceInfo(audioRecordingDeviceNamePtr, audioRecordingDeviceIdPtr);
                deviceName = Marshal.PtrToStringAnsi(audioRecordingDeviceNamePtr);
                deviceId   = Marshal.PtrToStringAnsi(audioRecordingDeviceIdPtr);
                Marshal.FreeHGlobal(audioRecordingDeviceNamePtr);
                Marshal.FreeHGlobal(audioRecordingDeviceIdPtr);
                return(ret);
            }
            else
            {
                return((int)ERROR_CODE.ERROR_NO_DEVICE_PLUGIN);
            }
        }