public void CanAccessPropertyStore() { using (var enumerator = new MMDeviceEnumerator()) using (var collection = enumerator.EnumAudioEndpoints(DataFlow.All, DeviceState.All)) { Utils.DumpCollection(collection); enumerator.Dispose(); collection.Dispose(); } }
/// <summary> /// Disposes und unregisters the <see cref="MMNotificationClient"/>. /// </summary> /// <remarks>In order to unregister the <see cref="MMNotificationClient"/>, this method calls the <see cref="MMDeviceEnumerator.UnregisterEndpointNotificationCallback"/> method.</remarks> public void Dispose() { if (!_disposed) { _disposed = true; if (_deviceEnumerator != null && !_deviceEnumerator.IsDisposed) { _deviceEnumerator.Dispose(); } GC.SuppressFinalize(this); } }
public void CanEnumerateCaptureDevices() { using (var enumerator = new MMDeviceEnumerator()) using (var collection = enumerator.EnumAudioEndpoints(DataFlow.Capture, DeviceState.All)) { foreach (var item in collection) { Debug.WriteLine(item.ToString()); item.Dispose(); } enumerator.Dispose(); collection.Dispose(); } }
/// <summary> /// Disposes und unregisters the <see cref="MMNotificationClient"/>. /// </summary> /// <remarks>In order to unregister the <see cref="MMNotificationClient"/>, this method calls the <see cref="MMDeviceEnumerator.UnregisterEndpointNotificationCallback"/> method.</remarks> public void Dispose() { if (!_disposed) { _disposed = true; try { CoreAudioAPIException.Try(_deviceEnumerator.UnregisterEndpointNotificationCallbackNative(this), InterfaceName, "UnregisterEndpointNotificationCallback"); } finally { _deviceEnumerator.Dispose(); } GC.SuppressFinalize(this); } }