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

            if (GetAudioPlaybackDeviceCount() > 0)
            {
                System.IntPtr playbackDeviceName = Marshal.AllocHGlobal(512);
                System.IntPtr playbackDeviceId   = Marshal.AllocHGlobal(512);
                int           ret = IRtcEngineNative.getCurrentPlaybackDeviceInfo(playbackDeviceName, playbackDeviceId);
                deviceName = Marshal.PtrToStringAnsi(playbackDeviceName);
                deviceId   = Marshal.PtrToStringAnsi(playbackDeviceId);
                Marshal.FreeHGlobal(playbackDeviceName);
                Marshal.FreeHGlobal(playbackDeviceId);
                return(ret);
            }
            else
            {
                return((int)ERROR_CODE.ERROR_NO_DEVICE_PLUGIN);
            }
        }