/** Retrieves the audio playback device associated with the index.
         *
         * After calling this method, the SDK retrieves the device name and device ID according to the index.
         *
         * @note Call {@link agora_gaming_rtc.AudioPlaybackDeviceManager.GetAudioPlaybackDeviceCount GetAudioPlaybackDeviceCount} before this method.
         *
         * @param index The index of the playback device in the system. The value of `index` is associated with the number of the playback device which is retrieved from `GetAudioPlaybackDeviceCount`. For example, when the number of playback devices is 3, the value range of `index` is [0,2].
         * @param deviceName The name of the playback device for the corresponding index.
         * @param deviceId The ID of the playback device for the corresponding index.
         *
         * @return
         * - 0: Success.
         * - < 0: Failure.
         */
        public override int GetAudioPlaybackDevice(int index, ref string deviceName, ref string deviceId)
        {
            if (mEngine == null)
            {
                return((int)ERROR_CODE.ERROR_NOT_INIT_ENGINE);
            }

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