internal static global::System.Runtime.InteropServices.HandleRef getCPtr(vx_req_aux_set_capture_device_t obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }
public IAsyncResult BeginSetActiveDevice(IAudioDevice device, AsyncCallback callback) { if (device == null) { throw new ArgumentNullException(); } AsyncNoResult result = new AsyncNoResult(callback); var request = new vx_req_aux_set_capture_device_t(); request.capture_device_specifier = device.Key; return(_client.BeginIssueRequest(request, ar => { try { _client.EndIssueRequest(ar); // When trying to set the active device to what is already the active device, return. if (_activeDevice.Key == device.Key) { return; } _activeDevice = (AudioDevice)device; if (_activeDevice == AvailableDevices["Default System Device"]) { _effectiveDevice = new AudioDevice { Key = _systemDevice.Key, Name = _systemDevice.Name }; } else if (_activeDevice == AvailableDevices["Default Communication Device"]) { _effectiveDevice = new AudioDevice { Key = _communicationDevice.Key, Name = _communicationDevice.Name }; } else { _effectiveDevice = new AudioDevice { Key = device.Key, Name = device.Name }; } PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(EffectiveDevice))); result.SetComplete(); } catch (Exception e) { VivoxDebug.Instance.VxExceptionMessage($"{request.GetType().Name} failed: {e}"); result.SetComplete(e); if (VivoxDebug.Instance.throwInternalExcepetions) { throw; } } })); }