![]() Public static int AudioVolumeGet(bool inputDevice) Get default audio device volume (0-100) Marshal.ThrowExceptionForHR(_AudioEndPointVolume.RegisterControlChangeNotify(_CallBack)) _CallBack = new AudioEndpointVolumeCallback(this) _AudioEndPointVolume = result as IAudioEndpointVolume Marshal.ThrowExceptionForHR(_RealDevice.Activate(ref IID_IAudioEndpointVolume, CTX.ALL, IntPtr.Zero, out result)) ![]() Throw new ApplicationException($"audio device is not active ()") If (state != devstatus.DEVICE_STATE_ACTIVE) Marshal.ThrowExceptionForHR(_Device.GetState(out state)) Marshal.ThrowExceptionForHR(_realEnumerator.GetDevice(_devId, out _Device)) Marshal.ThrowExceptionForHR(_Device.GetId(out _devId)) Marshal.ThrowExceptionForHR(_realEnumerator.GetDefaultAudioEndpoint(0, 1, out _Device)) _realEnumerator = new _AEDeviceEnumerator() as IMMDeviceEnumerator Systemvolume.SetMasterVolumeLevelScalar(muted?0:1, Guid.Empty) IAudioEndpointVolume systemvolume = _volume as IAudioEndpointVolume Processvolume.SetMute(muted, Guid.Empty) Processvolume.SetMasterVolume(volume, Guid.Empty) Processvolume.GetMasterVolume(out float prevolume) Manager.GetSimpleAudioVolume(Guid.Empty, false, out ISimpleAudioVolume processvolume) IAudioSessionManager manager = _manager as IAudioSessionManager IMMDeviceEnumerator enumerator = _enumerater as IMMDeviceEnumerator Įnumerator.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia, out IMMDevice endpoint) Įndpoint.Activate(ref guidManager, CLSCTX_ALL, IntPtr.Zero, out IUnknown _manager) Įndpoint.Activate(ref guidVolume, CLSCTX_ALL, IntPtr.Zero, out IUnknown _volume) Guid guidVolume = typeof(IAudioEndpointVolume).GUID ĬoCreateInstance(ref MMDeviceEnumerator, null, CLSCTX_ALL, ref guidEnumetator, out IUnknown _enumerater) Guid guidManager = typeof(IAudioSessionManager).GUID Guid guidEnumetator = typeof(IMMDeviceEnumerator).GUID Public void SetAppAndSystemVolume(float volume, bool muted) _audioCaptureClient = (IAudioCaptureClient)obj Marshal.ThrowExceptionForHR((int)result) Result = _audioClient.GetService(typeof(IAudioCaptureClient).GUID, out obj) Result = _audioClient.Initialize(AudioClientMode.Shared, streamFlag, 10000000, 0, waveFormat, ref _sessionGuid) ![]() StreamFlag = AudioClientStreamFlags.Loopback Result = _audioClient.GetMixFormat(out waveFormat) ĪudioClientStreamFlags streamFlag = AudioClientStreamFlags.None _audioMeter = (IAudioMeterInformation)obj Result = _audioDevice.Activate(typeof(IAudioMeterInformation).GUID, 0, IntPtr.Zero, out obj) Result = _audioDevice.Activate(typeof(IAudioClient).GUID, 0, IntPtr.Zero, out object obj) Result = deviceEnumerator.RegisterEndpointNotificationCallback(_notif圜lient) _notif圜lient = new MMNotificationClient() Private void InitializeAudio(AudioDataFlow audioFlow, IMMDeviceEnumerator deviceEnumerator)ĬOMResult result = deviceEnumerator.GetDefaultAudioEndpoint(audioFlow, EndPointRole.eMultimedia, out _audioDevice) If I have helped you resolve the issue, feel free to give me a virtual high-five by clicking the ' Thumbs Up ' icon below, Followed by clicking on " Accept as solution " from the drop-down menu on the upper right corner ,Thank you for posting in the HP Support Community. Hope this helps! Keep me posted for further assistance. Please check if you can see HP Audio Switch and is yes then uninstall it. It will give a list of programs available. Uninstalling the HP Audio switch from Control panel - open control panel>programs> uninstall a program.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |