/// <summary> /// Dispose /// </summary> public void Dispose() { if (callBack != null) { Marshal.ThrowExceptionForHR(audioEndPointVolume.UnregisterControlChangeNotify(callBack)); callBack = null; } GC.SuppressFinalize(this); }
/// <summary> /// Creates a new Audio endpoint volume /// </summary> /// <param name="realEndpointVolume">IAudioEndpointVolume COM interface</param> internal AudioEndpointVolume(IAudioEndpointVolume realEndpointVolume) { uint hardwareSupp; audioEndPointVolume = realEndpointVolume; channels = new AudioEndpointVolumeChannels(audioEndPointVolume); stepInformation = new AudioEndpointVolumeStepInformation(audioEndPointVolume); Marshal.ThrowExceptionForHR(audioEndPointVolume.QueryHardwareSupport(out hardwareSupp)); hardwareSupport = (EEndpointHardwareSupport)hardwareSupp; volumeRange = new AudioEndpointVolumeVolumeRange(audioEndPointVolume); callBack = new AudioEndpointVolumeCallback(this); Marshal.ThrowExceptionForHR(audioEndPointVolume.RegisterControlChangeNotify(callBack)); }